io.cloudshiftdev.awscdk.services.s3.notifications.SqsDestination.kt Maven / Gradle / Ivy
The newest version!
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")
package io.cloudshiftdev.awscdk.services.s3.notifications
import io.cloudshiftdev.awscdk.common.CdkObject
import io.cloudshiftdev.awscdk.services.s3.BucketNotificationDestinationConfig
import io.cloudshiftdev.awscdk.services.s3.IBucket
import io.cloudshiftdev.awscdk.services.s3.IBucketNotificationDestination
import io.cloudshiftdev.awscdk.services.sqs.IQueue
import io.cloudshiftdev.constructs.Construct
/**
* Use an SQS queue as a bucket notification destination.
*
* Example:
*
* ```
* Queue myQueue;
* Bucket bucket = Bucket.Builder.create(this, "MyBucket")
* .notificationsSkipDestinationValidation(true)
* .build();
* bucket.addEventNotification(EventType.OBJECT_REMOVED, new SqsDestination(myQueue));
* ```
*/
public open class SqsDestination(
cdkObject: software.amazon.awscdk.services.s3.notifications.SqsDestination,
) : CdkObject(cdkObject),
IBucketNotificationDestination {
public constructor(queue: IQueue) :
this(software.amazon.awscdk.services.s3.notifications.SqsDestination(queue.let(IQueue.Companion::unwrap))
)
/**
* Allows using SQS queues as destinations for bucket notifications.
*
* Use `bucket.onEvent(event, queue)` to subscribe.
*
* @param _scope
* @param bucket
*/
public override fun bind(scope: Construct, bucket: IBucket): BucketNotificationDestinationConfig =
unwrap(this).bind(scope.let(Construct.Companion::unwrap),
bucket.let(IBucket.Companion::unwrap)).let(BucketNotificationDestinationConfig::wrap)
public companion object {
internal fun wrap(cdkObject: software.amazon.awscdk.services.s3.notifications.SqsDestination):
SqsDestination = SqsDestination(cdkObject)
internal fun unwrap(wrapped: SqsDestination):
software.amazon.awscdk.services.s3.notifications.SqsDestination = wrapped.cdkObject as
software.amazon.awscdk.services.s3.notifications.SqsDestination
}
}