Class AmazonCloudWatchEventsAsyncClient
- All Implemented Interfaces:
AmazonCloudWatchEvents
,AmazonCloudWatchEventsAsync
AsyncHandler
can be
used to receive notification when an asynchronous operation completes.
Amazon CloudWatch Events helps you to respond to state changes in your AWS resources. When your resources change state they automatically send events into an event stream. You can create rules that match selected events in the stream and route them to targets to take action. You can also use rules to take action on a pre-determined schedule. For example, you can configure rules to:
- Automatically invoke an AWS Lambda function to update DNS entries when an event notifies you that Amazon EC2 instance enters the running state.
- Direct specific API records from CloudTrail to an Amazon Kinesis stream for detailed analysis of potential security or availability risks.
- Periodically invoke a built-in target to create a snapshot of an Amazon EBS volume.
For more information about Amazon CloudWatch Events features, see the Amazon CloudWatch Developer Guide.
-
Field Summary
Fields inherited from class com.amazonaws.services.cloudwatchevents.AmazonCloudWatchEventsClient
configFactory
Fields inherited from class com.amazonaws.AmazonWebServiceClient
client, clientConfiguration, endpoint, LOGGING_AWS_REQUEST_METRIC, requestHandler2s, timeOffset
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events.AmazonCloudWatchEventsAsyncClient
(AWSCredentials awsCredentials) Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events using the specified AWS account credentials.AmazonCloudWatchEventsAsyncClient
(AWSCredentialsProvider awsCredentialsProvider) Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events using the specified AWS account credentials provider.AmazonCloudWatchEventsAsyncClient
(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events using the provided AWS account credentials provider and client configuration options.AmazonCloudWatchEventsAsyncClient
(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, ExecutorService executorService) Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events using the specified AWS account credentials provider, executor service, and client configuration options.AmazonCloudWatchEventsAsyncClient
(AWSCredentialsProvider awsCredentialsProvider, ExecutorService executorService) Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events using the specified AWS account credentials provider and executor service.AmazonCloudWatchEventsAsyncClient
(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration, ExecutorService executorService) Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events using the specified AWS account credentials, executor service, and client configuration options.AmazonCloudWatchEventsAsyncClient
(AWSCredentials awsCredentials, ExecutorService executorService) Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events using the specified AWS account credentials and executor service.AmazonCloudWatchEventsAsyncClient
(ClientConfiguration clientConfiguration) Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events. -
Method Summary
Modifier and TypeMethodDescriptiondeleteRuleAsync
(DeleteRuleRequest request) Deletes a rule.deleteRuleAsync
(DeleteRuleRequest request, AsyncHandler<DeleteRuleRequest, DeleteRuleResult> asyncHandler) Deletes a rule.describeRuleAsync
(DescribeRuleRequest request) Describes the details of the specified rule.describeRuleAsync
(DescribeRuleRequest request, AsyncHandler<DescribeRuleRequest, DescribeRuleResult> asyncHandler) Describes the details of the specified rule.disableRuleAsync
(DisableRuleRequest request) Disables a rule.disableRuleAsync
(DisableRuleRequest request, AsyncHandler<DisableRuleRequest, DisableRuleResult> asyncHandler) Disables a rule.enableRuleAsync
(EnableRuleRequest request) Enables a rule.enableRuleAsync
(EnableRuleRequest request, AsyncHandler<EnableRuleRequest, EnableRuleResult> asyncHandler) Enables a rule.Returns the executor service used by this client to execute async requests.Lists the names of the rules that the given target is put to.listRuleNamesByTargetAsync
(ListRuleNamesByTargetRequest request, AsyncHandler<ListRuleNamesByTargetRequest, ListRuleNamesByTargetResult> asyncHandler) Lists the names of the rules that the given target is put to.listRulesAsync
(ListRulesRequest request) Lists the Amazon CloudWatch Events rules in your account.listRulesAsync
(ListRulesRequest request, AsyncHandler<ListRulesRequest, ListRulesResult> asyncHandler) Lists the Amazon CloudWatch Events rules in your account.Lists of targets assigned to the rule.listTargetsByRuleAsync
(ListTargetsByRuleRequest request, AsyncHandler<ListTargetsByRuleRequest, ListTargetsByRuleResult> asyncHandler) Lists of targets assigned to the rule.putEventsAsync
(PutEventsRequest request) Sends custom events to Amazon CloudWatch Events so that they can be matched to rules.putEventsAsync
(PutEventsRequest request, AsyncHandler<PutEventsRequest, PutEventsResult> asyncHandler) Sends custom events to Amazon CloudWatch Events so that they can be matched to rules.putRuleAsync
(PutRuleRequest request) Creates or updates a rule.putRuleAsync
(PutRuleRequest request, AsyncHandler<PutRuleRequest, PutRuleResult> asyncHandler) Creates or updates a rule.putTargetsAsync
(PutTargetsRequest request) Adds target(s) to a rule.putTargetsAsync
(PutTargetsRequest request, AsyncHandler<PutTargetsRequest, PutTargetsResult> asyncHandler) Adds target(s) to a rule.removeTargetsAsync
(RemoveTargetsRequest request) Removes target(s) from a rule so that when the rule is triggered, those targets will no longer be invoked.removeTargetsAsync
(RemoveTargetsRequest request, AsyncHandler<RemoveTargetsRequest, RemoveTargetsResult> asyncHandler) Removes target(s) from a rule so that when the rule is triggered, those targets will no longer be invoked.void
shutdown()
Shuts down the client, releasing all managed resources.Tests whether an event pattern matches the provided event.testEventPatternAsync
(TestEventPatternRequest request, AsyncHandler<TestEventPatternRequest, TestEventPatternResult> asyncHandler) Tests whether an event pattern matches the provided event.Methods inherited from class com.amazonaws.services.cloudwatchevents.AmazonCloudWatchEventsClient
deleteRule, describeRule, disableRule, enableRule, getCachedResponseMetadata, listRuleNamesByTarget, listRules, listTargetsByRule, putEvents, putRule, putTargets, removeTargets, testEventPattern
Methods inherited from class com.amazonaws.AmazonWebServiceClient
addRequestHandler, addRequestHandler, beforeMarshalling, configureRegion, createExecutionContext, createExecutionContext, createExecutionContext, endClientExecution, endClientExecution, findRequestMetricCollector, getEndpointPrefix, getRequestMetricsCollector, getServiceAbbreviation, getServiceName, getServiceNameIntern, getSigner, getSignerByURI, getSignerRegionOverride, getTimeOffset, isProfilingEnabled, isRequestMetricsEnabled, removeRequestHandler, removeRequestHandler, requestMetricCollector, setEndpoint, setEndpointPrefix, setRegion, setServiceNameIntern, setSignerRegionOverride, setTimeOffset, withEndpoint, withRegion, withRegion, withTimeOffset
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.amazonaws.services.cloudwatchevents.AmazonCloudWatchEvents
deleteRule, describeRule, disableRule, enableRule, getCachedResponseMetadata, listRuleNamesByTarget, listRules, listTargetsByRule, putEvents, putRule, putTargets, removeTargets, setEndpoint, setRegion, testEventPattern
-
Constructor Details
-
AmazonCloudWatchEventsAsyncClient
public AmazonCloudWatchEventsAsyncClient()Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events. A credentials provider chain will be used that searches for credentials in this order:- Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
- Java System Properties - aws.accessKeyId and aws.secretKey
- Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI
- Instance profile credentials delivered through the Amazon EC2 metadata service
Asynchronous methods are delegated to a fixed-size thread pool containing 50 threads (to match the default maximum number of concurrent connections to the service).
-
AmazonCloudWatchEventsAsyncClient
Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events. A credentials provider chain will be used that searches for credentials in this order:- Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
- Java System Properties - aws.accessKeyId and aws.secretKey
- Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI
- Instance profile credentials delivered through the Amazon EC2 metadata service
Asynchronous methods are delegated to a fixed-size thread pool containing a number of threads equal to the maximum number of concurrent connections configured via
ClientConfiguration.getMaxConnections()
.- Parameters:
clientConfiguration
- The client configuration options controlling how this client connects to Amazon CloudWatch Events (ex: proxy settings, retry counts, etc).- See Also:
-
AmazonCloudWatchEventsAsyncClient
Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events using the specified AWS account credentials.Asynchronous methods are delegated to a fixed-size thread pool containing 50 threads (to match the default maximum number of concurrent connections to the service).
- Parameters:
awsCredentials
- The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.- See Also:
-
AmazonCloudWatchEventsAsyncClient
public AmazonCloudWatchEventsAsyncClient(AWSCredentials awsCredentials, ExecutorService executorService) Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events using the specified AWS account credentials and executor service. Default client settings will be used.- Parameters:
awsCredentials
- The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.executorService
- The executor service by which all asynchronous requests will be executed.
-
AmazonCloudWatchEventsAsyncClient
public AmazonCloudWatchEventsAsyncClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration, ExecutorService executorService) Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events using the specified AWS account credentials, executor service, and client configuration options.- Parameters:
awsCredentials
- The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.clientConfiguration
- Client configuration options (ex: max retry limit, proxy settings, etc).executorService
- The executor service by which all asynchronous requests will be executed.
-
AmazonCloudWatchEventsAsyncClient
Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events using the specified AWS account credentials provider. Default client settings will be used.Asynchronous methods are delegated to a fixed-size thread pool containing 50 threads (to match the default maximum number of concurrent connections to the service).
- Parameters:
awsCredentialsProvider
- The AWS credentials provider which will provide credentials to authenticate requests with AWS services.- See Also:
-
AmazonCloudWatchEventsAsyncClient
public AmazonCloudWatchEventsAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events using the provided AWS account credentials provider and client configuration options.Asynchronous methods are delegated to a fixed-size thread pool containing a number of threads equal to the maximum number of concurrent connections configured via
ClientConfiguration.getMaxConnections()
.- Parameters:
awsCredentialsProvider
- The AWS credentials provider which will provide credentials to authenticate requests with AWS services.clientConfiguration
- Client configuration options (ex: max retry limit, proxy settings, etc).- See Also:
-
AmazonCloudWatchEventsAsyncClient
public AmazonCloudWatchEventsAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ExecutorService executorService) Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events using the specified AWS account credentials provider and executor service. Default client settings will be used.- Parameters:
awsCredentialsProvider
- The AWS credentials provider which will provide credentials to authenticate requests with AWS services.executorService
- The executor service by which all asynchronous requests will be executed.
-
AmazonCloudWatchEventsAsyncClient
public AmazonCloudWatchEventsAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, ExecutorService executorService) Constructs a new asynchronous client to invoke service methods on Amazon CloudWatch Events using the specified AWS account credentials provider, executor service, and client configuration options.- Parameters:
awsCredentialsProvider
- The AWS credentials provider which will provide credentials to authenticate requests with AWS services.clientConfiguration
- Client configuration options (ex: max retry limit, proxy settings, etc).executorService
- The executor service by which all asynchronous requests will be executed.
-
-
Method Details
-
getExecutorService
Returns the executor service used by this client to execute async requests.- Returns:
- The executor service used by this client to execute async requests.
-
deleteRuleAsync
Description copied from interface:AmazonCloudWatchEventsAsync
Deletes a rule. You must remove all targets from a rule using RemoveTargets before you can delete the rule.
Note: When you delete a rule, incoming events might still continue to match to the deleted rule. Please allow a short period of time for changes to take effect.
- Specified by:
deleteRuleAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the DeleteRule operation.- Returns:
- A Java Future containing the result of the DeleteRule operation returned by the service.
-
deleteRuleAsync
public Future<DeleteRuleResult> deleteRuleAsync(DeleteRuleRequest request, AsyncHandler<DeleteRuleRequest, DeleteRuleResult> asyncHandler) Description copied from interface:AmazonCloudWatchEventsAsync
Deletes a rule. You must remove all targets from a rule using RemoveTargets before you can delete the rule.
Note: When you delete a rule, incoming events might still continue to match to the deleted rule. Please allow a short period of time for changes to take effect.
- Specified by:
deleteRuleAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the DeleteRule operation.asyncHandler
- Asynchronous callback handler for events in the lifecycle of the request. Users can provide an implementation of the callback methods in this interface to receive notification of successful or unsuccessful completion of the operation.- Returns:
- A Java Future containing the result of the DeleteRule operation returned by the service.
-
describeRuleAsync
Description copied from interface:AmazonCloudWatchEventsAsync
Describes the details of the specified rule.
- Specified by:
describeRuleAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the DescribeRule operation.- Returns:
- A Java Future containing the result of the DescribeRule operation returned by the service.
-
describeRuleAsync
public Future<DescribeRuleResult> describeRuleAsync(DescribeRuleRequest request, AsyncHandler<DescribeRuleRequest, DescribeRuleResult> asyncHandler) Description copied from interface:AmazonCloudWatchEventsAsync
Describes the details of the specified rule.
- Specified by:
describeRuleAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the DescribeRule operation.asyncHandler
- Asynchronous callback handler for events in the lifecycle of the request. Users can provide an implementation of the callback methods in this interface to receive notification of successful or unsuccessful completion of the operation.- Returns:
- A Java Future containing the result of the DescribeRule operation returned by the service.
-
disableRuleAsync
Description copied from interface:AmazonCloudWatchEventsAsync
Disables a rule. A disabled rule won't match any events, and won't self-trigger if it has a schedule expression.
Note: When you disable a rule, incoming events might still continue to match to the disabled rule. Please allow a short period of time for changes to take effect.
- Specified by:
disableRuleAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the DisableRule operation.- Returns:
- A Java Future containing the result of the DisableRule operation returned by the service.
-
disableRuleAsync
public Future<DisableRuleResult> disableRuleAsync(DisableRuleRequest request, AsyncHandler<DisableRuleRequest, DisableRuleResult> asyncHandler) Description copied from interface:AmazonCloudWatchEventsAsync
Disables a rule. A disabled rule won't match any events, and won't self-trigger if it has a schedule expression.
Note: When you disable a rule, incoming events might still continue to match to the disabled rule. Please allow a short period of time for changes to take effect.
- Specified by:
disableRuleAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the DisableRule operation.asyncHandler
- Asynchronous callback handler for events in the lifecycle of the request. Users can provide an implementation of the callback methods in this interface to receive notification of successful or unsuccessful completion of the operation.- Returns:
- A Java Future containing the result of the DisableRule operation returned by the service.
-
enableRuleAsync
Description copied from interface:AmazonCloudWatchEventsAsync
Enables a rule. If the rule does not exist, the operation fails.
Note: When you enable a rule, incoming events might not immediately start matching to a newly enabled rule. Please allow a short period of time for changes to take effect.
- Specified by:
enableRuleAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the EnableRule operation.- Returns:
- A Java Future containing the result of the EnableRule operation returned by the service.
-
enableRuleAsync
public Future<EnableRuleResult> enableRuleAsync(EnableRuleRequest request, AsyncHandler<EnableRuleRequest, EnableRuleResult> asyncHandler) Description copied from interface:AmazonCloudWatchEventsAsync
Enables a rule. If the rule does not exist, the operation fails.
Note: When you enable a rule, incoming events might not immediately start matching to a newly enabled rule. Please allow a short period of time for changes to take effect.
- Specified by:
enableRuleAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the EnableRule operation.asyncHandler
- Asynchronous callback handler for events in the lifecycle of the request. Users can provide an implementation of the callback methods in this interface to receive notification of successful or unsuccessful completion of the operation.- Returns:
- A Java Future containing the result of the EnableRule operation returned by the service.
-
listRuleNamesByTargetAsync
public Future<ListRuleNamesByTargetResult> listRuleNamesByTargetAsync(ListRuleNamesByTargetRequest request) Description copied from interface:AmazonCloudWatchEventsAsync
Lists the names of the rules that the given target is put to. You can see which of the rules in Amazon CloudWatch Events can invoke a specific target in your account. If you have more rules in your account than the given limit, the results will be paginated. In that case, use the next token returned in the response and repeat ListRulesByTarget until the NextToken in the response is returned as null.
- Specified by:
listRuleNamesByTargetAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the ListRuleNamesByTarget operation.- Returns:
- A Java Future containing the result of the ListRuleNamesByTarget operation returned by the service.
-
listRuleNamesByTargetAsync
public Future<ListRuleNamesByTargetResult> listRuleNamesByTargetAsync(ListRuleNamesByTargetRequest request, AsyncHandler<ListRuleNamesByTargetRequest, ListRuleNamesByTargetResult> asyncHandler) Description copied from interface:AmazonCloudWatchEventsAsync
Lists the names of the rules that the given target is put to. You can see which of the rules in Amazon CloudWatch Events can invoke a specific target in your account. If you have more rules in your account than the given limit, the results will be paginated. In that case, use the next token returned in the response and repeat ListRulesByTarget until the NextToken in the response is returned as null.
- Specified by:
listRuleNamesByTargetAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the ListRuleNamesByTarget operation.asyncHandler
- Asynchronous callback handler for events in the lifecycle of the request. Users can provide an implementation of the callback methods in this interface to receive notification of successful or unsuccessful completion of the operation.- Returns:
- A Java Future containing the result of the ListRuleNamesByTarget operation returned by the service.
-
listRulesAsync
Description copied from interface:AmazonCloudWatchEventsAsync
Lists the Amazon CloudWatch Events rules in your account. You can either list all the rules or you can provide a prefix to match to the rule names. If you have more rules in your account than the given limit, the results will be paginated. In that case, use the next token returned in the response and repeat ListRules until the NextToken in the response is returned as null.
- Specified by:
listRulesAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the ListRules operation.- Returns:
- A Java Future containing the result of the ListRules operation returned by the service.
-
listRulesAsync
public Future<ListRulesResult> listRulesAsync(ListRulesRequest request, AsyncHandler<ListRulesRequest, ListRulesResult> asyncHandler) Description copied from interface:AmazonCloudWatchEventsAsync
Lists the Amazon CloudWatch Events rules in your account. You can either list all the rules or you can provide a prefix to match to the rule names. If you have more rules in your account than the given limit, the results will be paginated. In that case, use the next token returned in the response and repeat ListRules until the NextToken in the response is returned as null.
- Specified by:
listRulesAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the ListRules operation.asyncHandler
- Asynchronous callback handler for events in the lifecycle of the request. Users can provide an implementation of the callback methods in this interface to receive notification of successful or unsuccessful completion of the operation.- Returns:
- A Java Future containing the result of the ListRules operation returned by the service.
-
listTargetsByRuleAsync
Description copied from interface:AmazonCloudWatchEventsAsync
Lists of targets assigned to the rule.
- Specified by:
listTargetsByRuleAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the ListTargetsByRule operation.- Returns:
- A Java Future containing the result of the ListTargetsByRule operation returned by the service.
-
listTargetsByRuleAsync
public Future<ListTargetsByRuleResult> listTargetsByRuleAsync(ListTargetsByRuleRequest request, AsyncHandler<ListTargetsByRuleRequest, ListTargetsByRuleResult> asyncHandler) Description copied from interface:AmazonCloudWatchEventsAsync
Lists of targets assigned to the rule.
- Specified by:
listTargetsByRuleAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the ListTargetsByRule operation.asyncHandler
- Asynchronous callback handler for events in the lifecycle of the request. Users can provide an implementation of the callback methods in this interface to receive notification of successful or unsuccessful completion of the operation.- Returns:
- A Java Future containing the result of the ListTargetsByRule operation returned by the service.
-
putEventsAsync
Description copied from interface:AmazonCloudWatchEventsAsync
Sends custom events to Amazon CloudWatch Events so that they can be matched to rules.
- Specified by:
putEventsAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the PutEvents operation.- Returns:
- A Java Future containing the result of the PutEvents operation returned by the service.
-
putEventsAsync
public Future<PutEventsResult> putEventsAsync(PutEventsRequest request, AsyncHandler<PutEventsRequest, PutEventsResult> asyncHandler) Description copied from interface:AmazonCloudWatchEventsAsync
Sends custom events to Amazon CloudWatch Events so that they can be matched to rules.
- Specified by:
putEventsAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the PutEvents operation.asyncHandler
- Asynchronous callback handler for events in the lifecycle of the request. Users can provide an implementation of the callback methods in this interface to receive notification of successful or unsuccessful completion of the operation.- Returns:
- A Java Future containing the result of the PutEvents operation returned by the service.
-
putRuleAsync
Description copied from interface:AmazonCloudWatchEventsAsync
Creates or updates a rule. Rules are enabled by default, or based on value of the State parameter. You can disable a rule using DisableRule.
Note: When you create or update a rule, incoming events might not immediately start matching to new or updated rules. Please 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 will trigger on matching events as well as on a schedule.
Note: Most services in AWS treat : or / as the same character in Amazon Resource Names (ARNs). However, CloudWatch Events 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.
- Specified by:
putRuleAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the PutRule operation.- Returns:
- A Java Future containing the result of the PutRule operation returned by the service.
-
putRuleAsync
public Future<PutRuleResult> putRuleAsync(PutRuleRequest request, AsyncHandler<PutRuleRequest, PutRuleResult> asyncHandler) Description copied from interface:AmazonCloudWatchEventsAsync
Creates or updates a rule. Rules are enabled by default, or based on value of the State parameter. You can disable a rule using DisableRule.
Note: When you create or update a rule, incoming events might not immediately start matching to new or updated rules. Please 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 will trigger on matching events as well as on a schedule.
Note: Most services in AWS treat : or / as the same character in Amazon Resource Names (ARNs). However, CloudWatch Events 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.
- Specified by:
putRuleAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the PutRule operation.asyncHandler
- Asynchronous callback handler for events in the lifecycle of the request. Users can provide an implementation of the callback methods in this interface to receive notification of successful or unsuccessful completion of the operation.- Returns:
- A Java Future containing the result of the PutRule operation returned by the service.
-
putTargetsAsync
Description copied from interface:AmazonCloudWatchEventsAsync
Adds target(s) to a rule. Targets are the resources that can be invoked when a rule is triggered. For example, AWS Lambda functions, Amazon Kinesis streams, and built-in targets. Updates the target(s) if they are already associated with the role. In other words, if there is already a target with the given target ID, then the target associated with that ID is updated.
In order to be able to make API calls against the resources you own, Amazon CloudWatch Events needs the appropriate permissions. For AWS Lambda and Amazon SNS resources, CloudWatch Events relies on resource-based policies. For Amazon Kinesis streams, CloudWatch Events relies on IAM roles. For more information, see Permissions for Sending Events to Targets in the Amazon CloudWatch Developer Guide.
Input and InputPath are mutually-exclusive and optional parameters of a target. When a rule is triggered due to a matched event, if for a target:
- Neither Input nor InputPath is specified, then the entire event is passed to the target in JSON form.
- InputPath is specified in the form of JSONPath (e.g. $.detail), then only the part of the event specified in the path is passed to the target (e.g. only the detail part of the event is passed).
- Input is specified in the form of a valid JSON, then the matched event is overridden with this constant.
Note: When you add targets to a rule, when the associated rule triggers, new or updated targets might not be immediately invoked. Please allow a short period of time for changes to take effect.
- Specified by:
putTargetsAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the PutTargets operation.- Returns:
- A Java Future containing the result of the PutTargets operation returned by the service.
-
putTargetsAsync
public Future<PutTargetsResult> putTargetsAsync(PutTargetsRequest request, AsyncHandler<PutTargetsRequest, PutTargetsResult> asyncHandler) Description copied from interface:AmazonCloudWatchEventsAsync
Adds target(s) to a rule. Targets are the resources that can be invoked when a rule is triggered. For example, AWS Lambda functions, Amazon Kinesis streams, and built-in targets. Updates the target(s) if they are already associated with the role. In other words, if there is already a target with the given target ID, then the target associated with that ID is updated.
In order to be able to make API calls against the resources you own, Amazon CloudWatch Events needs the appropriate permissions. For AWS Lambda and Amazon SNS resources, CloudWatch Events relies on resource-based policies. For Amazon Kinesis streams, CloudWatch Events relies on IAM roles. For more information, see Permissions for Sending Events to Targets in the Amazon CloudWatch Developer Guide.
Input and InputPath are mutually-exclusive and optional parameters of a target. When a rule is triggered due to a matched event, if for a target:
- Neither Input nor InputPath is specified, then the entire event is passed to the target in JSON form.
- InputPath is specified in the form of JSONPath (e.g. $.detail), then only the part of the event specified in the path is passed to the target (e.g. only the detail part of the event is passed).
- Input is specified in the form of a valid JSON, then the matched event is overridden with this constant.
Note: When you add targets to a rule, when the associated rule triggers, new or updated targets might not be immediately invoked. Please allow a short period of time for changes to take effect.
- Specified by:
putTargetsAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the PutTargets operation.asyncHandler
- Asynchronous callback handler for events in the lifecycle of the request. Users can provide an implementation of the callback methods in this interface to receive notification of successful or unsuccessful completion of the operation.- Returns:
- A Java Future containing the result of the PutTargets operation returned by the service.
-
removeTargetsAsync
Description copied from interface:AmazonCloudWatchEventsAsync
Removes target(s) from a rule so that when the rule is triggered, those targets will no longer be invoked.
Note: When you remove a target, when the associated rule triggers, removed targets might still continue to be invoked. Please allow a short period of time for changes to take effect.
- Specified by:
removeTargetsAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the RemoveTargets operation.- Returns:
- A Java Future containing the result of the RemoveTargets operation returned by the service.
-
removeTargetsAsync
public Future<RemoveTargetsResult> removeTargetsAsync(RemoveTargetsRequest request, AsyncHandler<RemoveTargetsRequest, RemoveTargetsResult> asyncHandler) Description copied from interface:AmazonCloudWatchEventsAsync
Removes target(s) from a rule so that when the rule is triggered, those targets will no longer be invoked.
Note: When you remove a target, when the associated rule triggers, removed targets might still continue to be invoked. Please allow a short period of time for changes to take effect.
- Specified by:
removeTargetsAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the RemoveTargets operation.asyncHandler
- Asynchronous callback handler for events in the lifecycle of the request. Users can provide an implementation of the callback methods in this interface to receive notification of successful or unsuccessful completion of the operation.- Returns:
- A Java Future containing the result of the RemoveTargets operation returned by the service.
-
testEventPatternAsync
Description copied from interface:AmazonCloudWatchEventsAsync
Tests whether an event pattern matches the provided event.
Note: Most services in AWS treat : or / as the same character in Amazon Resource Names (ARNs). However, CloudWatch Events 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.
- Specified by:
testEventPatternAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the TestEventPattern operation.- Returns:
- A Java Future containing the result of the TestEventPattern operation returned by the service.
-
testEventPatternAsync
public Future<TestEventPatternResult> testEventPatternAsync(TestEventPatternRequest request, AsyncHandler<TestEventPatternRequest, TestEventPatternResult> asyncHandler) Description copied from interface:AmazonCloudWatchEventsAsync
Tests whether an event pattern matches the provided event.
Note: Most services in AWS treat : or / as the same character in Amazon Resource Names (ARNs). However, CloudWatch Events 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.
- Specified by:
testEventPatternAsync
in interfaceAmazonCloudWatchEventsAsync
- Parameters:
request
- Container for the parameters to the TestEventPattern operation.asyncHandler
- Asynchronous callback handler for events in the lifecycle of the request. Users can provide an implementation of the callback methods in this interface to receive notification of successful or unsuccessful completion of the operation.- Returns:
- A Java Future containing the result of the TestEventPattern operation returned by the service.
-
shutdown
public void shutdown()Shuts down the client, releasing all managed resources. This includes forcibly terminating all pending asynchronous service calls. Clients who wish to give pending asynchronous service calls time to complete should callgetExecutorService().shutdown()
followed bygetExecutorService().awaitTermination()
prior to calling this method.- Specified by:
shutdown
in interfaceAmazonCloudWatchEvents
- Overrides:
shutdown
in classAmazonWebServiceClient
-