io.github.cdklabs.cdkecsserviceextensions.TopicSubscription Maven / Gradle / Ivy
Show all versions of cdk-ecs-service-extensions Show documentation
package io.github.cdklabs.cdkecsserviceextensions;
/**
* (experimental) The TopicSubscription
class represents an SNS Topic resource that can be subscribed to by the service queues.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-20T00:29:08.076Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdkecsserviceextensions.$Module.class, fqn = "@aws-cdk-containers/ecs-service-extensions.TopicSubscription")
public class TopicSubscription extends software.amazon.jsii.JsiiObject implements io.github.cdklabs.cdkecsserviceextensions.ISubscribable {
protected TopicSubscription(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected TopicSubscription(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public TopicSubscription(final @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.TopicSubscriptionProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* (experimental) This method sets up SNS Topic subscriptions for the SQS queue provided by the user.
*
* If a queue
is not provided,
* the default eventsQueue
subscribes to the given topic.
*
* @return the queue subscribed to the given topic
* @param extension QueueExtension
added to the service. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.sqs.IQueue subscribe(final @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.QueueExtension extension) {
return software.amazon.jsii.Kernel.call(this, "subscribe", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.sqs.IQueue.class), new Object[] { java.util.Objects.requireNonNull(extension, "extension is required") });
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.sns.ITopic getTopic() {
return software.amazon.jsii.Kernel.get(this, "topic", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.sns.ITopic.class));
}
/**
* (deprecated) The queue that subscribes to the given topic.
*
* Default: none
*
* @deprecated use subscriptionQueue
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.sqs.IQueue getQueue() {
return software.amazon.jsii.Kernel.get(this, "queue", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.sqs.IQueue.class));
}
/**
* (experimental) The subscription queue object for this subscription.
*
* Default: none
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.Nullable io.github.cdklabs.cdkecsserviceextensions.SubscriptionQueue getSubscriptionQueue() {
return software.amazon.jsii.Kernel.get(this, "subscriptionQueue", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdkecsserviceextensions.SubscriptionQueue.class));
}
/**
* (experimental) A fluent builder for {@link io.github.cdklabs.cdkecsserviceextensions.TopicSubscription}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create() {
return new Builder();
}
private final io.github.cdklabs.cdkecsserviceextensions.TopicSubscriptionProps.Builder props;
private Builder() {
this.props = new io.github.cdklabs.cdkecsserviceextensions.TopicSubscriptionProps.Builder();
}
/**
* (experimental) The SNS Topic to subscribe to.
*
* @return {@code this}
* @param topic The SNS Topic to subscribe to. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder topic(final software.amazon.awscdk.services.sns.ITopic topic) {
this.props.topic(topic);
return this;
}
/**
* (deprecated) The user-provided queue to subscribe to the given topic.
*
* Default: none
*
* @return {@code this}
* @deprecated use topicSubscriptionQueue
* @param queue The user-provided queue to subscribe to the given topic. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder queue(final software.amazon.awscdk.services.sqs.IQueue queue) {
this.props.queue(queue);
return this;
}
/**
* (experimental) The object representing topic-specific queue and corresponding queue delay fields to configure auto scaling.
*
* If not provided, the default eventsQueue
will subscribe to the given topic.
*
* Default: none
*
* @return {@code this}
* @param topicSubscriptionQueue The object representing topic-specific queue and corresponding queue delay fields to configure auto scaling. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder topicSubscriptionQueue(final io.github.cdklabs.cdkecsserviceextensions.SubscriptionQueue topicSubscriptionQueue) {
this.props.topicSubscriptionQueue(topicSubscriptionQueue);
return this;
}
/**
* @return a newly built instance of {@link io.github.cdklabs.cdkecsserviceextensions.TopicSubscription}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public io.github.cdklabs.cdkecsserviceextensions.TopicSubscription build() {
return new io.github.cdklabs.cdkecsserviceextensions.TopicSubscription(
this.props.build()
);
}
}
}