attributes = new HashMap<>(publishRequest.messageAttributes());
+ publishRequestBuilder.messageAttributes(attributes);
+ return publishRequestBuilder.build();
}
}
diff --git a/src/main/java/software/amazon/sns/AmazonSNSExtendedClientBase.java b/src/main/java/software/amazon/sns/AmazonSNSExtendedClientBase.java
index 4326530..c0817ba 100644
--- a/src/main/java/software/amazon/sns/AmazonSNSExtendedClientBase.java
+++ b/src/main/java/software/amazon/sns/AmazonSNSExtendedClientBase.java
@@ -1,98 +1,52 @@
package software.amazon.sns;
-import com.amazonaws.AmazonWebServiceRequest;
-import com.amazonaws.ClientConfiguration;
-import com.amazonaws.ResponseMetadata;
-import com.amazonaws.auth.AWSCredentialsProvider;
-import com.amazonaws.client.builder.AwsClientBuilder;
-import com.amazonaws.regions.Region;
-import com.amazonaws.regions.Regions;
-import com.amazonaws.services.sns.AmazonSNS;
-import com.amazonaws.services.sns.model.*;
+import java.util.function.Consumer;
-import java.util.List;
+import software.amazon.awssdk.awscore.exception.AwsServiceException;
+import software.amazon.awssdk.core.exception.*;
+import software.amazon.awssdk.services.sns.SnsClient;
+import software.amazon.awssdk.services.sns.model.*;
+import software.amazon.awssdk.services.sns.paginators.ListEndpointsByPlatformApplicationIterable;
+import software.amazon.awssdk.services.sns.paginators.ListPlatformApplicationsIterable;
+import software.amazon.awssdk.services.sns.paginators.ListSubscriptionsByTopicIterable;
+import software.amazon.awssdk.services.sns.paginators.ListSubscriptionsIterable;
+import software.amazon.awssdk.services.sns.paginators.ListTopicsIterable;
-abstract class AmazonSNSExtendedClientBase implements AmazonSNS {
- private final AmazonSNS amazonSNSToBeExtended;
+abstract class AmazonSNSExtendedClientBase implements SnsClient {
+ private final SnsClient snsClientToBeExtended;
- public AmazonSNSExtendedClientBase(AmazonSNS amazonSNSToBeExtended) {
- this.amazonSNSToBeExtended = amazonSNSToBeExtended;
+ public AmazonSNSExtendedClientBase(SnsClient snsClientToBeExtended) {
+ this.snsClientToBeExtended = snsClientToBeExtended;
}
/**
*
* Retrieves the endpoint attributes for a device on one of the supported push notification services, such as GCM
- * and APNS. For more information, see Using
- * Amazon SNS Mobile Push Notifications.
+ * (Firebase Cloud Messaging) and APNS. For more information, see Using Amazon SNS Mobile Push
+ * Notifications.
*
*
- * @param getEndpointAttributesRequest Input for GetEndpointAttributes action.
+ * @param getEndpointAttributesRequest
+ * Input for GetEndpointAttributes action.
* @return Result of the GetEndpointAttributes operation returned by the service.
* @throws InvalidParameterException Indicates that a request parameter does not comply with the associated constraints.
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
* @throws NotFoundException Indicates that the requested resource does not exist.
- * @sample AmazonSNS.GetEndpointAttributes
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.GetEndpointAttributes
* @see AWS API
* Documentation
*/
@Override
- public GetEndpointAttributesResult getEndpointAttributes(GetEndpointAttributesRequest getEndpointAttributesRequest) {
- return amazonSNSToBeExtended.getEndpointAttributes(getEndpointAttributesRequest);
- }
-
- /**
- * Overrides the default endpoint for this client ("https://sns.us-east-1.amazonaws.com"). Callers can use this
- * method to control which AWS region they want to work with.
- *
- * Callers can pass in just the endpoint (ex: "sns.us-east-1.amazonaws.com") or a full URL, including the protocol
- * (ex: "https://sns.us-east-1.amazonaws.com"). If the protocol is not specified here, the default protocol from
- * this client's {@link ClientConfiguration} will be used, which by default is HTTPS.
- *
- * For more information on using AWS regions with the AWS SDK for Java, and a complete list of all available
- * endpoints for all AWS services, see:
- * http://developer.amazonwebservices.com/connect/entry.jspa?externalID=3912
- *
- * This method is not threadsafe. An endpoint should be configured when the client is created and before any
- * service requests are made. Changing it afterwards creates inevitable race conditions for any service requests in
- * transit or retrying.
- *
- * @param endpoint The endpoint (ex: "sns.us-east-1.amazonaws.com") or a full URL, including the protocol (ex:
- * "https://sns.us-east-1.amazonaws.com") of the region specific AWS endpoint this client will communicate
- * with.
- * @deprecated use {@link AwsClientBuilder#setEndpointConfiguration(AwsClientBuilder.EndpointConfiguration)} for
- * example:
- * {@code builder.setEndpointConfiguration(new EndpointConfiguration(endpoint, signingRegion));}
- */
- @Override
- @Deprecated
- public void setEndpoint(String endpoint) {
- amazonSNSToBeExtended.setEndpoint(endpoint);
- }
-
- /**
- * An alternative to {@link AmazonSNS#setEndpoint(String)}, sets the regional endpoint for this client's service
- * calls. Callers can use this method to control which AWS region they want to work with.
- *
- * By default, all service endpoints in all regions use the https protocol. To use http instead, specify it in the
- * {@link ClientConfiguration} supplied at construction.
- *
- * This method is not threadsafe. A region should be configured when the client is created and before any service
- * requests are made. Changing it afterwards creates inevitable race conditions for any service requests in transit
- * or retrying.
- *
- * @param region The region this client will communicate with. See {@link Region#getRegion(Regions)}
- * for accessing a given region. Must not be null and must be a region where the service is available.
- * @see Region#getRegion(Regions)
- * @see Region#createClient(Class, AWSCredentialsProvider, ClientConfiguration)
- * @see Region#isServiceSupported(String)
- * @deprecated use {@link AwsClientBuilder#setRegion(String)}
- */
- @Override
- @Deprecated
- public void setRegion(Region region) {
- amazonSNSToBeExtended.setRegion(region);
+ public GetEndpointAttributesResponse getEndpointAttributes(GetEndpointAttributesRequest getEndpointAttributesRequest)
+ throws InvalidParameterException, InternalErrorException, AuthorizationErrorException, NotFoundException,
+ AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.getEndpointAttributes(getEndpointAttributesRequest);
}
/**
@@ -107,27 +61,19 @@ public void setRegion(Region region) {
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
* @throws NotFoundException Indicates that the requested resource does not exist.
- * @sample AmazonSNS.AddPermission
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.AddPermission
* @see AWS API
* Documentation
*/
@Override
- public AddPermissionResult addPermission(AddPermissionRequest addPermissionRequest) {
- return amazonSNSToBeExtended.addPermission(addPermissionRequest);
- }
-
- /**
- * Simplified method form for invoking the AddPermission operation.
- *
- * @param topicArn
- * @param label
- * @param aWSAccountIds
- * @param actionNames
- * @see #addPermission(AddPermissionRequest)
- */
- @Override
- public AddPermissionResult addPermission(String topicArn, String label, List aWSAccountIds, List actionNames) {
- return amazonSNSToBeExtended.addPermission(topicArn, label, aWSAccountIds, actionNames);
+ public AddPermissionResponse addPermission(AddPermissionRequest addPermissionRequest) throws InvalidParameterException,
+ InternalErrorException, AuthorizationErrorException, NotFoundException, AwsServiceException, SdkClientException,
+ SnsException {
+ return snsClientToBeExtended.addPermission(addPermissionRequest);
}
/**
@@ -146,13 +92,19 @@ public AddPermissionResult addPermission(String topicArn, String label, ListAWS API Documentation
*/
@Override
- public CheckIfPhoneNumberIsOptedOutResult checkIfPhoneNumberIsOptedOut(CheckIfPhoneNumberIsOptedOutRequest checkIfPhoneNumberIsOptedOutRequest) {
- return amazonSNSToBeExtended.checkIfPhoneNumberIsOptedOut(checkIfPhoneNumberIsOptedOutRequest);
+ public CheckIfPhoneNumberIsOptedOutResponse checkIfPhoneNumberIsOptedOut(CheckIfPhoneNumberIsOptedOutRequest checkIfPhoneNumberIsOptedOutRequest) throws ThrottledException,
+ InternalErrorException, AuthorizationErrorException, InvalidParameterException, AwsServiceException,
+ SdkClientException, SnsException {
+ return snsClientToBeExtended.checkIfPhoneNumberIsOptedOut(checkIfPhoneNumberIsOptedOutRequest);
}
/**
@@ -170,67 +122,75 @@ public CheckIfPhoneNumberIsOptedOutResult checkIfPhoneNumberIsOptedOut(CheckIfPh
* @throws NotFoundException Indicates that the requested resource does not exist.
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
- * @sample AmazonSNS.ConfirmSubscription
+ * @throws FilterPolicyLimitExceededException Indicates that the number of filter polices in your AWS account exceeds the limit. To add more filter
+ * polices, submit an SNS Limit Increase case in the AWS Support Center.
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.ConfirmSubscription
* @see AWS API
* Documentation
*/
@Override
- public ConfirmSubscriptionResult confirmSubscription(ConfirmSubscriptionRequest confirmSubscriptionRequest) {
- return amazonSNSToBeExtended.confirmSubscription(confirmSubscriptionRequest);
- }
-
- /**
- * Simplified method form for invoking the ConfirmSubscription operation.
- *
- * @param topicArn
- * @param token
- * @param authenticateOnUnsubscribe
- * @see #confirmSubscription(ConfirmSubscriptionRequest)
- */
- @Override
- public ConfirmSubscriptionResult confirmSubscription(String topicArn, String token, String authenticateOnUnsubscribe) {
- return amazonSNSToBeExtended.confirmSubscription(topicArn, token, authenticateOnUnsubscribe);
- }
-
- /**
- * Simplified method form for invoking the ConfirmSubscription operation.
- *
- * @param topicArn
- * @param token
- * @see #confirmSubscription(ConfirmSubscriptionRequest)
- */
- @Override
- public ConfirmSubscriptionResult confirmSubscription(String topicArn, String token) {
- return amazonSNSToBeExtended.confirmSubscription(topicArn, token);
+ public ConfirmSubscriptionResponse confirmSubscription(ConfirmSubscriptionRequest confirmSubscriptionRequest)
+ throws SubscriptionLimitExceededException, InvalidParameterException, NotFoundException, InternalErrorException,
+ AuthorizationErrorException, FilterPolicyLimitExceededException, AwsServiceException, SdkClientException,
+ SnsException {
+ return snsClientToBeExtended.confirmSubscription(confirmSubscriptionRequest);
}
/**
*
- * Creates a platform application object for one of the supported push notification services, such as APNS and GCM,
- * to which devices and mobile apps may register. You must specify PlatformPrincipal and PlatformCredential
- * attributes when using the CreatePlatformApplication
action. The PlatformPrincipal is received from
- * the notification service. For APNS/APNS_SANDBOX, PlatformPrincipal is "SSL certificate". For GCM,
- * PlatformPrincipal is not applicable. For ADM, PlatformPrincipal is "client id". The PlatformCredential is also
- * received from the notification service. For WNS, PlatformPrincipal is "Package Security Identifier". For MPNS,
- * PlatformPrincipal is "TLS certificate". For Baidu, PlatformPrincipal is "API key".
+ * Creates a platform application object for one of the supported push notification services, such as APNS and GCM
+ * (Firebase Cloud Messaging), to which devices and mobile apps may register. You must specify
+ * PlatformPrincipal
and PlatformCredential
attributes when using the
+ * CreatePlatformApplication
action.
*
*
- * For APNS/APNS_SANDBOX, PlatformCredential is "private key". For GCM, PlatformCredential is "API key". For ADM,
- * PlatformCredential is "client secret". For WNS, PlatformCredential is "secret key". For MPNS, PlatformCredential
- * is "private key". For Baidu, PlatformCredential is "secret key". The PlatformApplicationArn that is returned when
- * using CreatePlatformApplication
is then used as an attribute for the
- * CreatePlatformEndpoint
action. For more information, see Using Amazon SNS Mobile Push
- * Notifications. For more information about obtaining the PlatformPrincipal and PlatformCredential for each of
- * the supported push notification services, see Getting Started with Apple Push
- * Notification Service, Getting Started
- * with Amazon Device Messaging, Getting Started with Baidu Cloud Push,
- * Getting Started with Google Cloud
- * Messaging for Android, Getting
- * Started with MPNS, or Getting Started
- * with WNS.
+ * PlatformPrincipal
and PlatformCredential
are received from the notification service.
+ *
+ *
+ * -
+ *
+ * For ADM
, PlatformPrincipal
is client id
and
+ * PlatformCredential
is client secret
.
+ *
+ *
+ * -
+ *
+ * For Baidu
, PlatformPrincipal
is API key
and
+ * PlatformCredential
is secret key
.
+ *
+ *
+ * -
+ *
+ * For APNS
and APNS_SANDBOX
, PlatformPrincipal
is
+ * SSL certificate
and PlatformCredential
is private key
.
+ *
+ *
+ * -
+ *
+ * For GCM
(Firebase Cloud Messaging), there is no PlatformPrincipal
and the
+ * PlatformCredential
is API key
.
+ *
+ *
+ * -
+ *
+ * For MPNS
, PlatformPrincipal
is TLS certificate
and
+ * PlatformCredential
is private key
.
+ *
+ *
+ * -
+ *
+ * For WNS
, PlatformPrincipal
is Package Security Identifier
and
+ * PlatformCredential
is secret key
.
+ *
+ *
+ *
+ *
+ * You can use the returned PlatformApplicationArn
as an attribute for the
+ * CreatePlatformEndpoint
action.
*
*
* @param createPlatformApplicationRequest Input for CreatePlatformApplication action.
@@ -238,31 +198,36 @@ public ConfirmSubscriptionResult confirmSubscription(String topicArn, String tok
* @throws InvalidParameterException Indicates that a request parameter does not comply with the associated constraints.
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
- * @sample AmazonSNS.CreatePlatformApplication
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.CreatePlatformApplication
* @see AWS
* API Documentation
*/
@Override
- public CreatePlatformApplicationResult createPlatformApplication(CreatePlatformApplicationRequest createPlatformApplicationRequest) {
- return amazonSNSToBeExtended.createPlatformApplication(createPlatformApplicationRequest);
+ public CreatePlatformApplicationResponse createPlatformApplication(CreatePlatformApplicationRequest createPlatformApplicationRequest) throws InvalidParameterException,
+ InternalErrorException, AuthorizationErrorException, AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.createPlatformApplication(createPlatformApplicationRequest);
}
/**
*
* Creates an endpoint for a device and mobile app on one of the supported push notification services, such as GCM
- * and APNS. CreatePlatformEndpoint
requires the PlatformApplicationArn that is returned from
- * CreatePlatformApplication
. The EndpointArn that is returned when using
- * CreatePlatformEndpoint
can then be used by the Publish
action to send a message to a
- * mobile app or by the Subscribe
action for subscription to a topic. The
- * CreatePlatformEndpoint
action is idempotent, so if the requester already owns an endpoint with the
- * same device token and attributes, that endpoint's ARN is returned without creating a new endpoint. For more
- * information, see Using Amazon SNS Mobile
- * Push Notifications.
+ * (Firebase Cloud Messaging) and APNS. CreatePlatformEndpoint
requires the
+ * PlatformApplicationArn
that is returned from CreatePlatformApplication
. You can use the
+ * returned EndpointArn
to send a message to a mobile app or by the Subscribe
action for
+ * subscription to a topic. The CreatePlatformEndpoint
action is idempotent, so if the requester
+ * already owns an endpoint with the same device token and attributes, that endpoint's ARN is returned without
+ * creating a new endpoint. For more information, see Using Amazon SNS Mobile Push
+ * Notifications.
*
*
* When using CreatePlatformEndpoint
with Baidu, two attributes must be provided: ChannelId and UserId.
* The token field must also contain the ChannelId. For more information, see Creating an Amazon SNS Endpoint
+ * href="https://docs.aws.amazon.com/sns/latest/dg/SNSMobilePushBaiduEndpoint.html">Creating an Amazon SNS Endpoint
* for Baidu.
*
*
@@ -272,19 +237,25 @@ public CreatePlatformApplicationResult createPlatformApplication(CreatePlatformA
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
* @throws NotFoundException Indicates that the requested resource does not exist.
- * @sample AmazonSNS.CreatePlatformEndpoint
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.CreatePlatformEndpoint
* @see AWS API
* Documentation
*/
@Override
- public CreatePlatformEndpointResult createPlatformEndpoint(CreatePlatformEndpointRequest createPlatformEndpointRequest) {
- return amazonSNSToBeExtended.createPlatformEndpoint(createPlatformEndpointRequest);
+ public CreatePlatformEndpointResponse createPlatformEndpoint(CreatePlatformEndpointRequest createPlatformEndpointRequest)
+ throws InvalidParameterException, InternalErrorException, AuthorizationErrorException, NotFoundException,
+ AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.createPlatformEndpoint(createPlatformEndpointRequest);
}
/**
*
* Creates a topic to which notifications can be published. Users can create at most 100,000 topics. For more
- * information, see http://aws.amazon.com/sns. This action is idempotent,
+ * information, see https://aws.amazon.com/sns. This action is idempotent,
* so if the requester already owns a topic with the specified name, that topic's ARN is returned without creating a
* new topic.
*
@@ -295,30 +266,33 @@ public CreatePlatformEndpointResult createPlatformEndpoint(CreatePlatformEndpoin
* @throws TopicLimitExceededException Indicates that the customer already owns the maximum allowed number of topics.
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
- * @sample AmazonSNS.CreateTopic
+ * @throws InvalidSecurityException The credential signature isn't valid. You must use an HTTPS endpoint and sign your request using
+ * Signature Version 4.
+ * @throws TagLimitExceededException Can't add more than 50 tags to a topic.
+ * @throws StaleTagException A tag has been added to a resource with the same ARN as a deleted resource. Wait a short while and then
+ * retry the operation.
+ * @throws TagPolicyException The request doesn't comply with the IAM tag policy. Correct your request and then retry it.
+ * @throws ConcurrentAccessException Can't perform multiple operations on a tag simultaneously. Perform the operations sequentially.
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.CreateTopic
* @see AWS API
* Documentation
*/
@Override
- public CreateTopicResult createTopic(CreateTopicRequest createTopicRequest) {
- return amazonSNSToBeExtended.createTopic(createTopicRequest);
- }
-
- /**
- * Simplified method form for invoking the CreateTopic operation.
- *
- * @param name
- * @see #createTopic(CreateTopicRequest)
- */
- @Override
- public CreateTopicResult createTopic(String name) {
- return amazonSNSToBeExtended.createTopic(name);
+ public CreateTopicResponse createTopic(CreateTopicRequest createTopicRequest) throws InvalidParameterException,
+ TopicLimitExceededException, InternalErrorException, AuthorizationErrorException, InvalidSecurityException,
+ TagLimitExceededException, StaleTagException, TagPolicyException, ConcurrentAccessException, AwsServiceException,
+ SdkClientException, SnsException {
+ return snsClientToBeExtended.createTopic(createTopicRequest);
}
/**
*
* Deletes the endpoint for a device and mobile app from Amazon SNS. This action is idempotent. For more
- * information, see Using Amazon SNS Mobile
+ * information, see Using Amazon SNS Mobile
* Push Notifications.
*
*
@@ -331,20 +305,26 @@ public CreateTopicResult createTopic(String name) {
* @throws InvalidParameterException Indicates that a request parameter does not comply with the associated constraints.
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
- * @sample AmazonSNS.DeleteEndpoint
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.DeleteEndpoint
* @see AWS API
* Documentation
*/
@Override
- public DeleteEndpointResult deleteEndpoint(DeleteEndpointRequest deleteEndpointRequest) {
- return amazonSNSToBeExtended.deleteEndpoint(deleteEndpointRequest);
+ public DeleteEndpointResponse deleteEndpoint(DeleteEndpointRequest deleteEndpointRequest) throws InvalidParameterException,
+ InternalErrorException, AuthorizationErrorException, AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.deleteEndpoint(deleteEndpointRequest);
}
/**
*
- * Deletes a platform application object for one of the supported push notification services, such as APNS and GCM.
- * For more information, see Using Amazon SNS
- * Mobile Push Notifications.
+ * Deletes a platform application object for one of the supported push notification services, such as APNS and GCM
+ * (Firebase Cloud Messaging). For more information, see Using Amazon SNS Mobile Push
+ * Notifications.
*
*
* @param deletePlatformApplicationRequest Input for DeletePlatformApplication action.
@@ -352,13 +332,19 @@ public DeleteEndpointResult deleteEndpoint(DeleteEndpointRequest deleteEndpointR
* @throws InvalidParameterException Indicates that a request parameter does not comply with the associated constraints.
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
- * @sample AmazonSNS.DeletePlatformApplication
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.DeletePlatformApplication
* @see AWS
* API Documentation
*/
@Override
- public DeletePlatformApplicationResult deletePlatformApplication(DeletePlatformApplicationRequest deletePlatformApplicationRequest) {
- return amazonSNSToBeExtended.deletePlatformApplication(deletePlatformApplicationRequest);
+ public DeletePlatformApplicationResponse deletePlatformApplication(
+ DeletePlatformApplicationRequest deletePlatformApplicationRequest) throws InvalidParameterException,
+ InternalErrorException, AuthorizationErrorException, AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.deletePlatformApplication(deletePlatformApplicationRequest);
}
/**
@@ -374,24 +360,23 @@ public DeletePlatformApplicationResult deletePlatformApplication(DeletePlatformA
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
* @throws NotFoundException Indicates that the requested resource does not exist.
- * @sample AmazonSNS.DeleteTopic
+ * @throws StaleTagException A tag has been added to a resource with the same ARN as a deleted resource. Wait a short while and then
+ * retry the operation.
+ * @throws TagPolicyException The request doesn't comply with the IAM tag policy. Correct your request and then retry it.
+ * @throws ConcurrentAccessException Can't perform multiple operations on a tag simultaneously. Perform the operations sequentially.
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.DeleteTopic
* @see AWS API
* Documentation
*/
@Override
- public DeleteTopicResult deleteTopic(DeleteTopicRequest deleteTopicRequest) {
- return amazonSNSToBeExtended.deleteTopic(deleteTopicRequest);
- }
-
- /**
- * Simplified method form for invoking the DeleteTopic operation.
- *
- * @param topicArn
- * @see #deleteTopic(DeleteTopicRequest)
- */
- @Override
- public DeleteTopicResult deleteTopic(String topicArn) {
- return amazonSNSToBeExtended.deleteTopic(topicArn);
+ public DeleteTopicResponse deleteTopic(DeleteTopicRequest deleteTopicRequest) throws InvalidParameterException,
+ InternalErrorException, AuthorizationErrorException, NotFoundException, StaleTagException, TagPolicyException,
+ ConcurrentAccessException, AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.deleteTopic(deleteTopicRequest);
}
/**
@@ -408,13 +393,20 @@ public DeleteTopicResult deleteTopic(String topicArn) {
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
* @throws NotFoundException Indicates that the requested resource does not exist.
- * @sample AmazonSNS.GetPlatformApplicationAttributes
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.GetPlatformApplicationAttributes
* @see AWS API Documentation
*/
@Override
- public GetPlatformApplicationAttributesResult getPlatformApplicationAttributes(GetPlatformApplicationAttributesRequest getPlatformApplicationAttributesRequest) {
- return amazonSNSToBeExtended.getPlatformApplicationAttributes(getPlatformApplicationAttributesRequest);
+ public GetPlatformApplicationAttributesResponse getPlatformApplicationAttributes(
+ GetPlatformApplicationAttributesRequest getPlatformApplicationAttributesRequest) throws InvalidParameterException,
+ InternalErrorException, AuthorizationErrorException, NotFoundException, AwsServiceException, SdkClientException,
+ SnsException {
+ return snsClientToBeExtended.getPlatformApplicationAttributes(getPlatformApplicationAttributesRequest);
}
/**
@@ -432,13 +424,19 @@ public GetPlatformApplicationAttributesResult getPlatformApplicationAttributes(G
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
* @throws InvalidParameterException Indicates that a request parameter does not comply with the associated constraints.
- * @sample AmazonSNS.GetSMSAttributes
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.GetSMSAttributes
* @see AWS API
* Documentation
*/
@Override
- public GetSMSAttributesResult getSMSAttributes(GetSMSAttributesRequest getSMSAttributesRequest) {
- return amazonSNSToBeExtended.getSMSAttributes(getSMSAttributesRequest);
+ public GetSmsAttributesResponse getSMSAttributes(GetSmsAttributesRequest getSMSAttributesRequest) throws ThrottledException,
+ InternalErrorException, AuthorizationErrorException, InvalidParameterException, AwsServiceException,
+ SdkClientException, SnsException {
+ return snsClientToBeExtended.getSMSAttributes(getSMSAttributesRequest);
}
/**
@@ -452,24 +450,20 @@ public GetSMSAttributesResult getSMSAttributes(GetSMSAttributesRequest getSMSAtt
* @throws InternalErrorException Indicates an internal service error.
* @throws NotFoundException Indicates that the requested resource does not exist.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
- * @sample AmazonSNS.GetSubscriptionAttributes
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.GetSubscriptionAttributes
* @see AWS
* API Documentation
*/
@Override
- public GetSubscriptionAttributesResult getSubscriptionAttributes(GetSubscriptionAttributesRequest getSubscriptionAttributesRequest) {
- return amazonSNSToBeExtended.getSubscriptionAttributes(getSubscriptionAttributesRequest);
- }
-
- /**
- * Simplified method form for invoking the GetSubscriptionAttributes operation.
- *
- * @param subscriptionArn
- * @see #getSubscriptionAttributes(GetSubscriptionAttributesRequest)
- */
- @Override
- public GetSubscriptionAttributesResult getSubscriptionAttributes(String subscriptionArn) {
- return amazonSNSToBeExtended.getSubscriptionAttributes(subscriptionArn);
+ public GetSubscriptionAttributesResponse getSubscriptionAttributes(
+ GetSubscriptionAttributesRequest getSubscriptionAttributesRequest) throws InvalidParameterException,
+ InternalErrorException, NotFoundException, AuthorizationErrorException, AwsServiceException, SdkClientException,
+ SnsException {
+ return snsClientToBeExtended.getSubscriptionAttributes(getSubscriptionAttributesRequest);
}
/**
@@ -484,35 +478,33 @@ public GetSubscriptionAttributesResult getSubscriptionAttributes(String subscrip
* @throws InternalErrorException Indicates an internal service error.
* @throws NotFoundException Indicates that the requested resource does not exist.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
- * @sample AmazonSNS.GetTopicAttributes
+ * @throws InvalidSecurityException The credential signature isn't valid. You must use an HTTPS endpoint and sign your request using
+ * Signature Version 4.
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.GetTopicAttributes
* @see AWS API
* Documentation
*/
@Override
- public GetTopicAttributesResult getTopicAttributes(GetTopicAttributesRequest getTopicAttributesRequest) {
- return amazonSNSToBeExtended.getTopicAttributes(getTopicAttributesRequest);
- }
-
- /**
- * Simplified method form for invoking the GetTopicAttributes operation.
- *
- * @param topicArn
- * @see #getTopicAttributes(GetTopicAttributesRequest)
- */
- @Override
- public GetTopicAttributesResult getTopicAttributes(String topicArn) {
- return amazonSNSToBeExtended.getTopicAttributes(topicArn);
+ public GetTopicAttributesResponse getTopicAttributes(GetTopicAttributesRequest getTopicAttributesRequest)
+ throws InvalidParameterException, InternalErrorException, NotFoundException, AuthorizationErrorException,
+ InvalidSecurityException, AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.getTopicAttributes(getTopicAttributesRequest);
}
/**
*
- * Lists the endpoints and endpoint attributes for devices in a supported push notification service, such as GCM and
- * APNS. The results for ListEndpointsByPlatformApplication
are paginated and return a limited list of
- * endpoints, up to 100. If additional records are available after the first page results, then a NextToken string
- * will be returned. To receive the next page, you call ListEndpointsByPlatformApplication
again using
- * the NextToken string received from the previous call. When there are no more records to return, NextToken will be
- * null. For more information, see Using
- * Amazon SNS Mobile Push Notifications.
+ * Lists the endpoints and endpoint attributes for devices in a supported push notification service, such as GCM
+ * (Firebase Cloud Messaging) and APNS. The results for ListEndpointsByPlatformApplication
are
+ * paginated and return a limited list of endpoints, up to 100. If additional records are available after the first
+ * page results, then a NextToken string will be returned. To receive the next page, you call
+ * ListEndpointsByPlatformApplication
again using the NextToken string received from the previous call.
+ * When there are no more records to return, NextToken will be null. For more information, see Using Amazon SNS Mobile Push
+ * Notifications.
*
*
* This action is throttled at 30 transactions per second (TPS).
@@ -524,13 +516,121 @@ public GetTopicAttributesResult getTopicAttributes(String topicArn) {
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
* @throws NotFoundException Indicates that the requested resource does not exist.
- * @sample AmazonSNS.ListEndpointsByPlatformApplication
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.ListEndpointsByPlatformApplication
* @see AWS API Documentation
*/
@Override
- public ListEndpointsByPlatformApplicationResult listEndpointsByPlatformApplication(ListEndpointsByPlatformApplicationRequest listEndpointsByPlatformApplicationRequest) {
- return amazonSNSToBeExtended.listEndpointsByPlatformApplication(listEndpointsByPlatformApplicationRequest);
+ public ListEndpointsByPlatformApplicationResponse listEndpointsByPlatformApplication(
+ ListEndpointsByPlatformApplicationRequest listEndpointsByPlatformApplicationRequest)
+ throws InvalidParameterException, InternalErrorException, AuthorizationErrorException, NotFoundException,
+ AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.listEndpointsByPlatformApplication(listEndpointsByPlatformApplicationRequest);
+ }
+
+ /**
+ *
+ * Lists the endpoints and endpoint attributes for devices in a supported push notification service, such as GCM
+ * (Firebase Cloud Messaging) and APNS. The results for ListEndpointsByPlatformApplication
are
+ * paginated and return a limited list of endpoints, up to 100. If additional records are available after the first
+ * page results, then a NextToken string will be returned. To receive the next page, you call
+ * ListEndpointsByPlatformApplication
again using the NextToken string received from the previous call.
+ * When there are no more records to return, NextToken will be null. For more information, see Using Amazon SNS Mobile Push
+ * Notifications.
+ *
+ *
+ * This action is throttled at 30 transactions per second (TPS).
+ *
+ *
+ *
+ * This is a variant of
+ * {@link #listEndpointsByPlatformApplication(software.amazon.awssdk.services.sns.model.ListEndpointsByPlatformApplicationRequest)}
+ * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
+ * internally handle making service calls for you.
+ *
+ *
+ * When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
+ * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
+ * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
+ * request, you will see the failures only after you start iterating through the iterable.
+ *
+ *
+ *
+ * The following are few ways to iterate through the response pages:
+ *
+ * 1) Using a Stream
+ *
+ *
+ * {@code
+ * software.amazon.awssdk.services.sns.paginators.ListEndpointsByPlatformApplicationIterable responses = client.listEndpointsByPlatformApplicationPaginator(request);
+ * responses.stream().forEach(....);
+ * }
+ *
+ *
+ * 2) Using For loop
+ *
+ *
+ * {
+ * @code
+ * software.amazon.awssdk.services.sns.paginators.ListEndpointsByPlatformApplicationIterable responses = client
+ * .listEndpointsByPlatformApplicationPaginator(request);
+ * for (software.amazon.awssdk.services.sns.model.ListEndpointsByPlatformApplicationResponse response : responses) {
+ * // do something;
+ * }
+ * }
+ *
+ *
+ * 3) Use iterator directly
+ *
+ *
+ * {@code
+ * software.amazon.awssdk.services.sns.paginators.ListEndpointsByPlatformApplicationIterable responses = client.listEndpointsByPlatformApplicationPaginator(request);
+ * responses.iterator().forEachRemaining(....);
+ * }
+ *
+ *
+ * Please notice that the configuration of null won't limit the number of results you get with the paginator. It
+ * only limits the number of results in each page.
+ *
+ *
+ * Note: If you prefer to have control on service calls, use the
+ * {@link #listEndpointsByPlatformApplication(software.amazon.awssdk.services.sns.model.ListEndpointsByPlatformApplicationRequest)}
+ * operation.
+ *
+ *
+ * @param listEndpointsByPlatformApplicationRequest
+ * Input for ListEndpointsByPlatformApplication action.
+ * @return A custom iterable that can be used to iterate through all the response pages.
+ * @throws InvalidParameterException
+ * Indicates that a request parameter does not comply with the associated constraints.
+ * @throws InternalErrorException
+ * Indicates an internal service error.
+ * @throws AuthorizationErrorException
+ * Indicates that the user has been denied access to the requested resource.
+ * @throws NotFoundException
+ * Indicates that the requested resource does not exist.
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.ListEndpointsByPlatformApplication
+ * @see AWS API Documentation
+ */
+ @Override
+ public ListEndpointsByPlatformApplicationIterable listEndpointsByPlatformApplicationPaginator(
+ ListEndpointsByPlatformApplicationRequest listEndpointsByPlatformApplicationRequest)
+ throws InvalidParameterException, InternalErrorException, AuthorizationErrorException, NotFoundException,
+ AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.listEndpointsByPlatformApplicationPaginator(listEndpointsByPlatformApplicationRequest);
}
/**
@@ -552,23 +652,30 @@ public ListEndpointsByPlatformApplicationResult listEndpointsByPlatformApplicati
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
* @throws InvalidParameterException Indicates that a request parameter does not comply with the associated constraints.
- * @sample AmazonSNS.ListPhoneNumbersOptedOut
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.ListPhoneNumbersOptedOut
* @see AWS
* API Documentation
*/
@Override
- public ListPhoneNumbersOptedOutResult listPhoneNumbersOptedOut(ListPhoneNumbersOptedOutRequest listPhoneNumbersOptedOutRequest) {
- return amazonSNSToBeExtended.listPhoneNumbersOptedOut(listPhoneNumbersOptedOutRequest);
+ public ListPhoneNumbersOptedOutResponse listPhoneNumbersOptedOut(
+ ListPhoneNumbersOptedOutRequest listPhoneNumbersOptedOutRequest) throws ThrottledException, InternalErrorException,
+ AuthorizationErrorException, InvalidParameterException, AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.listPhoneNumbersOptedOut(listPhoneNumbersOptedOutRequest);
}
/**
*
- * Lists the platform application objects for the supported push notification services, such as APNS and GCM. The
- * results for ListPlatformApplications
are paginated and return a limited list of applications, up to
- * 100. If additional records are available after the first page results, then a NextToken string will be returned.
- * To receive the next page, you call ListPlatformApplications
using the NextToken string received from
- * the previous call. When there are no more records to return, NextToken will be null. For more information, see Using Amazon SNS Mobile Push
+ * Lists the platform application objects for the supported push notification services, such as APNS and GCM
+ * (Firebase Cloud Messaging). The results for ListPlatformApplications
are paginated and return a
+ * limited list of applications, up to 100. If additional records are available after the first page results, then a
+ * NextToken string will be returned. To receive the next page, you call ListPlatformApplications
using
+ * the NextToken string received from the previous call. When there are no more records to return,
+ * NextToken
will be null. For more information, see Using Amazon SNS Mobile Push
* Notifications.
*
*
@@ -580,23 +687,117 @@ public ListPhoneNumbersOptedOutResult listPhoneNumbersOptedOut(ListPhoneNumbersO
* @throws InvalidParameterException Indicates that a request parameter does not comply with the associated constraints.
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
- * @sample AmazonSNS.ListPlatformApplications
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.ListPlatformApplications
* @see AWS
* API Documentation
*/
@Override
- public ListPlatformApplicationsResult listPlatformApplications(ListPlatformApplicationsRequest listPlatformApplicationsRequest) {
- return amazonSNSToBeExtended.listPlatformApplications(listPlatformApplicationsRequest);
+ public ListPlatformApplicationsResponse listPlatformApplications(
+ ListPlatformApplicationsRequest listPlatformApplicationsRequest) throws InvalidParameterException,
+ InternalErrorException, AuthorizationErrorException, AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.listPlatformApplications(listPlatformApplicationsRequest);
}
/**
- * Simplified method form for invoking the ListPlatformApplications operation.
+ *
+ * Lists the platform application objects for the supported push notification services, such as APNS and GCM
+ * (Firebase Cloud Messaging). The results for ListPlatformApplications
are paginated and return a
+ * limited list of applications, up to 100. If additional records are available after the first page results, then a
+ * NextToken string will be returned. To receive the next page, you call ListPlatformApplications
using
+ * the NextToken string received from the previous call. When there are no more records to return,
+ * NextToken
will be null. For more information, see Using Amazon SNS Mobile Push
+ * Notifications.
+ *
+ *
+ * This action is throttled at 15 transactions per second (TPS).
+ *
+ *
+ *
+ * This is a variant of
+ * {@link #listPlatformApplications(software.amazon.awssdk.services.sns.model.ListPlatformApplicationsRequest)}
+ * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
+ * internally handle making service calls for you.
+ *
+ *
+ * When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
+ * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
+ * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
+ * request, you will see the failures only after you start iterating through the iterable.
+ *
+ *
+ *
+ * The following are few ways to iterate through the response pages:
+ *
+ * 1) Using a Stream
*
- * @see #listPlatformApplications(ListPlatformApplicationsRequest)
+ *
+ * {@code
+ * software.amazon.awssdk.services.sns.paginators.ListPlatformApplicationsIterable responses = client.listPlatformApplicationsPaginator(request);
+ * responses.stream().forEach(....);
+ * }
+ *
+ *
+ * 2) Using For loop
+ *
+ *
+ * {
+ * @code
+ * software.amazon.awssdk.services.sns.paginators.ListPlatformApplicationsIterable responses = client
+ * .listPlatformApplicationsPaginator(request);
+ * for (software.amazon.awssdk.services.sns.model.ListPlatformApplicationsResponse response : responses) {
+ * // do something;
+ * }
+ * }
+ *
+ *
+ * 3) Use iterator directly
+ *
+ *
+ * {@code
+ * software.amazon.awssdk.services.sns.paginators.ListPlatformApplicationsIterable responses = client.listPlatformApplicationsPaginator(request);
+ * responses.iterator().forEachRemaining(....);
+ * }
+ *
+ *
+ * Please notice that the configuration of null won't limit the number of results you get with the paginator. It
+ * only limits the number of results in each page.
+ *
+ *
+ * Note: If you prefer to have control on service calls, use the
+ * {@link #listPlatformApplications(software.amazon.awssdk.services.sns.model.ListPlatformApplicationsRequest)}
+ * operation.
+ *
+ *
+ * @param listPlatformApplicationsRequest
+ * Input for ListPlatformApplications action.
+ * @return A custom iterable that can be used to iterate through all the response pages.
+ * @throws InvalidParameterException
+ * Indicates that a request parameter does not comply with the associated constraints.
+ * @throws InternalErrorException
+ * Indicates an internal service error.
+ * @throws AuthorizationErrorException
+ * Indicates that the user has been denied access to the requested resource.
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.ListPlatformApplications
+ * @see AWS
+ * API Documentation
*/
@Override
- public ListPlatformApplicationsResult listPlatformApplications() {
- return amazonSNSToBeExtended.listPlatformApplications();
+ public ListPlatformApplicationsIterable listPlatformApplicationsPaginator(
+ ListPlatformApplicationsRequest listPlatformApplicationsRequest) throws InvalidParameterException,
+ InternalErrorException, AuthorizationErrorException, AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.listPlatformApplicationsPaginator(listPlatformApplicationsRequest);
}
/**
@@ -614,34 +815,111 @@ public ListPlatformApplicationsResult listPlatformApplications() {
* @throws InvalidParameterException Indicates that a request parameter does not comply with the associated constraints.
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
- * @sample AmazonSNS.ListSubscriptions
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.ListSubscriptions
* @see AWS API
* Documentation
*/
@Override
- public ListSubscriptionsResult listSubscriptions(ListSubscriptionsRequest listSubscriptionsRequest) {
- return amazonSNSToBeExtended.listSubscriptions(listSubscriptionsRequest);
+ public ListSubscriptionsResponse listSubscriptions(ListSubscriptionsRequest listSubscriptionsRequest)
+ throws InvalidParameterException, InternalErrorException, AuthorizationErrorException, AwsServiceException,
+ SdkClientException, SnsException {
+ return snsClientToBeExtended.listSubscriptions(listSubscriptionsRequest);
}
/**
- * Simplified method form for invoking the ListSubscriptions operation.
+ *
+ * Returns a list of the requester's subscriptions. Each call returns a limited list of subscriptions, up to 100. If
+ * there are more subscriptions, a NextToken
is also returned. Use the NextToken
parameter
+ * in a new ListSubscriptions
call to get further results.
+ *
+ *
+ * This action is throttled at 30 transactions per second (TPS).
+ *
+ *
+ *
+ * This is a variant of
+ * {@link #listSubscriptions(software.amazon.awssdk.services.sns.model.ListSubscriptionsRequest)} operation. The
+ * return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle
+ * making service calls for you.
+ *
+ *
+ * When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
+ * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
+ * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
+ * request, you will see the failures only after you start iterating through the iterable.
+ *
*
- * @see #listSubscriptions(ListSubscriptionsRequest)
- */
- @Override
- public ListSubscriptionsResult listSubscriptions() {
- return amazonSNSToBeExtended.listSubscriptions();
- }
-
- /**
- * Simplified method form for invoking the ListSubscriptions operation.
+ *
+ * The following are few ways to iterate through the response pages:
+ *
+ * 1) Using a Stream
+ *
+ *
+ * {@code
+ * software.amazon.awssdk.services.sns.paginators.ListSubscriptionsIterable responses = client.listSubscriptionsPaginator(request);
+ * responses.stream().forEach(....);
+ * }
+ *
+ *
+ * 2) Using For loop
+ *
+ *
+ * {
+ * @code
+ * software.amazon.awssdk.services.sns.paginators.ListSubscriptionsIterable responses = client
+ * .listSubscriptionsPaginator(request);
+ * for (software.amazon.awssdk.services.sns.model.ListSubscriptionsResponse response : responses) {
+ * // do something;
+ * }
+ * }
+ *
*
- * @param nextToken
- * @see #listSubscriptions(ListSubscriptionsRequest)
+ * 3) Use iterator directly
+ *
+ *
+ * {@code
+ * software.amazon.awssdk.services.sns.paginators.ListSubscriptionsIterable responses = client.listSubscriptionsPaginator(request);
+ * responses.iterator().forEachRemaining(....);
+ * }
+ *
+ *
+ * Please notice that the configuration of null won't limit the number of results you get with the paginator. It
+ * only limits the number of results in each page.
+ *
+ *
+ * Note: If you prefer to have control on service calls, use the
+ * {@link #listSubscriptions(software.amazon.awssdk.services.sns.model.ListSubscriptionsRequest)} operation.
+ *
+ *
+ * @param listSubscriptionsRequest
+ * Input for ListSubscriptions action.
+ * @return A custom iterable that can be used to iterate through all the response pages.
+ * @throws InvalidParameterException
+ * Indicates that a request parameter does not comply with the associated constraints.
+ * @throws InternalErrorException
+ * Indicates an internal service error.
+ * @throws AuthorizationErrorException
+ * Indicates that the user has been denied access to the requested resource.
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.ListSubscriptions
+ * @see AWS API
+ * Documentation
*/
@Override
- public ListSubscriptionsResult listSubscriptions(String nextToken) {
- return amazonSNSToBeExtended.listSubscriptions(nextToken);
+ public ListSubscriptionsIterable listSubscriptionsPaginator(ListSubscriptionsRequest listSubscriptionsRequest)
+ throws InvalidParameterException, InternalErrorException, AuthorizationErrorException, AwsServiceException,
+ SdkClientException, SnsException {
+ return snsClientToBeExtended.listSubscriptionsPaginator(listSubscriptionsRequest);
}
/**
@@ -660,36 +938,116 @@ public ListSubscriptionsResult listSubscriptions(String nextToken) {
* @throws InternalErrorException Indicates an internal service error.
* @throws NotFoundException Indicates that the requested resource does not exist.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
- * @sample AmazonSNS.ListSubscriptionsByTopic
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.ListSubscriptionsByTopic
* @see AWS
* API Documentation
*/
@Override
- public ListSubscriptionsByTopicResult listSubscriptionsByTopic(ListSubscriptionsByTopicRequest listSubscriptionsByTopicRequest) {
- return amazonSNSToBeExtended.listSubscriptionsByTopic(listSubscriptionsByTopicRequest);
+ public ListSubscriptionsByTopicResponse listSubscriptionsByTopic(
+ ListSubscriptionsByTopicRequest listSubscriptionsByTopicRequest) throws InvalidParameterException,
+ InternalErrorException, NotFoundException, AuthorizationErrorException, AwsServiceException, SdkClientException,
+ SnsException {
+ return snsClientToBeExtended.listSubscriptionsByTopic(listSubscriptionsByTopicRequest);
}
/**
- * Simplified method form for invoking the ListSubscriptionsByTopic operation.
+ *
+ * Returns a list of the subscriptions to a specific topic. Each call returns a limited list of subscriptions, up to
+ * 100. If there are more subscriptions, a NextToken
is also returned. Use the NextToken
+ * parameter in a new ListSubscriptionsByTopic
call to get further results.
+ *
+ *
+ * This action is throttled at 30 transactions per second (TPS).
+ *
+ *
+ *
+ * This is a variant of
+ * {@link #listSubscriptionsByTopic(software.amazon.awssdk.services.sns.model.ListSubscriptionsByTopicRequest)}
+ * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
+ * internally handle making service calls for you.
+ *
+ *
+ * When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
+ * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
+ * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
+ * request, you will see the failures only after you start iterating through the iterable.
+ *
*
- * @param topicArn
- * @see #listSubscriptionsByTopic(ListSubscriptionsByTopicRequest)
- */
- @Override
- public ListSubscriptionsByTopicResult listSubscriptionsByTopic(String topicArn) {
- return amazonSNSToBeExtended.listSubscriptionsByTopic(topicArn);
- }
-
- /**
- * Simplified method form for invoking the ListSubscriptionsByTopic operation.
+ *
+ * The following are few ways to iterate through the response pages:
+ *
+ * 1) Using a Stream
+ *
+ *
+ * {@code
+ * software.amazon.awssdk.services.sns.paginators.ListSubscriptionsByTopicIterable responses = client.listSubscriptionsByTopicPaginator(request);
+ * responses.stream().forEach(....);
+ * }
+ *
+ *
+ * 2) Using For loop
*
- * @param topicArn
- * @param nextToken
- * @see #listSubscriptionsByTopic(ListSubscriptionsByTopicRequest)
+ *
+ * {
+ * @code
+ * software.amazon.awssdk.services.sns.paginators.ListSubscriptionsByTopicIterable responses = client
+ * .listSubscriptionsByTopicPaginator(request);
+ * for (software.amazon.awssdk.services.sns.model.ListSubscriptionsByTopicResponse response : responses) {
+ * // do something;
+ * }
+ * }
+ *
+ *
+ * 3) Use iterator directly
+ *
+ *
+ * {@code
+ * software.amazon.awssdk.services.sns.paginators.ListSubscriptionsByTopicIterable responses = client.listSubscriptionsByTopicPaginator(request);
+ * responses.iterator().forEachRemaining(....);
+ * }
+ *
+ *
+ * Please notice that the configuration of null won't limit the number of results you get with the paginator. It
+ * only limits the number of results in each page.
+ *
+ *
+ * Note: If you prefer to have control on service calls, use the
+ * {@link #listSubscriptionsByTopic(software.amazon.awssdk.services.sns.model.ListSubscriptionsByTopicRequest)}
+ * operation.
+ *
+ *
+ * @param listSubscriptionsByTopicRequest
+ * Input for ListSubscriptionsByTopic action.
+ * @return A custom iterable that can be used to iterate through all the response pages.
+ * @throws InvalidParameterException
+ * Indicates that a request parameter does not comply with the associated constraints.
+ * @throws InternalErrorException
+ * Indicates an internal service error.
+ * @throws NotFoundException
+ * Indicates that the requested resource does not exist.
+ * @throws AuthorizationErrorException
+ * Indicates that the user has been denied access to the requested resource.
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.ListSubscriptionsByTopic
+ * @see AWS
+ * API Documentation
*/
@Override
- public ListSubscriptionsByTopicResult listSubscriptionsByTopic(String topicArn, String nextToken) {
- return amazonSNSToBeExtended.listSubscriptionsByTopic(topicArn, nextToken);
+ public ListSubscriptionsByTopicIterable listSubscriptionsByTopicPaginator(
+ ListSubscriptionsByTopicRequest listSubscriptionsByTopicRequest) throws InvalidParameterException,
+ InternalErrorException, NotFoundException, AuthorizationErrorException, AwsServiceException, SdkClientException,
+ SnsException {
+ return snsClientToBeExtended.listSubscriptionsByTopicPaginator(listSubscriptionsByTopicRequest);
}
/**
@@ -707,34 +1065,106 @@ public ListSubscriptionsByTopicResult listSubscriptionsByTopic(String topicArn,
* @throws InvalidParameterException Indicates that a request parameter does not comply with the associated constraints.
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
- * @sample AmazonSNS.ListTopics
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.ListTopics
* @see AWS API
* Documentation
*/
@Override
- public ListTopicsResult listTopics(ListTopicsRequest listTopicsRequest) {
- return amazonSNSToBeExtended.listTopics(listTopicsRequest);
+ public ListTopicsResponse listTopics(ListTopicsRequest listTopicsRequest) throws InvalidParameterException,
+ InternalErrorException, AuthorizationErrorException, AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.listTopics(listTopicsRequest);
}
/**
- * Simplified method form for invoking the ListTopics operation.
+ *
+ * Returns a list of the requester's topics. Each call returns a limited list of topics, up to 100. If there are
+ * more topics, a NextToken
is also returned. Use the NextToken
parameter in a new
+ * ListTopics
call to get further results.
+ *
+ *
+ * This action is throttled at 30 transactions per second (TPS).
+ *
+ *
+ *
+ * This is a variant of {@link #listTopics(software.amazon.awssdk.services.sns.model.ListTopicsRequest)} operation.
+ * The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally
+ * handle making service calls for you.
+ *
+ *
+ * When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
+ * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
+ * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
+ * request, you will see the failures only after you start iterating through the iterable.
+ *
*
- * @see #listTopics(ListTopicsRequest)
- */
- @Override
- public ListTopicsResult listTopics() {
- return amazonSNSToBeExtended.listTopics();
- }
-
- /**
- * Simplified method form for invoking the ListTopics operation.
+ *
+ * The following are few ways to iterate through the response pages:
+ *
+ * 1) Using a Stream
+ *
+ *
+ * {@code
+ * software.amazon.awssdk.services.sns.paginators.ListTopicsIterable responses = client.listTopicsPaginator(request);
+ * responses.stream().forEach(....);
+ * }
+ *
*
- * @param nextToken
- * @see #listTopics(ListTopicsRequest)
+ * 2) Using For loop
+ *
+ *
+ * {
+ * @code
+ * software.amazon.awssdk.services.sns.paginators.ListTopicsIterable responses = client.listTopicsPaginator(request);
+ * for (software.amazon.awssdk.services.sns.model.ListTopicsResponse response : responses) {
+ * // do something;
+ * }
+ * }
+ *
+ *
+ * 3) Use iterator directly
+ *
+ *
+ * {@code
+ * software.amazon.awssdk.services.sns.paginators.ListTopicsIterable responses = client.listTopicsPaginator(request);
+ * responses.iterator().forEachRemaining(....);
+ * }
+ *
+ *
+ * Please notice that the configuration of null won't limit the number of results you get with the paginator. It
+ * only limits the number of results in each page.
+ *
+ *
+ * Note: If you prefer to have control on service calls, use the
+ * {@link #listTopics(software.amazon.awssdk.services.sns.model.ListTopicsRequest)} operation.
+ *
+ *
+ * @param listTopicsRequest
+ * @return A custom iterable that can be used to iterate through all the response pages.
+ * @throws InvalidParameterException
+ * Indicates that a request parameter does not comply with the associated constraints.
+ * @throws InternalErrorException
+ * Indicates an internal service error.
+ * @throws AuthorizationErrorException
+ * Indicates that the user has been denied access to the requested resource.
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.ListTopics
+ * @see AWS API
+ * Documentation
*/
@Override
- public ListTopicsResult listTopics(String nextToken) {
- return amazonSNSToBeExtended.listTopics(nextToken);
+ public ListTopicsIterable listTopicsPaginator(ListTopicsRequest listTopicsRequest) throws InvalidParameterException,
+ InternalErrorException, AuthorizationErrorException, AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.listTopicsPaginator(listTopicsRequest);
}
/**
@@ -753,18 +1183,25 @@ public ListTopicsResult listTopics(String nextToken) {
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
* @throws InvalidParameterException Indicates that a request parameter does not comply with the associated constraints.
- * @sample AmazonSNS.OptInPhoneNumber
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.OptInPhoneNumber
* @see AWS API
* Documentation
*/
@Override
- public OptInPhoneNumberResult optInPhoneNumber(OptInPhoneNumberRequest optInPhoneNumberRequest) {
- return amazonSNSToBeExtended.optInPhoneNumber(optInPhoneNumberRequest);
+ public OptInPhoneNumberResponse optInPhoneNumber(OptInPhoneNumberRequest optInPhoneNumberRequest) throws ThrottledException,
+ InternalErrorException, AuthorizationErrorException, InvalidParameterException, AwsServiceException,
+ SdkClientException, SnsException {
+ return snsClientToBeExtended.optInPhoneNumber(optInPhoneNumberRequest);
}
/**
*
- * Sends a message to an Amazon SNS topic or sends a text message (SMS message) directly to a phone number.
+ * Sends a message to an Amazon SNS topic, a text message (SMS message) directly to a phone number, or a message to
+ * a mobile platform endpoint (when you specify the TargetArn
).
*
*
* If you send a message to a topic, Amazon SNS delivers the message to each endpoint that is subscribed to the
@@ -781,9 +1218,14 @@ public OptInPhoneNumberResult optInPhoneNumber(OptInPhoneNumberRequest optInPhon
*
*
* For more information about formatting messages, see Send Custom Platform-Specific
- * Payloads in Messages to Mobile Devices.
+ * href="https://docs.aws.amazon.com/sns/latest/dg/mobile-push-send-custommessage.html">Send Custom
+ * Platform-Specific Payloads in Messages to Mobile Devices.
+ *
+ *
+ *
+ * You can publish messages only to topics and endpoints in the same AWS Region.
*
+ *
*
* @param publishRequest Input for Publish action.
* @return Result of the Publish operation returned by the service.
@@ -794,38 +1236,34 @@ public OptInPhoneNumberResult optInPhoneNumber(OptInPhoneNumberRequest optInPhon
* @throws EndpointDisabledException Exception error indicating endpoint disabled.
* @throws PlatformApplicationDisabledException Exception error indicating platform application disabled.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
- * @sample AmazonSNS.Publish
+ * @throws KmsDisabledException The request was rejected because the specified customer master key (CMK) isn't enabled.
+ * @throws KmsInvalidStateException The request was rejected because the state of the specified resource isn't valid for this request. For
+ * more information, see How
+ * Key State Affects Use of a Customer Master Key in the AWS Key Management Service Developer
+ * Guide.
+ * @throws KmsNotFoundException The request was rejected because the specified entity or resource can't be found.
+ * @throws KmsOptInRequiredException The AWS access key ID needs a subscription for the service.
+ * @throws KmsThrottlingException The request was denied due to request throttling. For more information about throttling, see Limits
+ * in the AWS Key Management Service Developer Guide.
+ * @throws KmsAccessDeniedException The ciphertext references a key that doesn't exist or that you don't have access to.
+ * @throws InvalidSecurityException The credential signature isn't valid. You must use an HTTPS endpoint and sign your request using
+ * Signature Version 4.
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.Publish
* @see AWS API
* Documentation
*/
@Override
- public PublishResult publish(PublishRequest publishRequest) {
- return amazonSNSToBeExtended.publish(publishRequest);
- }
-
- /**
- * Simplified method form for invoking the Publish operation.
- *
- * @param topicArn
- * @param message
- * @see #publish(PublishRequest)
- */
- @Override
- public PublishResult publish(String topicArn, String message) {
- return amazonSNSToBeExtended.publish(topicArn, message);
- }
-
- /**
- * Simplified method form for invoking the Publish operation.
- *
- * @param topicArn
- * @param message
- * @param subject
- * @see #publish(PublishRequest)
- */
- @Override
- public PublishResult publish(String topicArn, String message, String subject) {
- return amazonSNSToBeExtended.publish(topicArn, message, subject);
+ public PublishResponse publish(PublishRequest publishRequest) throws InvalidParameterException,
+ InvalidParameterValueException, InternalErrorException, NotFoundException, EndpointDisabledException,
+ PlatformApplicationDisabledException, AuthorizationErrorException, KmsDisabledException, KmsInvalidStateException,
+ KmsNotFoundException, KmsOptInRequiredException, KmsThrottlingException, KmsAccessDeniedException,
+ InvalidSecurityException, AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.publish(publishRequest);
}
/**
@@ -839,32 +1277,27 @@ public PublishResult publish(String topicArn, String message, String subject) {
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
* @throws NotFoundException Indicates that the requested resource does not exist.
- * @sample AmazonSNS.RemovePermission
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.RemovePermission
* @see AWS API
* Documentation
*/
@Override
- public RemovePermissionResult removePermission(RemovePermissionRequest removePermissionRequest) {
- return amazonSNSToBeExtended.removePermission(removePermissionRequest);
- }
-
- /**
- * Simplified method form for invoking the RemovePermission operation.
- *
- * @param topicArn
- * @param label
- * @see #removePermission(RemovePermissionRequest)
- */
- @Override
- public RemovePermissionResult removePermission(String topicArn, String label) {
- return amazonSNSToBeExtended.removePermission(topicArn, label);
+ public RemovePermissionResponse removePermission(RemovePermissionRequest removePermissionRequest)
+ throws InvalidParameterException, InternalErrorException, AuthorizationErrorException, NotFoundException,
+ AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.removePermission(removePermissionRequest);
}
/**
*
* Sets the attributes for an endpoint for a device on one of the supported push notification services, such as GCM
- * and APNS. For more information, see Using
- * Amazon SNS Mobile Push Notifications.
+ * (Firebase Cloud Messaging) and APNS. For more information, see Using Amazon SNS Mobile Push
+ * Notifications.
*
*
* @param setEndpointAttributesRequest Input for SetEndpointAttributes action.
@@ -873,22 +1306,29 @@ public RemovePermissionResult removePermission(String topicArn, String label) {
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
* @throws NotFoundException Indicates that the requested resource does not exist.
- * @sample AmazonSNS.SetEndpointAttributes
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.SetEndpointAttributes
* @see AWS API
* Documentation
*/
@Override
- public SetEndpointAttributesResult setEndpointAttributes(SetEndpointAttributesRequest setEndpointAttributesRequest) {
- return amazonSNSToBeExtended.setEndpointAttributes(setEndpointAttributesRequest);
+ public SetEndpointAttributesResponse setEndpointAttributes(SetEndpointAttributesRequest setEndpointAttributesRequest)
+ throws InvalidParameterException, InternalErrorException, AuthorizationErrorException, NotFoundException,
+ AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.setEndpointAttributes(setEndpointAttributesRequest);
}
/**
*
* Sets the attributes of the platform application object for the supported push notification services, such as APNS
- * and GCM. For more information, see Using
- * Amazon SNS Mobile Push Notifications. For information on configuring attributes for message delivery status,
- * see Using Amazon SNS Application
- * Attributes for Message Delivery Status.
+ * and GCM (Firebase Cloud Messaging). For more information, see Using Amazon SNS Mobile Push
+ * Notifications. For information on configuring attributes for message delivery status, see Using Amazon SNS Application Attributes for
+ * Message Delivery Status.
*
*
* @param setPlatformApplicationAttributesRequest Input for SetPlatformApplicationAttributes action.
@@ -897,13 +1337,20 @@ public SetEndpointAttributesResult setEndpointAttributes(SetEndpointAttributesRe
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
* @throws NotFoundException Indicates that the requested resource does not exist.
- * @sample AmazonSNS.SetPlatformApplicationAttributes
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.SetPlatformApplicationAttributes
* @see AWS API Documentation
*/
@Override
- public SetPlatformApplicationAttributesResult setPlatformApplicationAttributes(SetPlatformApplicationAttributesRequest setPlatformApplicationAttributesRequest) {
- return amazonSNSToBeExtended.setPlatformApplicationAttributes(setPlatformApplicationAttributesRequest);
+ public SetPlatformApplicationAttributesResponse setPlatformApplicationAttributes(
+ SetPlatformApplicationAttributesRequest setPlatformApplicationAttributesRequest) throws InvalidParameterException,
+ InternalErrorException, AuthorizationErrorException, NotFoundException, AwsServiceException, SdkClientException,
+ SnsException {
+ return snsClientToBeExtended.setPlatformApplicationAttributes(setPlatformApplicationAttributesRequest);
}
/**
@@ -913,7 +1360,7 @@ public SetPlatformApplicationAttributesResult setPlatformApplicationAttributes(S
*
* You can override some of these settings for a single message when you use the Publish
action with
* the MessageAttributes.entry.N
parameter. For more information, see Sending an SMS Message in the
+ * href="https://docs.aws.amazon.com/sns/latest/dg/sms_publish-to-phone.html">Sending an SMS Message in the
* Amazon SNS Developer Guide.
*
*
@@ -924,13 +1371,19 @@ public SetPlatformApplicationAttributesResult setPlatformApplicationAttributes(S
* account.
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
- * @sample AmazonSNS.SetSMSAttributes
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.SetSMSAttributes
* @see AWS API
* Documentation
*/
@Override
- public SetSMSAttributesResult setSMSAttributes(SetSMSAttributesRequest setSMSAttributesRequest) {
- return amazonSNSToBeExtended.setSMSAttributes(setSMSAttributesRequest);
+ public SetSmsAttributesResponse setSMSAttributes(SetSmsAttributesRequest setSMSAttributesRequest)
+ throws InvalidParameterException, ThrottledException, InternalErrorException, AuthorizationErrorException,
+ AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.setSMSAttributes(setSMSAttributesRequest);
}
/**
@@ -946,26 +1399,20 @@ public SetSMSAttributesResult setSMSAttributes(SetSMSAttributesRequest setSMSAtt
* @throws InternalErrorException Indicates an internal service error.
* @throws NotFoundException Indicates that the requested resource does not exist.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
- * @sample AmazonSNS.SetSubscriptionAttributes
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.SetSubscriptionAttributes
* @see AWS
* API Documentation
*/
@Override
- public SetSubscriptionAttributesResult setSubscriptionAttributes(SetSubscriptionAttributesRequest setSubscriptionAttributesRequest) {
- return amazonSNSToBeExtended.setSubscriptionAttributes(setSubscriptionAttributesRequest);
- }
-
- /**
- * Simplified method form for invoking the SetSubscriptionAttributes operation.
- *
- * @param subscriptionArn
- * @param attributeName
- * @param attributeValue
- * @see #setSubscriptionAttributes(SetSubscriptionAttributesRequest)
- */
- @Override
- public SetSubscriptionAttributesResult setSubscriptionAttributes(String subscriptionArn, String attributeName, String attributeValue) {
- return amazonSNSToBeExtended.setSubscriptionAttributes(subscriptionArn, attributeName, attributeValue);
+ public SetSubscriptionAttributesResponse setSubscriptionAttributes(
+ SetSubscriptionAttributesRequest setSubscriptionAttributesRequest) throws InvalidParameterException,
+ FilterPolicyLimitExceededException, InternalErrorException, NotFoundException, AuthorizationErrorException,
+ AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.setSubscriptionAttributes(setSubscriptionAttributesRequest);
}
/**
@@ -979,33 +1426,32 @@ public SetSubscriptionAttributesResult setSubscriptionAttributes(String subscrip
* @throws InternalErrorException Indicates an internal service error.
* @throws NotFoundException Indicates that the requested resource does not exist.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
- * @sample AmazonSNS.SetTopicAttributes
+ * @throws InvalidSecurityException The credential signature isn't valid. You must use an HTTPS endpoint and sign your request using
+ * Signature Version 4.
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.SetTopicAttributes
* @see AWS API
* Documentation
*/
@Override
- public SetTopicAttributesResult setTopicAttributes(SetTopicAttributesRequest setTopicAttributesRequest) {
- return amazonSNSToBeExtended.setTopicAttributes(setTopicAttributesRequest);
- }
-
- /**
- * Simplified method form for invoking the SetTopicAttributes operation.
- *
- * @param topicArn
- * @param attributeName
- * @param attributeValue
- * @see #setTopicAttributes(SetTopicAttributesRequest)
- */
- @Override
- public SetTopicAttributesResult setTopicAttributes(String topicArn, String attributeName, String attributeValue) {
- return amazonSNSToBeExtended.setTopicAttributes(topicArn, attributeName, attributeValue);
+ public SetTopicAttributesResponse setTopicAttributes(SetTopicAttributesRequest setTopicAttributesRequest)
+ throws InvalidParameterException, InternalErrorException, NotFoundException, AuthorizationErrorException,
+ InvalidSecurityException, AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.setTopicAttributes(setTopicAttributesRequest);
}
/**
*
- * Prepares to subscribe an endpoint by sending the endpoint a confirmation message. To actually create a
- * subscription, the endpoint owner must call the ConfirmSubscription
action with the token from the
- * confirmation message. Confirmation tokens are valid for three days.
+ * Subscribes an endpoint to an Amazon SNS topic. If the endpoint type is HTTP/S or email, or if the endpoint and
+ * the topic are not in the same AWS account, the endpoint owner must the ConfirmSubscription
action to
+ * confirm the subscription.
+ *
+ *
+ * You call the ConfirmSubscription
action with the token from the subscription response. Confirmation
+ * tokens are valid for three days.
*
*
* This action is throttled at 100 transactions per second (TPS).
@@ -1020,26 +1466,21 @@ public SetTopicAttributesResult setTopicAttributes(String topicArn, String attri
* @throws InternalErrorException Indicates an internal service error.
* @throws NotFoundException Indicates that the requested resource does not exist.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
- * @sample AmazonSNS.Subscribe
+ * @throws InvalidSecurityException The credential signature isn't valid. You must use an HTTPS endpoint and sign your request using
+ * Signature Version 4.
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.Subscribe
* @see AWS API
* Documentation
*/
@Override
- public SubscribeResult subscribe(SubscribeRequest subscribeRequest) {
- return amazonSNSToBeExtended.subscribe(subscribeRequest);
- }
-
- /**
- * Simplified method form for invoking the Subscribe operation.
- *
- * @param topicArn
- * @param protocol
- * @param endpoint
- * @see #subscribe(SubscribeRequest)
- */
- @Override
- public SubscribeResult subscribe(String topicArn, String protocol, String endpoint) {
- return amazonSNSToBeExtended.subscribe(topicArn, protocol, endpoint);
+ public SubscribeResponse subscribe(SubscribeRequest subscribeRequest) throws SubscriptionLimitExceededException,
+ FilterPolicyLimitExceededException, InvalidParameterException, InternalErrorException, NotFoundException,
+ AuthorizationErrorException, InvalidSecurityException, AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.subscribe(subscribeRequest);
}
/**
@@ -1060,83 +1501,153 @@ public SubscribeResult subscribe(String topicArn, String protocol, String endpoi
* @throws InternalErrorException Indicates an internal service error.
* @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
* @throws NotFoundException Indicates that the requested resource does not exist.
- * @sample AmazonSNS.Unsubscribe
+ * @throws InvalidSecurityException The credential signature isn't valid. You must use an HTTPS endpoint and sign your request using
+ * Signature Version 4.
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.Unsubscribe
* @see AWS API
* Documentation
*/
@Override
- public UnsubscribeResult unsubscribe(UnsubscribeRequest unsubscribeRequest) {
- return amazonSNSToBeExtended.unsubscribe(unsubscribeRequest);
+ public UnsubscribeResponse unsubscribe(UnsubscribeRequest unsubscribeRequest) throws InvalidParameterException,
+ InternalErrorException, AuthorizationErrorException, NotFoundException, InvalidSecurityException,
+ AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.unsubscribe(unsubscribeRequest);
}
/**
- * Simplified method form for invoking the Unsubscribe operation.
+ *
+ * List all tags added to the specified Amazon SNS topic. For an overview, see Amazon SNS Tags in the Amazon Simple
+ * Notification Service Developer Guide.
+ *
*
- * @param subscriptionArn
- * @see #unsubscribe(UnsubscribeRequest)
- */
- @Override
- public UnsubscribeResult unsubscribe(String subscriptionArn) {
- return amazonSNSToBeExtended.unsubscribe(subscriptionArn);
- }
-
- /**
- * Shuts down this client object, releasing any resources that might be held open. This is an optional method, and
- * callers are not expected to call it, but can if they want to explicitly release any open resources. Once a client
- * has been shutdown, it should not be used to make any more requests.
- */
+ * @param listTagsForResourceRequest
+ * @return Result of the ListTagsForResource operation returned by the service.
+ * @throws ResourceNotFoundException Can't tag resource. Verify that the topic exists.
+ * @throws TagPolicyException The request doesn't comply with the IAM tag policy. Correct your request and then retry it.
+ * @throws InvalidParameterException Indicates that a request parameter does not comply with the associated constraints.
+ * @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
+ * @throws ConcurrentAccessException Can't perform multiple operations on a tag simultaneously. Perform the operations sequentially.
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.ListTagsForResource
+ * @see AWS API
+ * Documentation */
@Override
- public void shutdown() {
- amazonSNSToBeExtended.shutdown();
+ public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest)
+ throws ResourceNotFoundException, TagPolicyException, InvalidParameterException, AuthorizationErrorException,
+ ConcurrentAccessException, AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.listTagsForResource(listTagsForResourceRequest);
}
/**
- * Returns additional metadata for a previously executed successful request, typically used for debugging issues
- * where a service isn't acting as expected. This data isn't considered part of the result data returned by an
- * operation, so it's available through this separate, diagnostic interface.
*
- * Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic
- * information for an executed request, you should use this method to retrieve it as soon as possible after
- * executing a request.
+ * Add tags to the specified Amazon SNS topic. For an overview, see Amazon SNS Tags in the Amazon SNS Developer
+ * Guide.
+ *
+ *
+ * When you use topic tags, keep the following guidelines in mind:
+ *
+ *
+ * -
+ *
+ * Adding more than 50 tags to a topic isn't recommended.
+ *
+ *
+ * -
+ *
+ * Tags don't have any semantic meaning. Amazon SNS interprets tags as character strings.
+ *
+ *
+ * -
+ *
+ * Tags are case-sensitive.
+ *
+ *
+ * -
+ *
+ * A new tag with a key identical to that of an existing tag overwrites the existing tag.
+ *
+ *
+ * -
+ *
+ * Tagging actions are limited to 10 TPS per AWS account, per AWS region. If your application requires a higher
+ * throughput, file a technical support
+ * request.
+ *
+ *
+ *
*
- * @param request The originally executed request.
- * @return The response metadata for the specified request, or null if none is available.
- */
+ * @param tagResourceRequest
+ * @return Result of the TagResource operation returned by the service.
+ * @throws ResourceNotFoundException Can't tag resource. Verify that the topic exists.
+ * @throws TagLimitExceededException Can't add more than 50 tags to a topic.
+ * @throws StaleTagException A tag has been added to a resource with the same ARN as a deleted resource. Wait a short while and then
+ * retry the operation.
+ * @throws TagPolicyException The request doesn't comply with the IAM tag policy. Correct your request and then retry it.
+ * @throws InvalidParameterException Indicates that a request parameter does not comply with the associated constraints.
+ * @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
+ * @throws ConcurrentAccessException Can't perform multiple operations on a tag simultaneously. Perform the operations sequentially.
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.TagResource
+ * @see AWS API
+ * Documentation */
@Override
- public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) {
- return amazonSNSToBeExtended.getCachedResponseMetadata(request);
+ public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws ResourceNotFoundException,
+ TagLimitExceededException, StaleTagException, TagPolicyException, InvalidParameterException,
+ AuthorizationErrorException, ConcurrentAccessException, AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.tagResource(tagResourceRequest);
}
/**
- * List all tags added to the specified Amazon SNS topic.
+ *
+ * Remove tags from the specified Amazon SNS topic. For an overview, see Amazon SNS Tags in the Amazon SNS Developer
+ * Guide.
+ *
*
- * @param request The originally executed request
- * @return Result of the ListTagsForResource operation returned by the service
- */
+ * @param untagResourceRequest
+ * @return Result of the UntagResource operation returned by the service.
+ * @throws ResourceNotFoundException Can't tag resource. Verify that the topic exists.
+ * @throws TagLimitExceededException Can't add more than 50 tags to a topic.
+ * @throws StaleTagException A tag has been added to a resource with the same ARN as a deleted resource. Wait a short while and then
+ * retry the operation.
+ * @throws TagPolicyException The request doesn't comply with the IAM tag policy. Correct your request and then retry it.
+ * @throws InvalidParameterException Indicates that a request parameter does not comply with the associated constraints.
+ * @throws AuthorizationErrorException Indicates that the user has been denied access to the requested resource.
+ * @throws ConcurrentAccessException Can't perform multiple operations on a tag simultaneously. Perform the operations sequentially.
+ * @throws SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SnsException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SnsClient.UntagResource
+ * @see AWS API
+ * Documentation */
@Override
- public ListTagsForResourceResult listTagsForResource(ListTagsForResourceRequest request) {
- return amazonSNSToBeExtended.listTagsForResource(request);
+ public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws ResourceNotFoundException,
+ TagLimitExceededException, StaleTagException, TagPolicyException, InvalidParameterException,
+ AuthorizationErrorException, ConcurrentAccessException, AwsServiceException, SdkClientException, SnsException {
+ return snsClientToBeExtended.untagResource(untagResourceRequest);
}
- /**
- * Add tags to the specified Amazon SNS topic. For an overview, see Amazon SNS Tags in the Amazon SNS Developer Guide.
- *
- * @param request The originally executed request
- * @return Result of the TagResource operation returned by the service.
- */
@Override
- public TagResourceResult tagResource(TagResourceRequest request) {
- return amazonSNSToBeExtended.tagResource(request);
+ public String serviceName() {
+ return snsClientToBeExtended.serviceName();
}
- /**
- * Remove tags from the specified Amazon SNS topic. For an overview, see Amazon SNS Tags in the Amazon SNS Developer Guide.
- *
- * @param request The originally executed request
- * @return Result of the UntagResource operation returned by the service.
- */
@Override
- public UntagResourceResult untagResource(UntagResourceRequest request) {
- return amazonSNSToBeExtended.untagResource(request);
+ public void close() {
+ snsClientToBeExtended.close();
}
}
diff --git a/src/main/java/software/amazon/sns/SNSExtendedClientConfiguration.java b/src/main/java/software/amazon/sns/SNSExtendedClientConfiguration.java
index ee42193..5313b5f 100644
--- a/src/main/java/software/amazon/sns/SNSExtendedClientConfiguration.java
+++ b/src/main/java/software/amazon/sns/SNSExtendedClientConfiguration.java
@@ -1,8 +1,8 @@
package software.amazon.sns;
-import com.amazonaws.services.s3.AmazonS3;
-import com.amazonaws.services.s3.model.SSEAwsKeyManagementParams;
+import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.payloadoffloading.PayloadStorageConfiguration;
+import software.amazon.payloadoffloading.ServerSideEncryptionStrategy;
public class SNSExtendedClientConfiguration extends PayloadStorageConfiguration {
static final int SNS_DEFAULT_MESSAGE_SIZE = 262144;
@@ -23,14 +23,14 @@ public SNSExtendedClientConfiguration withAlwaysThroughS3(boolean alwaysThroughS
}
@Override
- public SNSExtendedClientConfiguration withPayloadSupportEnabled(AmazonS3 s3, String s3BucketName) {
+ public SNSExtendedClientConfiguration withPayloadSupportEnabled(S3Client s3, String s3BucketName) {
this.setPayloadSupportEnabled(s3, s3BucketName);
return this;
}
@Override
- public SNSExtendedClientConfiguration withSSEAwsKeyManagementParams(SSEAwsKeyManagementParams sseAwsKeyManagementParams) {
- this.setSSEAwsKeyManagementParams(sseAwsKeyManagementParams);
+ public SNSExtendedClientConfiguration withServerSideEncryption(ServerSideEncryptionStrategy serverSideEncryptionStrategy) {
+ this.setServerSideEncryptionStrategy(serverSideEncryptionStrategy);
return this;
}
diff --git a/src/test/java/software/amazon/sns/AmazonSNSExtendedClientTest.java b/src/test/java/software/amazon/sns/AmazonSNSExtendedClientTest.java
index 42b0740..1020b22 100644
--- a/src/test/java/software/amazon/sns/AmazonSNSExtendedClientTest.java
+++ b/src/test/java/software/amazon/sns/AmazonSNSExtendedClientTest.java
@@ -1,18 +1,21 @@
package software.amazon.sns;
import com.amazon.sqs.javamessaging.SQSExtendedClientConstants;
-import com.amazonaws.AmazonClientException;
-import com.amazonaws.AmazonServiceException;
-import com.amazonaws.services.s3.AmazonS3;
-import com.amazonaws.services.s3.model.PutObjectRequest;
-import com.amazonaws.services.sns.AmazonSNS;
-import com.amazonaws.services.sns.AmazonSNSClient;
-import com.amazonaws.services.sns.model.MessageAttributeValue;
-import com.amazonaws.services.sns.model.PublishRequest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
+
+import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
+import software.amazon.awssdk.awscore.exception.AwsServiceException;
+import software.amazon.awssdk.core.exception.SdkClientException;
+import software.amazon.awssdk.core.exception.SdkException;
+import software.amazon.awssdk.core.sync.RequestBody;
+import software.amazon.awssdk.services.s3.S3Client;
+import software.amazon.awssdk.services.s3.model.PutObjectRequest;
+import software.amazon.awssdk.services.sns.SnsClient;
+import software.amazon.awssdk.services.sns.model.MessageAttributeValue;
+import software.amazon.awssdk.services.sns.model.PublishRequest;
import software.amazon.payloadoffloading.Util;
import java.util.Arrays;
@@ -32,15 +35,15 @@ public class AmazonSNSExtendedClientTest {
// should be > 1 and << SNSExtendedClientConfiguration.SNS_DEFAULT_MESSAGE_SIZE
private static final int ARBITRARY_SMALLER_THRESHOLD = 500;
- private AmazonSNS extendedSnsWithDefaultConfig;
- private AmazonSNS mockSnsBackend;
- private AmazonS3 mockS3;
+ private SnsClient extendedSnsWithDefaultConfig;
+ private SnsClient mockSnsBackend;
+ private S3Client mockS3;
@Before
public void setupClient() {
- mockS3 = mock(AmazonS3.class);
- mockSnsBackend = mock(AmazonSNS.class);
- when(mockS3.putObject(any(PutObjectRequest.class))).thenReturn(null);
+ mockS3 = mock(S3Client.class);
+ mockSnsBackend = mock(SnsClient.class);
+ when(mockS3.putObject(any(PutObjectRequest.class), any(RequestBody.class))).thenReturn(null);
SNSExtendedClientConfiguration snsExtendedClientConfiguration = new SNSExtendedClientConfiguration()
.withPayloadSupportEnabled(mockS3, S3_BUCKET_NAME)
@@ -53,17 +56,17 @@ public void setupClient() {
public void testPublishLargeMessageS3IsUsed() {
String messageBody = generateStringWithLength(MORE_THAN_SNS_SIZE_LIMIT);
- PublishRequest publishRequest = new PublishRequest(SNS_TOPIC_ARN, messageBody);
+ PublishRequest publishRequest = PublishRequest.builder().topicArn(SNS_TOPIC_ARN).message(messageBody).build();
extendedSnsWithDefaultConfig.publish(publishRequest);
- verify(mockS3, times(1)).putObject(any(PutObjectRequest.class));
+ verify(mockS3, times(1)).putObject(any(PutObjectRequest.class), any(RequestBody.class));
ArgumentCaptor publishRequestCaptor = ArgumentCaptor.forClass(PublishRequest.class);
verify(mockSnsBackend, times(1)).publish(publishRequestCaptor.capture());
- Map attributes = publishRequestCaptor.getValue().getMessageAttributes();
- Assert.assertEquals("Number", attributes.get(SQSExtendedClientConstants.RESERVED_ATTRIBUTE_NAME).getDataType());
+ Map attributes = publishRequestCaptor.getValue().messageAttributes();
+ Assert.assertEquals("Number", attributes.get(SQSExtendedClientConstants.RESERVED_ATTRIBUTE_NAME).dataType());
- Assert.assertEquals(messageBody.length(), (int) Integer.valueOf(attributes.get(SQSExtendedClientConstants.RESERVED_ATTRIBUTE_NAME).getStringValue()));
+ Assert.assertEquals(messageBody.length(), (int) Integer.valueOf(attributes.get(SQSExtendedClientConstants.RESERVED_ATTRIBUTE_NAME).stringValue()));
}
@Test
@@ -90,14 +93,14 @@ public void testPublishLargeMessageS3IsUsedWithS3Key() {
public void testPublishSmallMessageS3IsNotUsed() {
String messageBody = generateStringWithLength(SNSExtendedClientConfiguration.SNS_DEFAULT_MESSAGE_SIZE);
- PublishRequest publishRequest = new PublishRequest(SNS_TOPIC_ARN, messageBody);
+ PublishRequest publishRequest = PublishRequest.builder().topicArn(SNS_TOPIC_ARN).message(messageBody).build();
extendedSnsWithDefaultConfig.publish(publishRequest);
- verify(mockS3, never()).putObject(any(PutObjectRequest.class));
+ verify(mockS3, never()).putObject(any(PutObjectRequest.class), any(RequestBody.class));
ArgumentCaptor publishRequestCaptor = ArgumentCaptor.forClass(PublishRequest.class);
verify(mockSnsBackend, times(1)).publish(publishRequestCaptor.capture());
- Map attributes = publishRequestCaptor.getValue().getMessageAttributes();
+ Map attributes = publishRequestCaptor.getValue().messageAttributes();
Assert.assertTrue(attributes.isEmpty());
}
@@ -106,12 +109,19 @@ public void testPublishMessageWithLargePayloadSupportDisabledS3IsNotUsedAndSqsBa
String messageBody = generateStringWithLength(MORE_THAN_SNS_SIZE_LIMIT);
SNSExtendedClientConfiguration snsExtendedClientConfiguration = new SNSExtendedClientConfiguration()
.withPayloadSupportDisabled();
- AmazonSNS snsExtended = spy(new AmazonSNSExtendedClient(mockSnsBackend, snsExtendedClientConfiguration));
-
- PublishRequest publishRequest = new PublishRequest(SNS_TOPIC_ARN, messageBody);
+ SnsClient snsExtended = spy(new AmazonSNSExtendedClient(mockSnsBackend, snsExtendedClientConfiguration));
+
+ PublishRequest publishRequest = PublishRequest.builder()
+ .topicArn(SNS_TOPIC_ARN)
+ .message(messageBody)
+ .overrideConfiguration(
+ AwsRequestOverrideConfiguration.builder()
+ .putHeader(AmazonSNSExtendedClient.USER_AGENT_HEADER_NAME, AmazonSNSExtendedClient.USER_AGENT_HEADER)
+ .build())
+ .build();
snsExtended.publish(publishRequest);
- verify(mockS3, never()).putObject(any(PutObjectRequest.class));
+ verify(mockS3, never()).putObject(any(PutObjectRequest.class), any(RequestBody.class));
verify(mockSnsBackend).publish(eq(publishRequest));
}
@@ -119,14 +129,17 @@ public void testPublishMessageWithLargePayloadSupportDisabledS3IsNotUsedAndSqsBa
public void testPublishMessageWithJSONMessageStructureThrowsAmazonClientException() {
String messageBody = "{\"key1\":\"value1\",\"key2\":8.0}";
- PublishRequest publishRequest = new PublishRequest(SNS_TOPIC_ARN, messageBody);
- publishRequest.setMessageStructure(AmazonSNSExtendedClient.MULTIPLE_PROTOCOL_MESSAGE_STRUCTURE);
+ PublishRequest publishRequest = PublishRequest.builder()
+ .topicArn(SNS_TOPIC_ARN)
+ .message(messageBody)
+ .messageStructure(AmazonSNSExtendedClient.MULTIPLE_PROTOCOL_MESSAGE_STRUCTURE)
+ .build();
try {
extendedSnsWithDefaultConfig.publish(publishRequest);
Assert.fail("An exception should have been thrown.");
- } catch (AmazonClientException exception) {
+ } catch (SdkClientException exception) {
Assert.assertTrue(exception.getMessage().contains("SNS extended client does not support sending JSON messages"));
}
}
@@ -138,11 +151,11 @@ public void testPublishMessageWithAlwaysThroughS3AndSmallMessageS3IsUsed() {
.withPayloadSupportEnabled(mockS3, S3_BUCKET_NAME)
.withAlwaysThroughS3(true);
- AmazonSNS snsExtended = spy(new AmazonSNSExtendedClient(mock(AmazonSNSClient.class), snsExtendedClientConfiguration));
+ SnsClient snsExtended = spy(new AmazonSNSExtendedClient(mock(SnsClient.class), snsExtendedClientConfiguration));
- snsExtended.publish(SNS_TOPIC_ARN, messageBody);
+ snsExtended.publish(PublishRequest.builder().topicArn(SNS_TOPIC_ARN).message(messageBody).build());
- verify(mockS3, times(1)).putObject(any(PutObjectRequest.class));
+ verify(mockS3, times(1)).putObject(any(PutObjectRequest.class), any(RequestBody.class));
}
@Test
@@ -152,54 +165,57 @@ public void testPublishMessageWithSetMessageSizeThresholdThresholdIsHonored() {
.withPayloadSupportEnabled(mockS3, S3_BUCKET_NAME)
.withPayloadSizeThreshold(ARBITRARY_SMALLER_THRESHOLD);
- AmazonSNS snsExtended = spy(new AmazonSNSExtendedClient(mock(AmazonSNSClient.class), snsExtendedClientConfiguration));
+ SnsClient snsExtended = spy(new AmazonSNSExtendedClient(mock(SnsClient.class), snsExtendedClientConfiguration));
- snsExtended.publish(SNS_TOPIC_ARN, messageBody);
- verify(mockS3, times(1)).putObject(any(PutObjectRequest.class));
+ snsExtended.publish(PublishRequest.builder().topicArn(SNS_TOPIC_ARN).message(messageBody).build());
+ verify(mockS3, times(1)).putObject(any(PutObjectRequest.class), any(RequestBody.class));
}
@Test
public void testPublishRequestDoesNotAlterPublishRequest() {
String messageBody = generateStringWithLength(MORE_THAN_SNS_SIZE_LIMIT);
HashMap attrs = new HashMap<>();
- attrs.put("SampleKey", new MessageAttributeValue().withStringValue("value"));
+ attrs.put("SampleKey", MessageAttributeValue.builder().stringValue("value").build());
- PublishRequest publishRequest = new PublishRequest(SNS_TOPIC_ARN, messageBody);
- publishRequest.setMessageAttributes(attrs);
+ PublishRequest publishRequest = PublishRequest.builder()
+ .topicArn(SNS_TOPIC_ARN)
+ .message(messageBody)
+ .messageAttributes(attrs)
+ .build();
extendedSnsWithDefaultConfig.publish(publishRequest);
- Assert.assertEquals(messageBody, publishRequest.getMessage());
- Assert.assertEquals(attrs, publishRequest.getMessageAttributes());
+ Assert.assertEquals(messageBody, publishRequest.message());
+ Assert.assertEquals(attrs, publishRequest.messageAttributes());
}
@Test
- public void testThrowAmazonServiceExceptionWhenS3ThrowsAmazonServiceException() {
- when(mockS3.putObject(any(PutObjectRequest.class))).thenThrow(AmazonServiceException.class);
+ public void testThrowAmazonServiceExceptionWhenS3ThrowsAwsServiceException() {
+ when(mockS3.putObject(any(PutObjectRequest.class), any(RequestBody.class))).thenThrow(AwsServiceException.class);
String messageBody = generateStringWithLength(MORE_THAN_SNS_SIZE_LIMIT);
- PublishRequest publishRequest = new PublishRequest(SNS_TOPIC_ARN, messageBody);
+ PublishRequest publishRequest = PublishRequest.builder().topicArn(SNS_TOPIC_ARN).message(messageBody).build();
try {
extendedSnsWithDefaultConfig.publish(publishRequest);
Assert.fail("An exception should have been thrown.");
- } catch (AmazonServiceException exception) {
+ } catch (SdkException exception) {
Assert.assertTrue(exception.getMessage().contains("Failed to store the message content in an S3 object."));
}
}
@Test
- public void testThrowAmazonClientExceptionWhenS3ThrowsAmazonClientException() {
- when(mockS3.putObject(any(PutObjectRequest.class))).thenThrow(AmazonClientException.class);
+ public void testThrowAmazonClientExceptionWhenS3ThrowsSdkClientException() {
+ when(mockS3.putObject(any(PutObjectRequest.class), any(RequestBody.class))).thenThrow(SdkClientException.class);
String messageBody = generateStringWithLength(MORE_THAN_SNS_SIZE_LIMIT);
- PublishRequest publishRequest = new PublishRequest(SNS_TOPIC_ARN, messageBody);
+ PublishRequest publishRequest = PublishRequest.builder().topicArn(SNS_TOPIC_ARN).message(messageBody).build();
try {
extendedSnsWithDefaultConfig.publish(publishRequest);
Assert.fail("An exception should have been thrown");
- } catch (AmazonClientException exception) {
+ } catch (SdkException exception) {
Assert.assertTrue(exception.getMessage().contains("Failed to store the message content in an S3 object."));
}
}
@@ -208,17 +224,24 @@ public void testThrowAmazonClientExceptionWhenS3ThrowsAmazonClientException() {
public void testThrowAmazonClientExceptionWhenReservedAttributeNameIsAlreadyUsed() {
String messageBody = generateStringWithLength(MORE_THAN_SNS_SIZE_LIMIT);
- MessageAttributeValue messageAttributeValue = new MessageAttributeValue();
- messageAttributeValue.setDataType("Number");
- messageAttributeValue.setStringValue(Util.getStringSizeInBytes(messageBody) + "");
- PublishRequest publishRequest = new PublishRequest(SNS_TOPIC_ARN, messageBody);
- publishRequest.addMessageAttributesEntry(SQSExtendedClientConstants.RESERVED_ATTRIBUTE_NAME, messageAttributeValue);
+ MessageAttributeValue messageAttributeValue = MessageAttributeValue.builder()
+ .dataType("Number")
+ .stringValue(Util.getStringSizeInBytes(messageBody) + "")
+ .build();
+ HashMap attrs = new HashMap<>();
+ attrs.put(SQSExtendedClientConstants.RESERVED_ATTRIBUTE_NAME, messageAttributeValue);
+
+ PublishRequest publishRequest = PublishRequest.builder()
+ .topicArn(SNS_TOPIC_ARN)
+ .message(messageBody)
+ .messageAttributes(attrs)
+ .build();
try {
extendedSnsWithDefaultConfig.publish(publishRequest);
Assert.fail("An exception should have been thrown");
- } catch (AmazonClientException exception) {
+ } catch (SdkClientException exception) {
Assert.assertTrue(exception.getMessage().contains("Message attribute name " +
SQSExtendedClientConstants.RESERVED_ATTRIBUTE_NAME + " is reserved for use by SNS extended client."));
}
@@ -232,17 +255,20 @@ public void testThrowAmazonClientExceptionWhenThereAreMoreThanAllowedMessageAttr
HashMap attrs = new HashMap<>();
for (int index = 0; index < attributeNumber; index++) {
- attrs.put("key" + index, new MessageAttributeValue().withDataType("String").withStringValue("value" + index));
+ attrs.put("key" + index, MessageAttributeValue.builder().dataType("String").stringValue("value" + index).build());
}
- PublishRequest publishRequest = new PublishRequest(SNS_TOPIC_ARN, messageBody);
- publishRequest.setMessageAttributes(attrs);
+ PublishRequest publishRequest = PublishRequest.builder()
+ .topicArn(SNS_TOPIC_ARN)
+ .message(messageBody)
+ .messageAttributes(attrs)
+ .build();
try {
extendedSnsWithDefaultConfig.publish(publishRequest);
Assert.fail("An exception should have been thrown");
- } catch (AmazonClientException exception) {
+ } catch (SdkClientException exception) {
Assert.assertTrue(exception.getMessage().contains("Number of message attributes [" + attributeNumber
+ "] exceeds the maximum allowed for large-payload messages ["
+ SQSExtendedClientConstants.MAX_ALLOWED_ATTRIBUTES + "]."));
@@ -255,11 +281,15 @@ public void testThrowAmazonClientExceptionWhenSizeOfMessageAttributeKeyIsLargerT
String attributeKey = generateStringWithLength(MORE_THAN_SNS_SIZE_LIMIT);
String attributeValue = generateStringWithLength(LESS_THAN_SNS_SIZE_LIMIT);
- MessageAttributeValue messageAttributeValue = new MessageAttributeValue();
- messageAttributeValue.withStringValue(attributeValue);
+ MessageAttributeValue messageAttributeValue = MessageAttributeValue.builder().stringValue(attributeValue).build();
+ HashMap attrs = new HashMap<>();
+ attrs.put(attributeKey, messageAttributeValue);
- PublishRequest publishRequest = new PublishRequest(SNS_TOPIC_ARN, messageBody);
- publishRequest.addMessageAttributesEntry(attributeKey, messageAttributeValue);
+ PublishRequest publishRequest = PublishRequest.builder()
+ .topicArn(SNS_TOPIC_ARN)
+ .message(messageBody)
+ .messageAttributes(attrs)
+ .build();
Long expectedSize = Util.getStringSizeInBytes(attributeKey) + Util.getStringSizeInBytes(attributeValue);
@@ -267,7 +297,7 @@ public void testThrowAmazonClientExceptionWhenSizeOfMessageAttributeKeyIsLargerT
extendedSnsWithDefaultConfig.publish(publishRequest);
Assert.fail("An exception should have been thrown");
- } catch (AmazonClientException exception) {
+ } catch (SdkClientException exception) {
Assert.assertTrue(exception.getMessage().contains("Total size of Message attributes is "
+ expectedSize + " bytes which is larger than the threshold of " + SNSExtendedClientConfiguration.SNS_DEFAULT_MESSAGE_SIZE
+ " Bytes. Consider including the payload in the message body instead of message attributes."));
@@ -280,11 +310,15 @@ public void testThrowAmazonClientExceptionWhenSizeOfMessageAttributeValueIsLarge
String attributeKey = generateStringWithLength(LESS_THAN_SNS_SIZE_LIMIT);
String attributeValue = generateStringWithLength(MORE_THAN_SNS_SIZE_LIMIT);
- MessageAttributeValue messageAttributeValue = new MessageAttributeValue();
- messageAttributeValue.withStringValue(attributeValue);
+ MessageAttributeValue messageAttributeValue = MessageAttributeValue.builder().stringValue(attributeValue).build();
+ HashMap attrs = new HashMap<>();
+ attrs.put(attributeKey, messageAttributeValue);
- PublishRequest publishRequest = new PublishRequest(SNS_TOPIC_ARN, messageBody);
- publishRequest.addMessageAttributesEntry(attributeKey, messageAttributeValue);
+ PublishRequest publishRequest = PublishRequest.builder()
+ .topicArn(SNS_TOPIC_ARN)
+ .message(messageBody)
+ .messageAttributes(attrs)
+ .build();
long expectedSize = Util.getStringSizeInBytes(attributeKey) + Util.getStringSizeInBytes(attributeValue);
@@ -292,7 +326,7 @@ public void testThrowAmazonClientExceptionWhenSizeOfMessageAttributeValueIsLarge
extendedSnsWithDefaultConfig.publish(publishRequest);
Assert.fail("An exception should have been thrown");
- } catch (AmazonClientException exception) {
+ } catch (SdkClientException exception) {
Assert.assertTrue(exception.getMessage().contains("Total size of Message attributes is "
+ expectedSize + " bytes which is larger than the threshold of " + SNSExtendedClientConfiguration.SNS_DEFAULT_MESSAGE_SIZE
+ " Bytes. Consider including the payload in the message body instead of message attributes."));