Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.sns.model.SubscribeRequest Maven / Gradle / Ivy
Go to download
The AWS Java SDK for Amazon SNS module holds the client classes that are used for communicating with
Amazon Simple Notification Service
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.sns.model;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Input for Subscribe action.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SubscribeRequest extends SnsRequest implements ToCopyableBuilder {
private static final SdkField TOPIC_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TopicArn").getter(getter(SubscribeRequest::topicArn)).setter(setter(Builder::topicArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TopicArn").build()).build();
private static final SdkField PROTOCOL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Protocol").getter(getter(SubscribeRequest::protocol)).setter(setter(Builder::protocol))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Protocol").build()).build();
private static final SdkField ENDPOINT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Endpoint").getter(getter(SubscribeRequest::endpoint)).setter(setter(Builder::endpoint))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Endpoint").build()).build();
private static final SdkField> ATTRIBUTES_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("Attributes")
.getter(getter(SubscribeRequest::attributes))
.setter(setter(Builder::attributes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Attributes").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField RETURN_SUBSCRIPTION_ARN_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("ReturnSubscriptionArn").getter(getter(SubscribeRequest::returnSubscriptionArn))
.setter(setter(Builder::returnSubscriptionArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReturnSubscriptionArn").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TOPIC_ARN_FIELD,
PROTOCOL_FIELD, ENDPOINT_FIELD, ATTRIBUTES_FIELD, RETURN_SUBSCRIPTION_ARN_FIELD));
private final String topicArn;
private final String protocol;
private final String endpoint;
private final Map attributes;
private final Boolean returnSubscriptionArn;
private SubscribeRequest(BuilderImpl builder) {
super(builder);
this.topicArn = builder.topicArn;
this.protocol = builder.protocol;
this.endpoint = builder.endpoint;
this.attributes = builder.attributes;
this.returnSubscriptionArn = builder.returnSubscriptionArn;
}
/**
*
* The ARN of the topic you want to subscribe to.
*
*
* @return The ARN of the topic you want to subscribe to.
*/
public final String topicArn() {
return topicArn;
}
/**
*
* The protocol that you want to use. Supported protocols include:
*
*
*
*
* http
– delivery of JSON-encoded message via HTTP POST
*
*
*
*
* https
– delivery of JSON-encoded message via HTTPS POST
*
*
*
*
* email
– delivery of message via SMTP
*
*
*
*
* email-json
– delivery of JSON-encoded message via SMTP
*
*
*
*
* sms
– delivery of message via SMS
*
*
*
*
* sqs
– delivery of JSON-encoded message to an Amazon SQS queue
*
*
*
*
* application
– delivery of JSON-encoded message to an EndpointArn for a mobile app and device
*
*
*
*
* lambda
– delivery of JSON-encoded message to an Lambda function
*
*
*
*
* firehose
– delivery of JSON-encoded message to an Amazon Kinesis Data Firehose delivery stream.
*
*
*
*
* @return The protocol that you want to use. Supported protocols include:
*
*
*
* http
– delivery of JSON-encoded message via HTTP POST
*
*
*
*
* https
– delivery of JSON-encoded message via HTTPS POST
*
*
*
*
* email
– delivery of message via SMTP
*
*
*
*
* email-json
– delivery of JSON-encoded message via SMTP
*
*
*
*
* sms
– delivery of message via SMS
*
*
*
*
* sqs
– delivery of JSON-encoded message to an Amazon SQS queue
*
*
*
*
* application
– delivery of JSON-encoded message to an EndpointArn for a mobile app and device
*
*
*
*
* lambda
– delivery of JSON-encoded message to an Lambda function
*
*
*
*
* firehose
– delivery of JSON-encoded message to an Amazon Kinesis Data Firehose delivery
* stream.
*
*
*/
public final String protocol() {
return protocol;
}
/**
*
* The endpoint that you want to receive notifications. Endpoints vary by protocol:
*
*
*
*
* For the http
protocol, the (public) endpoint is a URL beginning with http://
.
*
*
*
*
* For the https
protocol, the (public) endpoint is a URL beginning with https://
.
*
*
*
*
* For the email
protocol, the endpoint is an email address.
*
*
*
*
* For the email-json
protocol, the endpoint is an email address.
*
*
*
*
* For the sms
protocol, the endpoint is a phone number of an SMS-enabled device.
*
*
*
*
* For the sqs
protocol, the endpoint is the ARN of an Amazon SQS queue.
*
*
*
*
* For the application
protocol, the endpoint is the EndpointArn of a mobile app and device.
*
*
*
*
* For the lambda
protocol, the endpoint is the ARN of an Lambda function.
*
*
*
*
* For the firehose
protocol, the endpoint is the ARN of an Amazon Kinesis Data Firehose delivery
* stream.
*
*
*
*
* @return The endpoint that you want to receive notifications. Endpoints vary by protocol:
*
*
*
* For the http
protocol, the (public) endpoint is a URL beginning with http://
.
*
*
*
*
* For the https
protocol, the (public) endpoint is a URL beginning with https://
.
*
*
*
*
* For the email
protocol, the endpoint is an email address.
*
*
*
*
* For the email-json
protocol, the endpoint is an email address.
*
*
*
*
* For the sms
protocol, the endpoint is a phone number of an SMS-enabled device.
*
*
*
*
* For the sqs
protocol, the endpoint is the ARN of an Amazon SQS queue.
*
*
*
*
* For the application
protocol, the endpoint is the EndpointArn of a mobile app and device.
*
*
*
*
* For the lambda
protocol, the endpoint is the ARN of an Lambda function.
*
*
*
*
* For the firehose
protocol, the endpoint is the ARN of an Amazon Kinesis Data Firehose
* delivery stream.
*
*
*/
public final String endpoint() {
return endpoint;
}
/**
* For responses, this returns true if the service returned a value for the Attributes property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasAttributes() {
return attributes != null && !(attributes instanceof SdkAutoConstructMap);
}
/**
*
* A map of attributes with their corresponding values.
*
*
* The following lists the names, descriptions, and values of the special request parameters that the
* Subscribe
action uses:
*
*
*
*
* DeliveryPolicy
– The policy that defines how Amazon SNS retries failed deliveries to HTTP/S
* endpoints.
*
*
*
*
* FilterPolicy
– The simple JSON object that lets your subscriber receive only a subset of messages,
* rather than receiving every message published to the topic.
*
*
*
*
* FilterPolicyScope
– This attribute lets you choose the filtering scope by using one of the following
* string value types:
*
*
*
*
*
* RawMessageDelivery
– When set to true
, enables raw message delivery to Amazon SQS or
* HTTP/S endpoints. This eliminates the need for the endpoints to process JSON formatting, which is otherwise
* created for Amazon SNS metadata.
*
*
*
*
* RedrivePolicy
– When specified, sends undeliverable messages to the specified Amazon SQS dead-letter
* queue. Messages that can't be delivered due to client errors (for example, when the subscribed endpoint is
* unreachable) or server errors (for example, when the service that powers the subscribed endpoint becomes
* unavailable) are held in the dead-letter queue for further analysis or reprocessing.
*
*
*
*
* The following attribute applies only to Amazon Data Firehose delivery stream subscriptions:
*
*
*
*
* SubscriptionRoleArn
– The ARN of the IAM role that has the following:
*
*
*
* Specifying a valid ARN for this attribute is required for Firehose delivery stream subscriptions. For more
* information, see Fanout to
* Firehose delivery streams in the Amazon SNS Developer Guide .
*
*
*
*
* The following attributes apply only to FIFO topics :
*
*
*
*
* ReplayPolicy
– Adds or updates an inline policy document for a subscription to replay messages
* stored in the specified Amazon SNS topic.
*
*
*
*
* ReplayStatus
– Retrieves the status of the subscription message replay, which can be one of the
* following:
*
*
*
*
* Completed
– The replay has successfully redelivered all messages, and is now delivering newly
* published messages. If an ending point was specified in the ReplayPolicy
then the subscription will
* no longer receive newly published messages.
*
*
*
*
* In progress
– The replay is currently replaying the selected messages.
*
*
*
*
* Failed
– The replay was unable to complete.
*
*
*
*
* Pending
– The default state while the replay initiates.
*
*
*
*
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasAttributes} method.
*
*
* @return A map of attributes with their corresponding values.
*
* The following lists the names, descriptions, and values of the special request parameters that the
* Subscribe
action uses:
*
*
*
*
* DeliveryPolicy
– The policy that defines how Amazon SNS retries failed deliveries to HTTP/S
* endpoints.
*
*
*
*
* FilterPolicy
– The simple JSON object that lets your subscriber receive only a subset of
* messages, rather than receiving every message published to the topic.
*
*
*
*
* FilterPolicyScope
– This attribute lets you choose the filtering scope by using one of the
* following string value types:
*
*
*
*
*
* RawMessageDelivery
– When set to true
, enables raw message delivery to Amazon
* SQS or HTTP/S endpoints. This eliminates the need for the endpoints to process JSON formatting, which is
* otherwise created for Amazon SNS metadata.
*
*
*
*
* RedrivePolicy
– When specified, sends undeliverable messages to the specified Amazon SQS
* dead-letter queue. Messages that can't be delivered due to client errors (for example, when the
* subscribed endpoint is unreachable) or server errors (for example, when the service that powers the
* subscribed endpoint becomes unavailable) are held in the dead-letter queue for further analysis or
* reprocessing.
*
*
*
*
* The following attribute applies only to Amazon Data Firehose delivery stream subscriptions:
*
*
*
*
* SubscriptionRoleArn
– The ARN of the IAM role that has the following:
*
*
*
* Specifying a valid ARN for this attribute is required for Firehose delivery stream subscriptions. For
* more information, see Fanout to Firehose
* delivery streams in the Amazon SNS Developer Guide .
*
*
*
*
* The following attributes apply only to FIFO topics :
*
*
*
*
* ReplayPolicy
– Adds or updates an inline policy document for a subscription to replay
* messages stored in the specified Amazon SNS topic.
*
*
*
*
* ReplayStatus
– Retrieves the status of the subscription message replay, which can be one of
* the following:
*
*
*
*
* Completed
– The replay has successfully redelivered all messages, and is now delivering
* newly published messages. If an ending point was specified in the ReplayPolicy
then the
* subscription will no longer receive newly published messages.
*
*
*
*
* In progress
– The replay is currently replaying the selected messages.
*
*
*
*
* Failed
– The replay was unable to complete.
*
*
*
*
* Pending
– The default state while the replay initiates.
*
*
*
*
*/
public final Map attributes() {
return attributes;
}
/**
*
* Sets whether the response from the Subscribe
request includes the subscription ARN, even if the
* subscription is not yet confirmed.
*
*
* If you set this parameter to true
, the response includes the ARN in all cases, even if the
* subscription is not yet confirmed. In addition to the ARN for confirmed subscriptions, the response also includes
* the pending subscription
ARN value for subscriptions that aren't yet confirmed. A subscription
* becomes confirmed when the subscriber calls the ConfirmSubscription
action with a confirmation
* token.
*
*
*
* The default value is false
.
*
*
* @return Sets whether the response from the Subscribe
request includes the subscription ARN, even if
* the subscription is not yet confirmed.
*
* If you set this parameter to true
, the response includes the ARN in all cases, even if the
* subscription is not yet confirmed. In addition to the ARN for confirmed subscriptions, the response also
* includes the pending subscription
ARN value for subscriptions that aren't yet confirmed. A
* subscription becomes confirmed when the subscriber calls the ConfirmSubscription
action with
* a confirmation token.
*
*
*
* The default value is false
.
*/
public final Boolean returnSubscriptionArn() {
return returnSubscriptionArn;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(topicArn());
hashCode = 31 * hashCode + Objects.hashCode(protocol());
hashCode = 31 * hashCode + Objects.hashCode(endpoint());
hashCode = 31 * hashCode + Objects.hashCode(hasAttributes() ? attributes() : null);
hashCode = 31 * hashCode + Objects.hashCode(returnSubscriptionArn());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof SubscribeRequest)) {
return false;
}
SubscribeRequest other = (SubscribeRequest) obj;
return Objects.equals(topicArn(), other.topicArn()) && Objects.equals(protocol(), other.protocol())
&& Objects.equals(endpoint(), other.endpoint()) && hasAttributes() == other.hasAttributes()
&& Objects.equals(attributes(), other.attributes())
&& Objects.equals(returnSubscriptionArn(), other.returnSubscriptionArn());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("SubscribeRequest").add("TopicArn", topicArn()).add("Protocol", protocol())
.add("Endpoint", endpoint()).add("Attributes", hasAttributes() ? attributes() : null)
.add("ReturnSubscriptionArn", returnSubscriptionArn()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "TopicArn":
return Optional.ofNullable(clazz.cast(topicArn()));
case "Protocol":
return Optional.ofNullable(clazz.cast(protocol()));
case "Endpoint":
return Optional.ofNullable(clazz.cast(endpoint()));
case "Attributes":
return Optional.ofNullable(clazz.cast(attributes()));
case "ReturnSubscriptionArn":
return Optional.ofNullable(clazz.cast(returnSubscriptionArn()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((SubscribeRequest) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SnsRequest.Builder, SdkPojo, CopyableBuilder {
/**
*
* The ARN of the topic you want to subscribe to.
*
*
* @param topicArn
* The ARN of the topic you want to subscribe to.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder topicArn(String topicArn);
/**
*
* The protocol that you want to use. Supported protocols include:
*
*
*
*
* http
– delivery of JSON-encoded message via HTTP POST
*
*
*
*
* https
– delivery of JSON-encoded message via HTTPS POST
*
*
*
*
* email
– delivery of message via SMTP
*
*
*
*
* email-json
– delivery of JSON-encoded message via SMTP
*
*
*
*
* sms
– delivery of message via SMS
*
*
*
*
* sqs
– delivery of JSON-encoded message to an Amazon SQS queue
*
*
*
*
* application
– delivery of JSON-encoded message to an EndpointArn for a mobile app and device
*
*
*
*
* lambda
– delivery of JSON-encoded message to an Lambda function
*
*
*
*
* firehose
– delivery of JSON-encoded message to an Amazon Kinesis Data Firehose delivery stream.
*
*
*
*
* @param protocol
* The protocol that you want to use. Supported protocols include:
*
*
*
* http
– delivery of JSON-encoded message via HTTP POST
*
*
*
*
* https
– delivery of JSON-encoded message via HTTPS POST
*
*
*
*
* email
– delivery of message via SMTP
*
*
*
*
* email-json
– delivery of JSON-encoded message via SMTP
*
*
*
*
* sms
– delivery of message via SMS
*
*
*
*
* sqs
– delivery of JSON-encoded message to an Amazon SQS queue
*
*
*
*
* application
– delivery of JSON-encoded message to an EndpointArn for a mobile app and
* device
*
*
*
*
* lambda
– delivery of JSON-encoded message to an Lambda function
*
*
*
*
* firehose
– delivery of JSON-encoded message to an Amazon Kinesis Data Firehose delivery
* stream.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder protocol(String protocol);
/**
*
* The endpoint that you want to receive notifications. Endpoints vary by protocol:
*
*
*
*
* For the http
protocol, the (public) endpoint is a URL beginning with http://
.
*
*
*
*
* For the https
protocol, the (public) endpoint is a URL beginning with https://
.
*
*
*
*
* For the email
protocol, the endpoint is an email address.
*
*
*
*
* For the email-json
protocol, the endpoint is an email address.
*
*
*
*
* For the sms
protocol, the endpoint is a phone number of an SMS-enabled device.
*
*
*
*
* For the sqs
protocol, the endpoint is the ARN of an Amazon SQS queue.
*
*
*
*
* For the application
protocol, the endpoint is the EndpointArn of a mobile app and device.
*
*
*
*
* For the lambda
protocol, the endpoint is the ARN of an Lambda function.
*
*
*
*
* For the firehose
protocol, the endpoint is the ARN of an Amazon Kinesis Data Firehose delivery
* stream.
*
*
*
*
* @param endpoint
* The endpoint that you want to receive notifications. Endpoints vary by protocol:
*
*
*
* For the http
protocol, the (public) endpoint is a URL beginning with http://
* .
*
*
*
*
* For the https
protocol, the (public) endpoint is a URL beginning with
* https://
.
*
*
*
*
* For the email
protocol, the endpoint is an email address.
*
*
*
*
* For the email-json
protocol, the endpoint is an email address.
*
*
*
*
* For the sms
protocol, the endpoint is a phone number of an SMS-enabled device.
*
*
*
*
* For the sqs
protocol, the endpoint is the ARN of an Amazon SQS queue.
*
*
*
*
* For the application
protocol, the endpoint is the EndpointArn of a mobile app and device.
*
*
*
*
* For the lambda
protocol, the endpoint is the ARN of an Lambda function.
*
*
*
*
* For the firehose
protocol, the endpoint is the ARN of an Amazon Kinesis Data Firehose
* delivery stream.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder endpoint(String endpoint);
/**
*
* A map of attributes with their corresponding values.
*
*
* The following lists the names, descriptions, and values of the special request parameters that the
* Subscribe
action uses:
*
*
*
*
* DeliveryPolicy
– The policy that defines how Amazon SNS retries failed deliveries to HTTP/S
* endpoints.
*
*
*
*
* FilterPolicy
– The simple JSON object that lets your subscriber receive only a subset of
* messages, rather than receiving every message published to the topic.
*
*
*
*
* FilterPolicyScope
– This attribute lets you choose the filtering scope by using one of the
* following string value types:
*
*
*
*
*
* RawMessageDelivery
– When set to true
, enables raw message delivery to Amazon SQS
* or HTTP/S endpoints. This eliminates the need for the endpoints to process JSON formatting, which is
* otherwise created for Amazon SNS metadata.
*
*
*
*
* RedrivePolicy
– When specified, sends undeliverable messages to the specified Amazon SQS
* dead-letter queue. Messages that can't be delivered due to client errors (for example, when the subscribed
* endpoint is unreachable) or server errors (for example, when the service that powers the subscribed endpoint
* becomes unavailable) are held in the dead-letter queue for further analysis or reprocessing.
*
*
*
*
* The following attribute applies only to Amazon Data Firehose delivery stream subscriptions:
*
*
*
*
* SubscriptionRoleArn
– The ARN of the IAM role that has the following:
*
*
*
* Specifying a valid ARN for this attribute is required for Firehose delivery stream subscriptions. For more
* information, see Fanout
* to Firehose delivery streams in the Amazon SNS Developer Guide .
*
*
*
*
* The following attributes apply only to FIFO topics :
*
*
*
*
* ReplayPolicy
– Adds or updates an inline policy document for a subscription to replay messages
* stored in the specified Amazon SNS topic.
*
*
*
*
* ReplayStatus
– Retrieves the status of the subscription message replay, which can be one of the
* following:
*
*
*
*
* Completed
– The replay has successfully redelivered all messages, and is now delivering newly
* published messages. If an ending point was specified in the ReplayPolicy
then the subscription
* will no longer receive newly published messages.
*
*
*
*
* In progress
– The replay is currently replaying the selected messages.
*
*
*
*
* Failed
– The replay was unable to complete.
*
*
*
*
* Pending
– The default state while the replay initiates.
*
*
*
*
*
*
* @param attributes
* A map of attributes with their corresponding values.
*
* The following lists the names, descriptions, and values of the special request parameters that the
* Subscribe
action uses:
*
*
*
*
* DeliveryPolicy
– The policy that defines how Amazon SNS retries failed deliveries to
* HTTP/S endpoints.
*
*
*
*
* FilterPolicy
– The simple JSON object that lets your subscriber receive only a subset of
* messages, rather than receiving every message published to the topic.
*
*
*
*
* FilterPolicyScope
– This attribute lets you choose the filtering scope by using one of
* the following string value types:
*
*
*
*
*
* RawMessageDelivery
– When set to true
, enables raw message delivery to
* Amazon SQS or HTTP/S endpoints. This eliminates the need for the endpoints to process JSON formatting,
* which is otherwise created for Amazon SNS metadata.
*
*
*
*
* RedrivePolicy
– When specified, sends undeliverable messages to the specified Amazon SQS
* dead-letter queue. Messages that can't be delivered due to client errors (for example, when the
* subscribed endpoint is unreachable) or server errors (for example, when the service that powers the
* subscribed endpoint becomes unavailable) are held in the dead-letter queue for further analysis or
* reprocessing.
*
*
*
*
* The following attribute applies only to Amazon Data Firehose delivery stream subscriptions:
*
*
*
*
* SubscriptionRoleArn
– The ARN of the IAM role that has the following:
*
*
*
* Specifying a valid ARN for this attribute is required for Firehose delivery stream subscriptions. For
* more information, see Fanout to Firehose
* delivery streams in the Amazon SNS Developer Guide .
*
*
*
*
* The following attributes apply only to FIFO topics :
*
*
*
*
* ReplayPolicy
– Adds or updates an inline policy document for a subscription to replay
* messages stored in the specified Amazon SNS topic.
*
*
*
*
* ReplayStatus
– Retrieves the status of the subscription message replay, which can be one
* of the following:
*
*
*
*
* Completed
– The replay has successfully redelivered all messages, and is now delivering
* newly published messages. If an ending point was specified in the ReplayPolicy
then the
* subscription will no longer receive newly published messages.
*
*
*
*
* In progress
– The replay is currently replaying the selected messages.
*
*
*
*
* Failed
– The replay was unable to complete.
*
*
*
*
* Pending
– The default state while the replay initiates.
*
*
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder attributes(Map attributes);
/**
*
* Sets whether the response from the Subscribe
request includes the subscription ARN, even if the
* subscription is not yet confirmed.
*
*
* If you set this parameter to true
, the response includes the ARN in all cases, even if the
* subscription is not yet confirmed. In addition to the ARN for confirmed subscriptions, the response also
* includes the pending subscription
ARN value for subscriptions that aren't yet confirmed. A
* subscription becomes confirmed when the subscriber calls the ConfirmSubscription
action with a
* confirmation token.
*
*
*
* The default value is false
.
*
*
* @param returnSubscriptionArn
* Sets whether the response from the Subscribe
request includes the subscription ARN, even
* if the subscription is not yet confirmed.
*
* If you set this parameter to true
, the response includes the ARN in all cases, even if
* the subscription is not yet confirmed. In addition to the ARN for confirmed subscriptions, the
* response also includes the pending subscription
ARN value for subscriptions that aren't
* yet confirmed. A subscription becomes confirmed when the subscriber calls the
* ConfirmSubscription
action with a confirmation token.
*
*
*
* The default value is false
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder returnSubscriptionArn(Boolean returnSubscriptionArn);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends SnsRequest.BuilderImpl implements Builder {
private String topicArn;
private String protocol;
private String endpoint;
private Map attributes = DefaultSdkAutoConstructMap.getInstance();
private Boolean returnSubscriptionArn;
private BuilderImpl() {
}
private BuilderImpl(SubscribeRequest model) {
super(model);
topicArn(model.topicArn);
protocol(model.protocol);
endpoint(model.endpoint);
attributes(model.attributes);
returnSubscriptionArn(model.returnSubscriptionArn);
}
public final String getTopicArn() {
return topicArn;
}
public final void setTopicArn(String topicArn) {
this.topicArn = topicArn;
}
@Override
public final Builder topicArn(String topicArn) {
this.topicArn = topicArn;
return this;
}
public final String getProtocol() {
return protocol;
}
public final void setProtocol(String protocol) {
this.protocol = protocol;
}
@Override
public final Builder protocol(String protocol) {
this.protocol = protocol;
return this;
}
public final String getEndpoint() {
return endpoint;
}
public final void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
@Override
public final Builder endpoint(String endpoint) {
this.endpoint = endpoint;
return this;
}
public final Map getAttributes() {
if (attributes instanceof SdkAutoConstructMap) {
return null;
}
return attributes;
}
public final void setAttributes(Map attributes) {
this.attributes = SubscriptionAttributesMapCopier.copy(attributes);
}
@Override
public final Builder attributes(Map attributes) {
this.attributes = SubscriptionAttributesMapCopier.copy(attributes);
return this;
}
public final Boolean getReturnSubscriptionArn() {
return returnSubscriptionArn;
}
public final void setReturnSubscriptionArn(Boolean returnSubscriptionArn) {
this.returnSubscriptionArn = returnSubscriptionArn;
}
@Override
public final Builder returnSubscriptionArn(Boolean returnSubscriptionArn) {
this.returnSubscriptionArn = returnSubscriptionArn;
return this;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public SubscribeRequest build() {
return new SubscribeRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}