cloudshift.awscdk.dsl.services.events.targets.SqsQueueDsl.kt Maven / Gradle / Ivy
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")
package cloudshift.awscdk.dsl.services.events.targets
import cloudshift.awscdk.common.CdkDslMarker
import kotlin.Number
import kotlin.String
import software.amazon.awscdk.Duration
import software.amazon.awscdk.services.events.RuleTargetInput
import software.amazon.awscdk.services.events.targets.SqsQueue
import software.amazon.awscdk.services.sqs.IQueue
/**
* Use an SQS Queue as a target for Amazon EventBridge rules.
*
* Example:
*
* ```
* // publish to an SQS queue every time code is committed
* // to a CodeCommit repository
* repository.onCommit("onCommit", OnCommitOptions.builder().target(new SqsQueue(queue)).build());
* ```
*/
@CdkDslMarker
public class SqsQueueDsl(
queue: IQueue,
) {
private val cdkBuilder: SqsQueue.Builder = SqsQueue.Builder.create(queue)
/**
* 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
*
* @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).
*
*/
public fun deadLetterQueue(deadLetterQueue: IQueue) {
cdkBuilder.deadLetterQueue(deadLetterQueue)
}
/**
* 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)
*
* @param maxEventAge The maximum age of a request that Lambda sends to a function for processing.
*
*/
public fun maxEventAge(maxEventAge: Duration) {
cdkBuilder.maxEventAge(maxEventAge)
}
/**
* The message to send to the queue.
*
* Must be a valid JSON text passed to the target queue.
*
* Default: the entire EventBridge event
*
* @param message The message to send to the queue.
*/
public fun message(message: RuleTargetInput) {
cdkBuilder.message(message)
}
/**
* Message Group ID for messages sent to this queue.
*
* Required for FIFO queues, leave empty for regular queues.
*
* Default: - no message group ID (regular queue)
*
* @param messageGroupId Message Group ID for messages sent to this queue.
*/
public fun messageGroupId(messageGroupId: String) {
cdkBuilder.messageGroupId(messageGroupId)
}
/**
* The maximum number of times to retry when the function returns an error.
*
* Minimum value of 0.
* Maximum value of 185.
*
* Default: 185
*
* @param retryAttempts The maximum number of times to retry when the function returns an error.
*/
public fun retryAttempts(retryAttempts: Number) {
cdkBuilder.retryAttempts(retryAttempts)
}
public fun build(): SqsQueue = cdkBuilder.build()
}