software.amazon.awssdk.services.cloudwatchevents.DefaultCloudWatchEventsClient Maven / Gradle / Ivy
Show all versions of cloudwatchevents 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.cloudwatchevents;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
import software.amazon.awssdk.awscore.retry.AwsRetryStrategy;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.client.handler.SyncClientHandler;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.core.retry.RetryMode;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.cloudwatchevents.internal.CloudWatchEventsServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.cloudwatchevents.model.ActivateEventSourceRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.ActivateEventSourceResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.CancelReplayRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.CancelReplayResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.CloudWatchEventsException;
import software.amazon.awssdk.services.cloudwatchevents.model.ConcurrentModificationException;
import software.amazon.awssdk.services.cloudwatchevents.model.CreateApiDestinationRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.CreateApiDestinationResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.CreateArchiveRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.CreateArchiveResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.CreateConnectionRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.CreateConnectionResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.CreateEventBusRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.CreateEventBusResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.CreatePartnerEventSourceRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.CreatePartnerEventSourceResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DeactivateEventSourceRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DeactivateEventSourceResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DeauthorizeConnectionRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DeauthorizeConnectionResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DeleteApiDestinationRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DeleteApiDestinationResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DeleteArchiveRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DeleteArchiveResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DeleteConnectionRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DeleteConnectionResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DeleteEventBusRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DeleteEventBusResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DeletePartnerEventSourceRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DeletePartnerEventSourceResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DeleteRuleRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DeleteRuleResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DescribeApiDestinationRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DescribeApiDestinationResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DescribeArchiveRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DescribeArchiveResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DescribeConnectionRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DescribeConnectionResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DescribeEventBusRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DescribeEventBusResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DescribeEventSourceRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DescribeEventSourceResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DescribePartnerEventSourceRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DescribePartnerEventSourceResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DescribeReplayRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DescribeReplayResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DescribeRuleRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DescribeRuleResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.DisableRuleRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.DisableRuleResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.EnableRuleRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.EnableRuleResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.IllegalStatusException;
import software.amazon.awssdk.services.cloudwatchevents.model.InternalException;
import software.amazon.awssdk.services.cloudwatchevents.model.InvalidEventPatternException;
import software.amazon.awssdk.services.cloudwatchevents.model.InvalidStateException;
import software.amazon.awssdk.services.cloudwatchevents.model.LimitExceededException;
import software.amazon.awssdk.services.cloudwatchevents.model.ListApiDestinationsRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.ListApiDestinationsResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.ListArchivesRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.ListArchivesResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.ListConnectionsRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.ListConnectionsResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.ListEventBusesRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.ListEventBusesResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.ListEventSourcesRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.ListEventSourcesResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.ListPartnerEventSourceAccountsRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.ListPartnerEventSourceAccountsResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.ListPartnerEventSourcesRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.ListPartnerEventSourcesResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.ListReplaysRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.ListReplaysResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.ListRuleNamesByTargetRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.ListRuleNamesByTargetResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.ListRulesRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.ListRulesResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.ListTargetsByRuleRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.ListTargetsByRuleResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.ManagedRuleException;
import software.amazon.awssdk.services.cloudwatchevents.model.OperationDisabledException;
import software.amazon.awssdk.services.cloudwatchevents.model.PolicyLengthExceededException;
import software.amazon.awssdk.services.cloudwatchevents.model.PutEventsRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.PutEventsResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.PutPartnerEventsRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.PutPartnerEventsResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.PutPermissionRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.PutPermissionResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.PutRuleRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.PutRuleResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.PutTargetsRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.PutTargetsResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.RemovePermissionRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.RemovePermissionResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.RemoveTargetsRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.RemoveTargetsResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.ResourceAlreadyExistsException;
import software.amazon.awssdk.services.cloudwatchevents.model.ResourceNotFoundException;
import software.amazon.awssdk.services.cloudwatchevents.model.StartReplayRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.StartReplayResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.TagResourceRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.TagResourceResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.TestEventPatternRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.TestEventPatternResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.UntagResourceRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.UntagResourceResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.UpdateApiDestinationRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.UpdateApiDestinationResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.UpdateArchiveRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.UpdateArchiveResponse;
import software.amazon.awssdk.services.cloudwatchevents.model.UpdateConnectionRequest;
import software.amazon.awssdk.services.cloudwatchevents.model.UpdateConnectionResponse;
import software.amazon.awssdk.services.cloudwatchevents.transform.ActivateEventSourceRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.CancelReplayRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.CreateApiDestinationRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.CreateArchiveRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.CreateConnectionRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.CreateEventBusRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.CreatePartnerEventSourceRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DeactivateEventSourceRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DeauthorizeConnectionRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DeleteApiDestinationRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DeleteArchiveRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DeleteConnectionRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DeleteEventBusRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DeletePartnerEventSourceRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DeleteRuleRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DescribeApiDestinationRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DescribeArchiveRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DescribeConnectionRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DescribeEventBusRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DescribeEventSourceRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DescribePartnerEventSourceRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DescribeReplayRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DescribeRuleRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.DisableRuleRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.EnableRuleRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.ListApiDestinationsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.ListArchivesRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.ListConnectionsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.ListEventBusesRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.ListEventSourcesRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.ListPartnerEventSourceAccountsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.ListPartnerEventSourcesRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.ListReplaysRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.ListRuleNamesByTargetRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.ListRulesRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.ListTargetsByRuleRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.PutEventsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.PutPartnerEventsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.PutPermissionRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.PutRuleRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.PutTargetsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.RemovePermissionRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.RemoveTargetsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.StartReplayRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.TestEventPatternRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.UpdateApiDestinationRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.UpdateArchiveRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchevents.transform.UpdateConnectionRequestMarshaller;
import software.amazon.awssdk.utils.Logger;
/**
* Internal implementation of {@link CloudWatchEventsClient}.
*
* @see CloudWatchEventsClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultCloudWatchEventsClient implements CloudWatchEventsClient {
private static final Logger log = Logger.loggerFor(DefaultCloudWatchEventsClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
.serviceProtocol(AwsServiceProtocol.AWS_JSON).build();
private final SyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultCloudWatchEventsClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
/**
*
* Activates a partner event source that has been deactivated. Once activated, your matching event bus will start
* receiving events from the event source.
*
*
* @param activateEventSourceRequest
* @return Result of the ActivateEventSource operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws InvalidStateException
* The specified state is not a valid state for an event source.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws OperationDisabledException
* The operation you are attempting is not available in this region.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.ActivateEventSource
* @see AWS
* API Documentation
*/
@Override
public ActivateEventSourceResponse activateEventSource(ActivateEventSourceRequest activateEventSourceRequest)
throws ResourceNotFoundException, ConcurrentModificationException, InvalidStateException, InternalException,
OperationDisabledException, AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ActivateEventSourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(activateEventSourceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, activateEventSourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ActivateEventSource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ActivateEventSource").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(activateEventSourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ActivateEventSourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Cancels the specified replay.
*
*
* @param cancelReplayRequest
* @return Result of the CancelReplay operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws IllegalStatusException
* An error occurred because a replay can be canceled only when the state is Running or Starting.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.CancelReplay
* @see AWS API
* Documentation
*/
@Override
public CancelReplayResponse cancelReplay(CancelReplayRequest cancelReplayRequest) throws ResourceNotFoundException,
ConcurrentModificationException, IllegalStatusException, InternalException, AwsServiceException, SdkClientException,
CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CancelReplayResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(cancelReplayRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, cancelReplayRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CancelReplay");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CancelReplay").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(cancelReplayRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CancelReplayRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates an API destination, which is an HTTP invocation endpoint configured as a target for events.
*
*
* @param createApiDestinationRequest
* @return Result of the CreateApiDestination operation returned by the service.
* @throws ResourceAlreadyExistsException
* The resource you are trying to create already exists.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws LimitExceededException
* The request failed because it attempted to create resource beyond the allowed service quota.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.CreateApiDestination
* @see AWS
* API Documentation
*/
@Override
public CreateApiDestinationResponse createApiDestination(CreateApiDestinationRequest createApiDestinationRequest)
throws ResourceAlreadyExistsException, ResourceNotFoundException, LimitExceededException, InternalException,
AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateApiDestinationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createApiDestinationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createApiDestinationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateApiDestination");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateApiDestination").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createApiDestinationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateApiDestinationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates an archive of events with the specified settings. When you create an archive, incoming events might not
* immediately start being sent to the archive. Allow a short period of time for changes to take effect. If you do
* not specify a pattern to filter events sent to the archive, all events are sent to the archive except replayed
* events. Replayed events are not sent to an archive.
*
*
* @param createArchiveRequest
* @return Result of the CreateArchive operation returned by the service.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws ResourceAlreadyExistsException
* The resource you are trying to create already exists.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws LimitExceededException
* The request failed because it attempted to create resource beyond the allowed service quota.
* @throws InvalidEventPatternException
* The event pattern is not valid.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.CreateArchive
* @see AWS API
* Documentation
*/
@Override
public CreateArchiveResponse createArchive(CreateArchiveRequest createArchiveRequest) throws ConcurrentModificationException,
ResourceAlreadyExistsException, ResourceNotFoundException, InternalException, LimitExceededException,
InvalidEventPatternException, AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateArchiveResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createArchiveRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createArchiveRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateArchive");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateArchive").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createArchiveRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateArchiveRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a connection. A connection defines the authorization type and credentials to use for authorization with
* an API destination HTTP endpoint.
*
*
* @param createConnectionRequest
* @return Result of the CreateConnection operation returned by the service.
* @throws ResourceAlreadyExistsException
* The resource you are trying to create already exists.
* @throws LimitExceededException
* The request failed because it attempted to create resource beyond the allowed service quota.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.CreateConnection
* @see AWS API
* Documentation
*/
@Override
public CreateConnectionResponse createConnection(CreateConnectionRequest createConnectionRequest)
throws ResourceAlreadyExistsException, LimitExceededException, InternalException, AwsServiceException,
SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateConnectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createConnectionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createConnectionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateConnection");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateConnection").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createConnectionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateConnectionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a new event bus within your account. This can be a custom event bus which you can use to receive events
* from your custom applications and services, or it can be a partner event bus which can be matched to a partner
* event source.
*
*
* @param createEventBusRequest
* @return Result of the CreateEventBus operation returned by the service.
* @throws ResourceAlreadyExistsException
* The resource you are trying to create already exists.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InvalidStateException
* The specified state is not a valid state for an event source.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws LimitExceededException
* The request failed because it attempted to create resource beyond the allowed service quota.
* @throws OperationDisabledException
* The operation you are attempting is not available in this region.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.CreateEventBus
* @see AWS API
* Documentation
*/
@Override
public CreateEventBusResponse createEventBus(CreateEventBusRequest createEventBusRequest)
throws ResourceAlreadyExistsException, ResourceNotFoundException, InvalidStateException, InternalException,
ConcurrentModificationException, LimitExceededException, OperationDisabledException, AwsServiceException,
SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateEventBusResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createEventBusRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createEventBusRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateEventBus");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateEventBus").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createEventBusRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateEventBusRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Called by an SaaS partner to create a partner event source. This operation is not used by Amazon Web Services
* customers.
*
*
* Each partner event source can be used by one Amazon Web Services account to create a matching partner event bus
* in that Amazon Web Services account. A SaaS partner must create one partner event source for each Amazon Web
* Services account that wants to receive those event types.
*
*
* A partner event source creates events based on resources within the SaaS partner's service or application.
*
*
* An Amazon Web Services account that creates a partner event bus that matches the partner event source can use
* that event bus to receive events from the partner, and then process them using Amazon Web Services Events rules
* and targets.
*
*
* Partner event source names follow this format:
*
*
* partner_name/event_namespace/event_name
*
*
* partner_name is determined during partner registration and identifies the partner to Amazon Web Services
* customers. event_namespace is determined by the partner and is a way for the partner to categorize their
* events. event_name is determined by the partner, and should uniquely identify an event-generating resource
* within the partner system. The combination of event_namespace and event_name should help Amazon Web
* Services customers decide whether to create an event bus to receive these events.
*
*
* @param createPartnerEventSourceRequest
* @return Result of the CreatePartnerEventSource operation returned by the service.
* @throws ResourceAlreadyExistsException
* The resource you are trying to create already exists.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws LimitExceededException
* The request failed because it attempted to create resource beyond the allowed service quota.
* @throws OperationDisabledException
* The operation you are attempting is not available in this region.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.CreatePartnerEventSource
* @see AWS API Documentation
*/
@Override
public CreatePartnerEventSourceResponse createPartnerEventSource(
CreatePartnerEventSourceRequest createPartnerEventSourceRequest) throws ResourceAlreadyExistsException,
InternalException, ConcurrentModificationException, LimitExceededException, OperationDisabledException,
AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreatePartnerEventSourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createPartnerEventSourceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createPartnerEventSourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreatePartnerEventSource");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreatePartnerEventSource").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createPartnerEventSourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreatePartnerEventSourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* You can use this operation to temporarily stop receiving events from the specified partner event source. The
* matching event bus is not deleted.
*
*
* When you deactivate a partner event source, the source goes into PENDING state. If it remains in PENDING state
* for more than two weeks, it is deleted.
*
*
* To activate a deactivated partner event source, use ActivateEventSource.
*
*
* @param deactivateEventSourceRequest
* @return Result of the DeactivateEventSource operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws InvalidStateException
* The specified state is not a valid state for an event source.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws OperationDisabledException
* The operation you are attempting is not available in this region.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DeactivateEventSource
* @see AWS
* API Documentation
*/
@Override
public DeactivateEventSourceResponse deactivateEventSource(DeactivateEventSourceRequest deactivateEventSourceRequest)
throws ResourceNotFoundException, ConcurrentModificationException, InvalidStateException, InternalException,
OperationDisabledException, AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeactivateEventSourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deactivateEventSourceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deactivateEventSourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeactivateEventSource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeactivateEventSource").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deactivateEventSourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeactivateEventSourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Removes all authorization parameters from the connection. This lets you remove the secret from the connection so
* you can reuse it without having to create a new connection.
*
*
* @param deauthorizeConnectionRequest
* @return Result of the DeauthorizeConnection operation returned by the service.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DeauthorizeConnection
* @see AWS
* API Documentation
*/
@Override
public DeauthorizeConnectionResponse deauthorizeConnection(DeauthorizeConnectionRequest deauthorizeConnectionRequest)
throws ConcurrentModificationException, ResourceNotFoundException, InternalException, AwsServiceException,
SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeauthorizeConnectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deauthorizeConnectionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deauthorizeConnectionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeauthorizeConnection");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeauthorizeConnection").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deauthorizeConnectionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeauthorizeConnectionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes the specified API destination.
*
*
* @param deleteApiDestinationRequest
* @return Result of the DeleteApiDestination operation returned by the service.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DeleteApiDestination
* @see AWS
* API Documentation
*/
@Override
public DeleteApiDestinationResponse deleteApiDestination(DeleteApiDestinationRequest deleteApiDestinationRequest)
throws ConcurrentModificationException, ResourceNotFoundException, InternalException, AwsServiceException,
SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteApiDestinationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteApiDestinationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteApiDestinationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteApiDestination");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteApiDestination").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteApiDestinationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteApiDestinationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes the specified archive.
*
*
* @param deleteArchiveRequest
* @return Result of the DeleteArchive operation returned by the service.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DeleteArchive
* @see AWS API
* Documentation
*/
@Override
public DeleteArchiveResponse deleteArchive(DeleteArchiveRequest deleteArchiveRequest) throws ConcurrentModificationException,
ResourceNotFoundException, InternalException, AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteArchiveResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteArchiveRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteArchiveRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteArchive");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteArchive").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteArchiveRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteArchiveRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes a connection.
*
*
* @param deleteConnectionRequest
* @return Result of the DeleteConnection operation returned by the service.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DeleteConnection
* @see AWS API
* Documentation
*/
@Override
public DeleteConnectionResponse deleteConnection(DeleteConnectionRequest deleteConnectionRequest)
throws ConcurrentModificationException, ResourceNotFoundException, InternalException, AwsServiceException,
SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteConnectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteConnectionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteConnectionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteConnection");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteConnection").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteConnectionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteConnectionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes the specified custom event bus or partner event bus. All rules associated with this event bus need to be
* deleted. You can't delete your account's default event bus.
*
*
* @param deleteEventBusRequest
* @return Result of the DeleteEventBus operation returned by the service.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DeleteEventBus
* @see AWS API
* Documentation
*/
@Override
public DeleteEventBusResponse deleteEventBus(DeleteEventBusRequest deleteEventBusRequest) throws InternalException,
ConcurrentModificationException, AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteEventBusResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteEventBusRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteEventBusRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteEventBus");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteEventBus").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteEventBusRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteEventBusRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* This operation is used by SaaS partners to delete a partner event source. This operation is not used by Amazon
* Web Services customers.
*
*
* When you delete an event source, the status of the corresponding partner event bus in the Amazon Web Services
* customer account becomes DELETED.
*
*
*
* @param deletePartnerEventSourceRequest
* @return Result of the DeletePartnerEventSource operation returned by the service.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws OperationDisabledException
* The operation you are attempting is not available in this region.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DeletePartnerEventSource
* @see AWS API Documentation
*/
@Override
public DeletePartnerEventSourceResponse deletePartnerEventSource(
DeletePartnerEventSourceRequest deletePartnerEventSourceRequest) throws InternalException,
ConcurrentModificationException, OperationDisabledException, AwsServiceException, SdkClientException,
CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeletePartnerEventSourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deletePartnerEventSourceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deletePartnerEventSourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeletePartnerEventSource");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeletePartnerEventSource").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deletePartnerEventSourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeletePartnerEventSourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes the specified rule.
*
*
* Before you can delete the rule, you must remove all targets, using RemoveTargets.
*
*
* When you delete a rule, incoming events might continue to match to the deleted rule. Allow a short period of time
* for changes to take effect.
*
*
* If you call delete rule multiple times for the same rule, all calls will succeed. When you call delete rule for a
* non-existent custom eventbus, ResourceNotFoundException
is returned.
*
*
* Managed rules are rules created and managed by another Amazon Web Services service on your behalf. These rules
* are created by those other Amazon Web Services services to support functionality in those services. You can
* delete these rules using the Force
option, but you should do so only if you are sure the other
* service is not still using that rule.
*
*
* @param deleteRuleRequest
* @return Result of the DeleteRule operation returned by the service.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws ManagedRuleException
* This rule was created by an Amazon Web Services service on behalf of your account. It is managed by that
* service. If you see this error in response to DeleteRule
or RemoveTargets
, you
* can use the Force
parameter in those calls to delete the rule or remove targets from the
* rule. You cannot modify these managed rules by using DisableRule
, EnableRule
,
* PutTargets
, PutRule
, TagResource
, or UntagResource
.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DeleteRule
* @see AWS API
* Documentation
*/
@Override
public DeleteRuleResponse deleteRule(DeleteRuleRequest deleteRuleRequest) throws ConcurrentModificationException,
ManagedRuleException, InternalException, ResourceNotFoundException, AwsServiceException, SdkClientException,
CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteRuleRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteRuleRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteRule");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteRule").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(deleteRuleRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteRuleRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Retrieves details about an API destination.
*
*
* @param describeApiDestinationRequest
* @return Result of the DescribeApiDestination operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DescribeApiDestination
* @see AWS
* API Documentation
*/
@Override
public DescribeApiDestinationResponse describeApiDestination(DescribeApiDestinationRequest describeApiDestinationRequest)
throws ResourceNotFoundException, InternalException, AwsServiceException, SdkClientException,
CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeApiDestinationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeApiDestinationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeApiDestinationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeApiDestination");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeApiDestination").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(describeApiDestinationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeApiDestinationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Retrieves details about an archive.
*
*
* @param describeArchiveRequest
* @return Result of the DescribeArchive operation returned by the service.
* @throws ResourceAlreadyExistsException
* The resource you are trying to create already exists.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DescribeArchive
* @see AWS API
* Documentation
*/
@Override
public DescribeArchiveResponse describeArchive(DescribeArchiveRequest describeArchiveRequest)
throws ResourceAlreadyExistsException, ResourceNotFoundException, InternalException, AwsServiceException,
SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DescribeArchiveResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeArchiveRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeArchiveRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeArchive");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeArchive").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(describeArchiveRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeArchiveRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Retrieves details about a connection.
*
*
* @param describeConnectionRequest
* @return Result of the DescribeConnection operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DescribeConnection
* @see AWS API
* Documentation
*/
@Override
public DescribeConnectionResponse describeConnection(DescribeConnectionRequest describeConnectionRequest)
throws ResourceNotFoundException, InternalException, AwsServiceException, SdkClientException,
CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeConnectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeConnectionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeConnectionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeConnection");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeConnection").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(describeConnectionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeConnectionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Displays details about an event bus in your account. This can include the external Amazon Web Services accounts
* that are permitted to write events to your default event bus, and the associated policy. For custom event buses
* and partner event buses, it displays the name, ARN, policy, state, and creation time.
*
*
* To enable your account to receive events from other accounts on its default event bus, use PutPermission.
*
*
* For more information about partner event buses, see CreateEventBus.
*
*
* @param describeEventBusRequest
* @return Result of the DescribeEventBus operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DescribeEventBus
* @see AWS API
* Documentation
*/
@Override
public DescribeEventBusResponse describeEventBus(DescribeEventBusRequest describeEventBusRequest)
throws ResourceNotFoundException, InternalException, AwsServiceException, SdkClientException,
CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DescribeEventBusResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeEventBusRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeEventBusRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeEventBus");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeEventBus").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(describeEventBusRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeEventBusRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* This operation lists details about a partner event source that is shared with your account.
*
*
* @param describeEventSourceRequest
* @return Result of the DescribeEventSource operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws OperationDisabledException
* The operation you are attempting is not available in this region.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DescribeEventSource
* @see AWS
* API Documentation
*/
@Override
public DescribeEventSourceResponse describeEventSource(DescribeEventSourceRequest describeEventSourceRequest)
throws ResourceNotFoundException, InternalException, OperationDisabledException, AwsServiceException,
SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeEventSourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeEventSourceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeEventSourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeEventSource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeEventSource").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(describeEventSourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeEventSourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* An SaaS partner can use this operation to list details about a partner event source that they have created.
* Amazon Web Services customers do not use this operation. Instead, Amazon Web Services customers can use DescribeEventSource to see details about a partner event source that is shared with them.
*
*
* @param describePartnerEventSourceRequest
* @return Result of the DescribePartnerEventSource operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws OperationDisabledException
* The operation you are attempting is not available in this region.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DescribePartnerEventSource
* @see AWS API Documentation
*/
@Override
public DescribePartnerEventSourceResponse describePartnerEventSource(
DescribePartnerEventSourceRequest describePartnerEventSourceRequest) throws ResourceNotFoundException,
InternalException, OperationDisabledException, AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribePartnerEventSourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describePartnerEventSourceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describePartnerEventSourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribePartnerEventSource");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribePartnerEventSource").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(describePartnerEventSourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribePartnerEventSourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Retrieves details about a replay. Use DescribeReplay
to determine the progress of a running replay.
* A replay processes events to replay based on the time in the event, and replays them using 1 minute intervals. If
* you use StartReplay
and specify an EventStartTime
and an EventEndTime
that
* covers a 20 minute time range, the events are replayed from the first minute of that 20 minute range first. Then
* the events from the second minute are replayed. You can use DescribeReplay
to determine the progress
* of a replay. The value returned for EventLastReplayedTime
indicates the time within the specified
* time range associated with the last event replayed.
*
*
* @param describeReplayRequest
* @return Result of the DescribeReplay operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DescribeReplay
* @see AWS API
* Documentation
*/
@Override
public DescribeReplayResponse describeReplay(DescribeReplayRequest describeReplayRequest) throws ResourceNotFoundException,
InternalException, AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DescribeReplayResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeReplayRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeReplayRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeReplay");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeReplay").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(describeReplayRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeReplayRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Describes the specified rule.
*
*
* DescribeRule does not list the targets of a rule. To see the targets associated with a rule, use ListTargetsByRule.
*
*
* @param describeRuleRequest
* @return Result of the DescribeRule operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DescribeRule
* @see AWS API
* Documentation
*/
@Override
public DescribeRuleResponse describeRule(DescribeRuleRequest describeRuleRequest) throws ResourceNotFoundException,
InternalException, AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DescribeRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeRuleRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeRuleRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeRule");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeRule").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(describeRuleRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeRuleRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Disables the specified rule. A disabled rule won't match any events, and won't self-trigger if it has a schedule
* expression.
*
*
* When you disable a rule, incoming events might continue to match to the disabled rule. Allow a short period of
* time for changes to take effect.
*
*
* @param disableRuleRequest
* @return Result of the DisableRule operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws ManagedRuleException
* This rule was created by an Amazon Web Services service on behalf of your account. It is managed by that
* service. If you see this error in response to DeleteRule
or RemoveTargets
, you
* can use the Force
parameter in those calls to delete the rule or remove targets from the
* rule. You cannot modify these managed rules by using DisableRule
, EnableRule
,
* PutTargets
, PutRule
, TagResource
, or UntagResource
.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.DisableRule
* @see AWS API
* Documentation
*/
@Override
public DisableRuleResponse disableRule(DisableRuleRequest disableRuleRequest) throws ResourceNotFoundException,
ConcurrentModificationException, ManagedRuleException, InternalException, AwsServiceException, SdkClientException,
CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DisableRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(disableRuleRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, disableRuleRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisableRule");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DisableRule").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(disableRuleRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DisableRuleRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Enables the specified rule. If the rule does not exist, the operation fails.
*
*
* When you enable a rule, incoming events might not immediately start matching to a newly enabled rule. Allow a
* short period of time for changes to take effect.
*
*
* @param enableRuleRequest
* @return Result of the EnableRule operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws ManagedRuleException
* This rule was created by an Amazon Web Services service on behalf of your account. It is managed by that
* service. If you see this error in response to DeleteRule
or RemoveTargets
, you
* can use the Force
parameter in those calls to delete the rule or remove targets from the
* rule. You cannot modify these managed rules by using DisableRule
, EnableRule
,
* PutTargets
, PutRule
, TagResource
, or UntagResource
.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.EnableRule
* @see AWS API
* Documentation
*/
@Override
public EnableRuleResponse enableRule(EnableRuleRequest enableRuleRequest) throws ResourceNotFoundException,
ConcurrentModificationException, ManagedRuleException, InternalException, AwsServiceException, SdkClientException,
CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
EnableRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(enableRuleRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, enableRuleRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EnableRule");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("EnableRule").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(enableRuleRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new EnableRuleRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Retrieves a list of API destination in the account in the current Region.
*
*
* @param listApiDestinationsRequest
* @return Result of the ListApiDestinations operation returned by the service.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.ListApiDestinations
* @see AWS
* API Documentation
*/
@Override
public ListApiDestinationsResponse listApiDestinations(ListApiDestinationsRequest listApiDestinationsRequest)
throws InternalException, AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListApiDestinationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listApiDestinationsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listApiDestinationsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListApiDestinations");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListApiDestinations").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listApiDestinationsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListApiDestinationsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists your archives. You can either list all the archives or you can provide a prefix to match to the archive
* names. Filter parameters are exclusive.
*
*
* @param listArchivesRequest
* @return Result of the ListArchives operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.ListArchives
* @see AWS API
* Documentation
*/
@Override
public ListArchivesResponse listArchives(ListArchivesRequest listArchivesRequest) throws ResourceNotFoundException,
InternalException, AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListArchivesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listArchivesRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listArchivesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListArchives");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListArchives").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listArchivesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListArchivesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Retrieves a list of connections from the account.
*
*
* @param listConnectionsRequest
* @return Result of the ListConnections operation returned by the service.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.ListConnections
* @see AWS API
* Documentation
*/
@Override
public ListConnectionsResponse listConnections(ListConnectionsRequest listConnectionsRequest) throws InternalException,
AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListConnectionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listConnectionsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listConnectionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListConnections");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListConnections").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listConnectionsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListConnectionsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists all the event buses in your account, including the default event bus, custom event buses, and partner event
* buses.
*
*
* @param listEventBusesRequest
* @return Result of the ListEventBuses operation returned by the service.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.ListEventBuses
* @see AWS API
* Documentation
*/
@Override
public ListEventBusesResponse listEventBuses(ListEventBusesRequest listEventBusesRequest) throws InternalException,
AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListEventBusesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listEventBusesRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listEventBusesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListEventBuses");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListEventBuses").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listEventBusesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListEventBusesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* You can use this to see all the partner event sources that have been shared with your Amazon Web Services
* account. For more information about partner event sources, see CreateEventBus.
*
*
* @param listEventSourcesRequest
* @return Result of the ListEventSources operation returned by the service.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws OperationDisabledException
* The operation you are attempting is not available in this region.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.ListEventSources
* @see AWS API
* Documentation
*/
@Override
public ListEventSourcesResponse listEventSources(ListEventSourcesRequest listEventSourcesRequest) throws InternalException,
OperationDisabledException, AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListEventSourcesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listEventSourcesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listEventSourcesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListEventSources");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListEventSources").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listEventSourcesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListEventSourcesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* An SaaS partner can use this operation to display the Amazon Web Services account ID that a particular partner
* event source name is associated with. This operation is not used by Amazon Web Services customers.
*
*
* @param listPartnerEventSourceAccountsRequest
* @return Result of the ListPartnerEventSourceAccounts operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws OperationDisabledException
* The operation you are attempting is not available in this region.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.ListPartnerEventSourceAccounts
* @see AWS API Documentation
*/
@Override
public ListPartnerEventSourceAccountsResponse listPartnerEventSourceAccounts(
ListPartnerEventSourceAccountsRequest listPartnerEventSourceAccountsRequest) throws ResourceNotFoundException,
InternalException, OperationDisabledException, AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListPartnerEventSourceAccountsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listPartnerEventSourceAccountsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
listPartnerEventSourceAccountsRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListPartnerEventSourceAccounts");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListPartnerEventSourceAccounts").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listPartnerEventSourceAccountsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListPartnerEventSourceAccountsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* An SaaS partner can use this operation to list all the partner event source names that they have created. This
* operation is not used by Amazon Web Services customers.
*
*
* @param listPartnerEventSourcesRequest
* @return Result of the ListPartnerEventSources operation returned by the service.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws OperationDisabledException
* The operation you are attempting is not available in this region.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.ListPartnerEventSources
* @see AWS API Documentation
*/
@Override
public ListPartnerEventSourcesResponse listPartnerEventSources(ListPartnerEventSourcesRequest listPartnerEventSourcesRequest)
throws InternalException, OperationDisabledException, AwsServiceException, SdkClientException,
CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListPartnerEventSourcesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listPartnerEventSourcesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listPartnerEventSourcesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListPartnerEventSources");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListPartnerEventSources").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listPartnerEventSourcesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListPartnerEventSourcesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists your replays. You can either list all the replays or you can provide a prefix to match to the replay names.
* Filter parameters are exclusive.
*
*
* @param listReplaysRequest
* @return Result of the ListReplays operation returned by the service.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.ListReplays
* @see AWS API
* Documentation
*/
@Override
public ListReplaysResponse listReplays(ListReplaysRequest listReplaysRequest) throws InternalException, AwsServiceException,
SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListReplaysResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listReplaysRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listReplaysRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListReplays");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListReplays").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(listReplaysRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListReplaysRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists the rules for the specified target. You can see which of the rules in Amazon EventBridge can invoke a
* specific target in your account.
*
*
* @param listRuleNamesByTargetRequest
* @return Result of the ListRuleNamesByTarget operation returned by the service.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.ListRuleNamesByTarget
* @see AWS
* API Documentation
*/
@Override
public ListRuleNamesByTargetResponse listRuleNamesByTarget(ListRuleNamesByTargetRequest listRuleNamesByTargetRequest)
throws InternalException, ResourceNotFoundException, AwsServiceException, SdkClientException,
CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListRuleNamesByTargetResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listRuleNamesByTargetRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listRuleNamesByTargetRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListRuleNamesByTarget");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListRuleNamesByTarget").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listRuleNamesByTargetRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListRuleNamesByTargetRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists your Amazon EventBridge rules. You can either list all the rules or you can provide a prefix to match to
* the rule names.
*
*
* ListRules does not list the targets of a rule. To see the targets associated with a rule, use ListTargetsByRule.
*
*
* @param listRulesRequest
* @return Result of the ListRules operation returned by the service.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.ListRules
* @see AWS API
* Documentation
*/
@Override
public ListRulesResponse listRules(ListRulesRequest listRulesRequest) throws InternalException, ResourceNotFoundException,
AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListRulesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listRulesRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listRulesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListRules");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListRules").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(listRulesRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListRulesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Displays the tags associated with an EventBridge resource. In EventBridge, rules and event buses can be tagged.
*
*
* @param listTagsForResourceRequest
* @return Result of the ListTagsForResource operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.ListTagsForResource
* @see AWS
* API Documentation
*/
@Override
public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest)
throws ResourceNotFoundException, InternalException, AwsServiceException, SdkClientException,
CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListTagsForResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTagsForResourceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListTagsForResource").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listTagsForResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists the targets assigned to the specified rule.
*
*
* @param listTargetsByRuleRequest
* @return Result of the ListTargetsByRule operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.ListTargetsByRule
* @see AWS API
* Documentation
*/
@Override
public ListTargetsByRuleResponse listTargetsByRule(ListTargetsByRuleRequest listTargetsByRuleRequest)
throws ResourceNotFoundException, InternalException, AwsServiceException, SdkClientException,
CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListTargetsByRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTargetsByRuleRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listTargetsByRuleRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTargetsByRule");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListTargetsByRule").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listTargetsByRuleRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListTargetsByRuleRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Sends custom events to Amazon EventBridge so that they can be matched to rules.
*
*
* @param putEventsRequest
* @return Result of the PutEvents operation returned by the service.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.PutEvents
* @see AWS API
* Documentation
*/
@Override
public PutEventsResponse putEvents(PutEventsRequest putEventsRequest) throws InternalException, AwsServiceException,
SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
PutEventsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putEventsRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, putEventsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutEvents");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("PutEvents").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(putEventsRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new PutEventsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* This is used by SaaS partners to write events to a customer's partner event bus. Amazon Web Services customers do
* not use this operation.
*
*
* @param putPartnerEventsRequest
* @return Result of the PutPartnerEvents operation returned by the service.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws OperationDisabledException
* The operation you are attempting is not available in this region.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.PutPartnerEvents
* @see AWS API
* Documentation
*/
@Override
public PutPartnerEventsResponse putPartnerEvents(PutPartnerEventsRequest putPartnerEventsRequest) throws InternalException,
OperationDisabledException, AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
PutPartnerEventsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putPartnerEventsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, putPartnerEventsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutPartnerEvents");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("PutPartnerEvents").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(putPartnerEventsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new PutPartnerEventsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Running PutPermission
permits the specified Amazon Web Services account or Amazon Web Services
* organization to put events to the specified event bus. Amazon EventBridge (CloudWatch Events) rules in
* your account are triggered by these events arriving to an event bus in your account.
*
*
* For another account to send events to your account, that external account must have an EventBridge rule with your
* account's event bus as a target.
*
*
* To enable multiple Amazon Web Services accounts to put events to your event bus, run PutPermission
* once for each of these accounts. Or, if all the accounts are members of the same Amazon Web Services
* organization, you can run PutPermission
once specifying Principal
as "*" and specifying
* the Amazon Web Services organization ID in Condition
, to grant permissions to all accounts in that
* organization.
*
*
* If you grant permissions using an organization, then accounts in that organization must specify a
* RoleArn
with proper permissions when they use PutTarget
to add your account's event bus
* as a target. For more information, see Sending and Receiving Events Between Amazon Web Services Accounts in the Amazon EventBridge User
* Guide.
*
*
* The permission policy on the event bus cannot exceed 10 KB in size.
*
*
* @param putPermissionRequest
* @return Result of the PutPermission operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws PolicyLengthExceededException
* The event bus policy is too long. For more information, see the limits.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws OperationDisabledException
* The operation you are attempting is not available in this region.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.PutPermission
* @see AWS API
* Documentation
*/
@Override
public PutPermissionResponse putPermission(PutPermissionRequest putPermissionRequest) throws ResourceNotFoundException,
PolicyLengthExceededException, InternalException, ConcurrentModificationException, OperationDisabledException,
AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
PutPermissionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putPermissionRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, putPermissionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutPermission");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("PutPermission").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(putPermissionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new PutPermissionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates or updates the specified rule. Rules are enabled by default, or based on value of the state. You can
* disable a rule using DisableRule.
*
*
* A single rule watches for events from a single event bus. Events generated by Amazon Web Services services go to
* your account's default event bus. Events generated by SaaS partner services or applications go to the matching
* partner event bus. If you have custom applications or services, you can specify whether their events go to your
* default event bus or a custom event bus that you have created. For more information, see CreateEventBus.
*
*
* If you are updating an existing rule, the rule is replaced with what you specify in this PutRule
* command. If you omit arguments in PutRule
, the old values for those arguments are not kept. Instead,
* they are replaced with null values.
*
*
* When you create or update a rule, incoming events might not immediately start matching to new or updated rules.
* Allow a short period of time for changes to take effect.
*
*
* A rule must contain at least an EventPattern or ScheduleExpression. Rules with EventPatterns are triggered when a
* matching event is observed. Rules with ScheduleExpressions self-trigger based on the given schedule. A rule can
* have both an EventPattern and a ScheduleExpression, in which case the rule triggers on matching events as well as
* on a schedule.
*
*
* When you initially create a rule, you can optionally assign one or more tags to the rule. Tags can help you
* organize and categorize your resources. You can also use them to scope user permissions, by granting a user
* permission to access or change only rules with certain tag values. To use the PutRule
operation and
* assign tags, you must have both the events:PutRule
and events:TagResource
permissions.
*
*
* If you are updating an existing rule, any tags you specify in the PutRule
operation are ignored. To
* update the tags of an existing rule, use TagResource and UntagResource.
*
*
* Most services in Amazon Web Services treat : or / as the same character in Amazon Resource Names (ARNs). However,
* EventBridge uses an exact match in event patterns and rules. Be sure to use the correct ARN characters when
* creating event patterns so that they match the ARN syntax in the event you want to match.
*
*
* In EventBridge, it is possible to create rules that lead to infinite loops, where a rule is fired repeatedly. For
* example, a rule might detect that ACLs have changed on an S3 bucket, and trigger software to change them to the
* desired state. If the rule is not written carefully, the subsequent change to the ACLs fires the rule again,
* creating an infinite loop.
*
*
* To prevent this, write the rules so that the triggered actions do not re-fire the same rule. For example, your
* rule could fire only if ACLs are found to be in a bad state, instead of after any change.
*
*
* An infinite loop can quickly cause higher than expected charges. We recommend that you use budgeting, which
* alerts you when charges exceed your specified limit. For more information, see Managing Your
* Costs with Budgets.
*
*
* @param putRuleRequest
* @return Result of the PutRule operation returned by the service.
* @throws InvalidEventPatternException
* The event pattern is not valid.
* @throws LimitExceededException
* The request failed because it attempted to create resource beyond the allowed service quota.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws ManagedRuleException
* This rule was created by an Amazon Web Services service on behalf of your account. It is managed by that
* service. If you see this error in response to DeleteRule
or RemoveTargets
, you
* can use the Force
parameter in those calls to delete the rule or remove targets from the
* rule. You cannot modify these managed rules by using DisableRule
, EnableRule
,
* PutTargets
, PutRule
, TagResource
, or UntagResource
.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.PutRule
* @see AWS API
* Documentation
*/
@Override
public PutRuleResponse putRule(PutRuleRequest putRuleRequest) throws InvalidEventPatternException, LimitExceededException,
ConcurrentModificationException, ManagedRuleException, InternalException, ResourceNotFoundException,
AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
PutRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putRuleRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, putRuleRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutRule");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("PutRule").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(putRuleRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new PutRuleRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Adds the specified targets to the specified rule, or updates the targets if they are already associated with the
* rule.
*
*
* Targets are the resources that are invoked when a rule is triggered.
*
*
* You can configure the following as targets for Events:
*
*
* -
*
* API destination
*
*
* -
*
* Amazon API Gateway REST API endpoints
*
*
* -
*
* API Gateway
*
*
* -
*
* Batch job queue
*
*
* -
*
* CloudWatch Logs group
*
*
* -
*
* CodeBuild project
*
*
* -
*
* CodePipeline
*
*
* -
*
* Amazon EC2 CreateSnapshot
API call
*
*
* -
*
* Amazon EC2 RebootInstances
API call
*
*
* -
*
* Amazon EC2 StopInstances
API call
*
*
* -
*
* Amazon EC2 TerminateInstances
API call
*
*
* -
*
* Amazon ECS tasks
*
*
* -
*
* Event bus in a different Amazon Web Services account or Region.
*
*
* You can use an event bus in the US East (N. Virginia) us-east-1, US West (Oregon) us-west-2, or Europe (Ireland)
* eu-west-1 Regions as a target for a rule.
*
*
* -
*
* Firehose delivery stream (Kinesis Data Firehose)
*
*
* -
*
* Inspector assessment template (Amazon Inspector)
*
*
* -
*
* Kinesis stream (Kinesis Data Stream)
*
*
* -
*
* Lambda function
*
*
* -
*
* Redshift clusters (Data API statement execution)
*
*
* -
*
* Amazon SNS topic
*
*
* -
*
* Amazon SQS queues (includes FIFO queues
*
*
* -
*
* SSM Automation
*
*
* -
*
* SSM OpsItem
*
*
* -
*
* SSM Run Command
*
*
* -
*
* Step Functions state machines
*
*
*
*
* Creating rules with built-in targets is supported only in the Amazon Web Services Management Console. The
* built-in targets are EC2 CreateSnapshot API call
, EC2 RebootInstances API call
,
* EC2 StopInstances API call
, and EC2 TerminateInstances API call
.
*
*
* For some target types, PutTargets
provides target-specific parameters. If the target is a Kinesis
* data stream, you can optionally specify which shard the event goes to by using the KinesisParameters
* argument. To invoke a command on multiple EC2 instances with one rule, you can use the
* RunCommandParameters
field.
*
*
* To be able to make API calls against the resources that you own, Amazon EventBridge needs the appropriate
* permissions. For Lambda and Amazon SNS resources, EventBridge relies on resource-based policies. For EC2
* instances, Kinesis Data Streams, Step Functions state machines and API Gateway REST APIs, EventBridge relies on
* IAM roles that you specify in the RoleARN
argument in PutTargets
. For more information,
* see
* Authentication and Access Control in the Amazon EventBridge User Guide.
*
*
* If another Amazon Web Services account is in the same region and has granted you permission (using
* PutPermission
), you can send events to that account. Set that account's event bus as a target of the
* rules in your account. To send the matched events to the other account, specify that account's event bus as the
* Arn
value when you run PutTargets
. If your account sends events to another account,
* your account is charged for each sent event. Each event sent to another account is charged as a custom event. The
* account receiving the event is not charged. For more information, see Amazon EventBridge Pricing.
*
*
*
* Input
, InputPath
, and InputTransformer
are not available with
* PutTarget
if the target is an event bus of a different Amazon Web Services account.
*
*
*
* If you are setting the event bus of another account as the target, and that account granted permission to your
* account through an organization instead of directly by the account ID, then you must specify a
* RoleArn
with proper permissions in the Target
structure. For more information, see
* Sending and Receiving Events Between Amazon Web Services Accounts in the Amazon EventBridge User
* Guide.
*
*
* For more information about enabling cross-account events, see PutPermission.
*
*
* Input, InputPath, and InputTransformer are mutually exclusive and optional parameters of a
* target. When a rule is triggered due to a matched event:
*
*
* -
*
* If none of the following arguments are specified for a target, then the entire event is passed to the target in
* JSON format (unless the target is Amazon EC2 Run Command or Amazon ECS task, in which case nothing from the event
* is passed to the target).
*
*
* -
*
* If Input is specified in the form of valid JSON, then the matched event is overridden with this constant.
*
*
* -
*
* If InputPath is specified in the form of JSONPath (for example, $.detail
), then only the
* part of the event specified in the path is passed to the target (for example, only the detail part of the event
* is passed).
*
*
* -
*
* If InputTransformer is specified, then one or more specified JSONPaths are extracted from the event and
* used as values in a template that you specify as the input to the target.
*
*
*
*
* When you specify InputPath
or InputTransformer
, you must use JSON dot notation, not
* bracket notation.
*
*
* When you add targets to a rule and the associated rule triggers soon after, new or updated targets might not be
* immediately invoked. Allow a short period of time for changes to take effect.
*
*
* This action can partially fail if too many requests are made at the same time. If that happens,
* FailedEntryCount
is non-zero in the response and each entry in FailedEntries
provides
* the ID of the failed target and the error code.
*
*
* @param putTargetsRequest
* @return Result of the PutTargets operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws LimitExceededException
* The request failed because it attempted to create resource beyond the allowed service quota.
* @throws ManagedRuleException
* This rule was created by an Amazon Web Services service on behalf of your account. It is managed by that
* service. If you see this error in response to DeleteRule
or RemoveTargets
, you
* can use the Force
parameter in those calls to delete the rule or remove targets from the
* rule. You cannot modify these managed rules by using DisableRule
, EnableRule
,
* PutTargets
, PutRule
, TagResource
, or UntagResource
.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.PutTargets
* @see AWS API
* Documentation
*/
@Override
public PutTargetsResponse putTargets(PutTargetsRequest putTargetsRequest) throws ResourceNotFoundException,
ConcurrentModificationException, LimitExceededException, ManagedRuleException, InternalException,
AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
PutTargetsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putTargetsRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, putTargetsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutTargets");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("PutTargets").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(putTargetsRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new PutTargetsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Revokes the permission of another Amazon Web Services account to be able to put events to the specified event
* bus. Specify the account to revoke by the StatementId
value that you associated with the account
* when you granted it permission with PutPermission
. You can find the StatementId
by
* using DescribeEventBus
* .
*
*
* @param removePermissionRequest
* @return Result of the RemovePermission operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws OperationDisabledException
* The operation you are attempting is not available in this region.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.RemovePermission
* @see AWS API
* Documentation
*/
@Override
public RemovePermissionResponse removePermission(RemovePermissionRequest removePermissionRequest)
throws ResourceNotFoundException, InternalException, ConcurrentModificationException, OperationDisabledException,
AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
RemovePermissionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(removePermissionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, removePermissionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RemovePermission");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("RemovePermission").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(removePermissionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new RemovePermissionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Removes the specified targets from the specified rule. When the rule is triggered, those targets are no longer be
* invoked.
*
*
* When you remove a target, when the associated rule triggers, removed targets might continue to be invoked. Allow
* a short period of time for changes to take effect.
*
*
* This action can partially fail if too many requests are made at the same time. If that happens,
* FailedEntryCount
is non-zero in the response and each entry in FailedEntries
provides
* the ID of the failed target and the error code.
*
*
* @param removeTargetsRequest
* @return Result of the RemoveTargets operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws ManagedRuleException
* This rule was created by an Amazon Web Services service on behalf of your account. It is managed by that
* service. If you see this error in response to DeleteRule
or RemoveTargets
, you
* can use the Force
parameter in those calls to delete the rule or remove targets from the
* rule. You cannot modify these managed rules by using DisableRule
, EnableRule
,
* PutTargets
, PutRule
, TagResource
, or UntagResource
.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.RemoveTargets
* @see AWS API
* Documentation
*/
@Override
public RemoveTargetsResponse removeTargets(RemoveTargetsRequest removeTargetsRequest) throws ResourceNotFoundException,
ConcurrentModificationException, ManagedRuleException, InternalException, AwsServiceException, SdkClientException,
CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
RemoveTargetsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(removeTargetsRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, removeTargetsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RemoveTargets");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("RemoveTargets").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(removeTargetsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new RemoveTargetsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Starts the specified replay. Events are not necessarily replayed in the exact same order that they were added to
* the archive. A replay processes events to replay based on the time in the event, and replays them using 1 minute
* intervals. If you specify an EventStartTime
and an EventEndTime
that covers a 20 minute
* time range, the events are replayed from the first minute of that 20 minute range first. Then the events from the
* second minute are replayed. You can use DescribeReplay
to determine the progress of a replay. The
* value returned for EventLastReplayedTime
indicates the time within the specified time range
* associated with the last event replayed.
*
*
* @param startReplayRequest
* @return Result of the StartReplay operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws ResourceAlreadyExistsException
* The resource you are trying to create already exists.
* @throws InvalidEventPatternException
* The event pattern is not valid.
* @throws LimitExceededException
* The request failed because it attempted to create resource beyond the allowed service quota.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.StartReplay
* @see AWS API
* Documentation
*/
@Override
public StartReplayResponse startReplay(StartReplayRequest startReplayRequest) throws ResourceNotFoundException,
ResourceAlreadyExistsException, InvalidEventPatternException, LimitExceededException, InternalException,
AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
StartReplayResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(startReplayRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, startReplayRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartReplay");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("StartReplay").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(startReplayRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new StartReplayRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Assigns one or more tags (key-value pairs) to the specified EventBridge resource. Tags can help you organize and
* categorize your resources. You can also use them to scope user permissions by granting a user permission to
* access or change only resources with certain tag values. In EventBridge, rules and event buses can be tagged.
*
*
* Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of
* characters.
*
*
* You can use the TagResource
action with a resource that already has tags. If you specify a new tag
* key, this tag is appended to the list of tags associated with the resource. If you specify a tag key that is
* already associated with the resource, the new tag value that you specify replaces the previous value for that
* tag.
*
*
* You can associate as many as 50 tags with a resource.
*
*
* @param tagResourceRequest
* @return Result of the TagResource operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws ManagedRuleException
* This rule was created by an Amazon Web Services service on behalf of your account. It is managed by that
* service. If you see this error in response to DeleteRule
or RemoveTargets
, you
* can use the Force
parameter in those calls to delete the rule or remove targets from the
* rule. You cannot modify these managed rules by using DisableRule
, EnableRule
,
* PutTargets
, PutRule
, TagResource
, or UntagResource
.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.TagResource
* @see AWS API
* Documentation
*/
@Override
public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws ResourceNotFoundException,
ConcurrentModificationException, InternalException, ManagedRuleException, AwsServiceException, SdkClientException,
CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
TagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(tagResourceRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("TagResource").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(tagResourceRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new TagResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Tests whether the specified event pattern matches the provided event.
*
*
* Most services in Amazon Web Services treat : or / as the same character in Amazon Resource Names (ARNs). However,
* EventBridge uses an exact match in event patterns and rules. Be sure to use the correct ARN characters when
* creating event patterns so that they match the ARN syntax in the event you want to match.
*
*
* @param testEventPatternRequest
* @return Result of the TestEventPattern operation returned by the service.
* @throws InvalidEventPatternException
* The event pattern is not valid.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.TestEventPattern
* @see AWS API
* Documentation
*/
@Override
public TestEventPatternResponse testEventPattern(TestEventPatternRequest testEventPatternRequest)
throws InvalidEventPatternException, InternalException, AwsServiceException, SdkClientException,
CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
TestEventPatternResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(testEventPatternRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, testEventPatternRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TestEventPattern");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("TestEventPattern").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(testEventPatternRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new TestEventPatternRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Removes one or more tags from the specified EventBridge resource. In Amazon EventBridge (CloudWatch Events),
* rules and event buses can be tagged.
*
*
* @param untagResourceRequest
* @return Result of the UntagResource operation returned by the service.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws ManagedRuleException
* This rule was created by an Amazon Web Services service on behalf of your account. It is managed by that
* service. If you see this error in response to DeleteRule
or RemoveTargets
, you
* can use the Force
parameter in those calls to delete the rule or remove targets from the
* rule. You cannot modify these managed rules by using DisableRule
, EnableRule
,
* PutTargets
, PutRule
, TagResource
, or UntagResource
.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.UntagResource
* @see AWS API
* Documentation
*/
@Override
public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws ResourceNotFoundException,
InternalException, ConcurrentModificationException, ManagedRuleException, AwsServiceException, SdkClientException,
CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UntagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(untagResourceRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UntagResource").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(untagResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UntagResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates an API destination.
*
*
* @param updateApiDestinationRequest
* @return Result of the UpdateApiDestination operation returned by the service.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws LimitExceededException
* The request failed because it attempted to create resource beyond the allowed service quota.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.UpdateApiDestination
* @see AWS
* API Documentation
*/
@Override
public UpdateApiDestinationResponse updateApiDestination(UpdateApiDestinationRequest updateApiDestinationRequest)
throws ConcurrentModificationException, ResourceNotFoundException, InternalException, LimitExceededException,
AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateApiDestinationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateApiDestinationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateApiDestinationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateApiDestination");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateApiDestination").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateApiDestinationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateApiDestinationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates the specified archive.
*
*
* @param updateArchiveRequest
* @return Result of the UpdateArchive operation returned by the service.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws LimitExceededException
* The request failed because it attempted to create resource beyond the allowed service quota.
* @throws InvalidEventPatternException
* The event pattern is not valid.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.UpdateArchive
* @see AWS API
* Documentation
*/
@Override
public UpdateArchiveResponse updateArchive(UpdateArchiveRequest updateArchiveRequest) throws ConcurrentModificationException,
ResourceNotFoundException, InternalException, LimitExceededException, InvalidEventPatternException,
AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateArchiveResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateArchiveRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateArchiveRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateArchive");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateArchive").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateArchiveRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateArchiveRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates settings for a connection.
*
*
* @param updateConnectionRequest
* @return Result of the UpdateConnection operation returned by the service.
* @throws ConcurrentModificationException
* There is concurrent modification on a rule, target, archive, or replay.
* @throws ResourceNotFoundException
* An entity that you specified does not exist.
* @throws InternalException
* This exception occurs due to unexpected causes.
* @throws LimitExceededException
* The request failed because it attempted to create resource beyond the allowed service quota.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CloudWatchEventsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CloudWatchEventsClient.UpdateConnection
* @see AWS API
* Documentation
*/
@Override
public UpdateConnectionResponse updateConnection(UpdateConnectionRequest updateConnectionRequest)
throws ConcurrentModificationException, ResourceNotFoundException, InternalException, LimitExceededException,
AwsServiceException, SdkClientException, CloudWatchEventsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateConnectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateConnectionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateConnectionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Events");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateConnection");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateConnection").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateConnectionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateConnectionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
}
if (publishers == null || publishers.isEmpty()) {
publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS);
}
if (publishers == null) {
publishers = Collections.emptyList();
}
return publishers;
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
JsonOperationMetadata operationMetadata) {
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) {
ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder();
RetryMode retryMode = builder.retryMode();
if (retryMode != null) {
configuration.option(SdkClientOption.RETRY_STRATEGY, AwsRetryStrategy.forRetryMode(retryMode));
} else {
Consumer> configurator = builder.retryStrategyConfigurator();
if (configurator != null) {
RetryStrategy.Builder, ?> defaultBuilder = AwsRetryStrategy.defaultRetryStrategy().toBuilder();
configurator.accept(defaultBuilder);
configuration.option(SdkClientOption.RETRY_STRATEGY, defaultBuilder.build());
} else {
RetryStrategy retryStrategy = builder.retryStrategy();
if (retryStrategy != null) {
configuration.option(SdkClientOption.RETRY_STRATEGY, retryStrategy);
}
}
}
configuration.option(SdkClientOption.CONFIGURED_RETRY_MODE, null);
configuration.option(SdkClientOption.CONFIGURED_RETRY_STRATEGY, null);
configuration.option(SdkClientOption.CONFIGURED_RETRY_CONFIGURATOR, null);
}
private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, SdkClientConfiguration clientConfiguration) {
List plugins = request.overrideConfiguration().map(c -> c.plugins()).orElse(Collections.emptyList());
SdkClientConfiguration.Builder configuration = clientConfiguration.toBuilder();
if (plugins.isEmpty()) {
return configuration.build();
}
CloudWatchEventsServiceClientConfigurationBuilder serviceConfigBuilder = new CloudWatchEventsServiceClientConfigurationBuilder(
configuration);
for (SdkPlugin plugin : plugins) {
plugin.configureClient(serviceConfigBuilder);
}
updateRetryStrategyClientConfiguration(configuration);
return configuration.build();
}
private > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(CloudWatchEventsException::builder)
.protocol(AwsJsonProtocol.AWS_JSON)
.protocolVersion("1.1")
.registerModeledException(
ExceptionMetadata.builder().errorCode("ConcurrentModificationException")
.exceptionBuilderSupplier(ConcurrentModificationException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("PolicyLengthExceededException")
.exceptionBuilderSupplier(PolicyLengthExceededException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidStateException")
.exceptionBuilderSupplier(InvalidStateException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidEventPatternException")
.exceptionBuilderSupplier(InvalidEventPatternException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("LimitExceededException")
.exceptionBuilderSupplier(LimitExceededException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("OperationDisabledException")
.exceptionBuilderSupplier(OperationDisabledException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("IllegalStatusException")
.exceptionBuilderSupplier(IllegalStatusException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceNotFoundException")
.exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceAlreadyExistsException")
.exceptionBuilderSupplier(ResourceAlreadyExistsException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InternalException")
.exceptionBuilderSupplier(InternalException::builder).httpStatusCode(500).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ManagedRuleException")
.exceptionBuilderSupplier(ManagedRuleException::builder).httpStatusCode(400).build());
}
@Override
public final CloudWatchEventsServiceClientConfiguration serviceClientConfiguration() {
return new CloudWatchEventsServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build();
}
@Override
public void close() {
clientHandler.close();
}
}