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

software.amazon.awscdk.services.events.targets.CloudWatchLogGroup Maven / Gradle / Ivy

There is a newer version: 1.204.0
Show newest version
package software.amazon.awscdk.services.events.targets;

/**
 * Use an AWS CloudWatch LogGroup as an event rule target.
 * 

* Example: *

*

 * import software.amazon.awscdk.services.logs.*;
 * LogGroup logGroup = LogGroup.Builder.create(this, "MyLogGroup")
 *         .logGroupName("MyLogGroup")
 *         .build();
 * Rule rule = Rule.Builder.create(this, "rule")
 *         .eventPattern(EventPattern.builder()
 *                 .source(List.of("aws.ec2"))
 *                 .build())
 *         .build();
 * rule.addTarget(new CloudWatchLogGroup(logGroup));
 * 
*/ @javax.annotation.Generated(value = "jsii-pacmak/1.63.2 (build a8a8833)", date = "2022-08-17T17:31:21.285Z") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.events.targets.$Module.class, fqn = "@aws-cdk/aws-events-targets.CloudWatchLogGroup") public class CloudWatchLogGroup extends software.amazon.jsii.JsiiObject implements software.amazon.awscdk.services.events.IRuleTarget { protected CloudWatchLogGroup(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); } protected CloudWatchLogGroup(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { super(initializationMode); } /** * @param logGroup This parameter is required. * @param props */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public CloudWatchLogGroup(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.logs.ILogGroup logGroup, final @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.events.targets.LogGroupProps props) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(logGroup, "logGroup is required"), props }); } /** * @param logGroup This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public CloudWatchLogGroup(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.logs.ILogGroup logGroup) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(logGroup, "logGroup is required") }); } /** * Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup. *

* @param _rule This parameter is required. * @param _id */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.events.RuleTargetConfig bind(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.events.IRule _rule, final @org.jetbrains.annotations.Nullable java.lang.String _id) { return software.amazon.jsii.Kernel.call(this, "bind", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.events.RuleTargetConfig.class), new Object[] { java.util.Objects.requireNonNull(_rule, "_rule is required"), _id }); } /** * Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup. *

* @param _rule This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.events.RuleTargetConfig bind(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.events.IRule _rule) { return software.amazon.jsii.Kernel.call(this, "bind", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.events.RuleTargetConfig.class), new Object[] { java.util.Objects.requireNonNull(_rule, "_rule is required") }); } /** * A fluent builder for {@link software.amazon.awscdk.services.events.targets.CloudWatchLogGroup}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public static final class Builder implements software.amazon.jsii.Builder { /** * @return a new instance of {@link Builder}. * @param logGroup This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public static Builder create(final software.amazon.awscdk.services.logs.ILogGroup logGroup) { return new Builder(logGroup); } private final software.amazon.awscdk.services.logs.ILogGroup logGroup; private software.amazon.awscdk.services.events.targets.LogGroupProps.Builder props; private Builder(final software.amazon.awscdk.services.logs.ILogGroup logGroup) { this.logGroup = logGroup; } /** * The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). *

* The events not successfully delivered are automatically retried for a specified period of time, * depending on the retry policy of the target. * If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue. *

* Default: - no dead-letter queue *

* @return {@code this} * @param deadLetterQueue The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder deadLetterQueue(final software.amazon.awscdk.services.sqs.IQueue deadLetterQueue) { this.props().deadLetterQueue(deadLetterQueue); return this; } /** * The maximum age of a request that Lambda sends to a function for processing. *

* Minimum value of 60. * Maximum value of 86400. *

* Default: Duration.hours(24) *

* @return {@code this} * @param maxEventAge The maximum age of a request that Lambda sends to a function for processing. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder maxEventAge(final software.amazon.awscdk.core.Duration maxEventAge) { this.props().maxEventAge(maxEventAge); return this; } /** * The maximum number of times to retry when the function returns an error. *

* Minimum value of 0. * Maximum value of 185. *

* Default: 185 *

* @return {@code this} * @param retryAttempts The maximum number of times to retry when the function returns an error. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder retryAttempts(final java.lang.Number retryAttempts) { this.props().retryAttempts(retryAttempts); return this; } /** * The event to send to the CloudWatch LogGroup. *

* This will be the event logged into the CloudWatch LogGroup *

* Default: - the entire EventBridge event *

* @return {@code this} * @param event The event to send to the CloudWatch LogGroup. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder event(final software.amazon.awscdk.services.events.RuleTargetInput event) { this.props().event(event); return this; } /** * @returns a newly built instance of {@link software.amazon.awscdk.services.events.targets.CloudWatchLogGroup}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public software.amazon.awscdk.services.events.targets.CloudWatchLogGroup build() { return new software.amazon.awscdk.services.events.targets.CloudWatchLogGroup( this.logGroup, this.props != null ? this.props.build() : null ); } private software.amazon.awscdk.services.events.targets.LogGroupProps.Builder props() { if (this.props == null) { this.props = new software.amazon.awscdk.services.events.targets.LogGroupProps.Builder(); } return this.props; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy