From d3a10cfbb4ab823e5cf63b3ea5ba4ae3fbf905f9 Mon Sep 17 00:00:00 2001 From: AWS Mobile SDK Bot <46607340+awsmobilesdk@users.noreply.github.com> Date: Tue, 13 Sep 2022 18:09:05 -0700 Subject: [PATCH] feat(aws-android-sdk-sns): update models to latest (#2999) Co-authored-by: Divyesh Chitroda --- .../auth/policy/actions/SNSActions.java | 6 + .../com/amazonaws/services/sns/AmazonSNS.java | 54 ++++ .../services/sns/AmazonSNSAsync.java | 122 ++++++++ .../services/sns/AmazonSNSAsyncClient.java | 155 ++++++++++ .../services/sns/AmazonSNSClient.java | 89 ++++++ .../sns/model/CreateTopicRequest.java | 128 +++++++- .../model/GetDataProtectionPolicyRequest.java | 175 +++++++++++ .../model/GetDataProtectionPolicyResult.java | 121 ++++++++ .../model/PutDataProtectionPolicyRequest.java | 284 ++++++++++++++++++ .../CreateTopicRequestMarshaller.java | 5 + ...DataProtectionPolicyRequestMarshaller.java | 52 ++++ ...rotectionPolicyResultStaxUnmarshaller.java | 72 +++++ ...DataProtectionPolicyRequestMarshaller.java | 57 ++++ 13 files changed, 1319 insertions(+), 1 deletion(-) create mode 100644 aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/GetDataProtectionPolicyRequest.java create mode 100644 aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/GetDataProtectionPolicyResult.java create mode 100644 aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/PutDataProtectionPolicyRequest.java create mode 100644 aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/transform/GetDataProtectionPolicyRequestMarshaller.java create mode 100644 aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/transform/GetDataProtectionPolicyResultStaxUnmarshaller.java create mode 100644 aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/transform/PutDataProtectionPolicyRequestMarshaller.java diff --git a/aws-android-sdk-sns/src/main/java/com/amazonaws/auth/policy/actions/SNSActions.java b/aws-android-sdk-sns/src/main/java/com/amazonaws/auth/policy/actions/SNSActions.java index 1ce178894d..796dd5d5aa 100644 --- a/aws-android-sdk-sns/src/main/java/com/amazonaws/auth/policy/actions/SNSActions.java +++ b/aws-android-sdk-sns/src/main/java/com/amazonaws/auth/policy/actions/SNSActions.java @@ -58,6 +58,9 @@ public enum SNSActions implements Action { /** Action for the DeleteTopic operation. */ DeleteTopic("sns:DeleteTopic"), + /** Action for the GetDataProtectionPolicy operation. */ + GetDataProtectionPolicy("sns:GetDataProtectionPolicy"), + /** Action for the GetEndpointAttributes operation. */ GetEndpointAttributes("sns:GetEndpointAttributes"), @@ -112,6 +115,9 @@ public enum SNSActions implements Action { /** Action for the PublishBatch operation. */ PublishBatch("sns:PublishBatch"), + /** Action for the PutDataProtectionPolicy operation. */ + PutDataProtectionPolicy("sns:PutDataProtectionPolicy"), + /** Action for the RemovePermission operation. */ RemovePermission("sns:RemovePermission"), diff --git a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/AmazonSNS.java b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/AmazonSNS.java index 288fea17f3..adec28b8ff 100644 --- a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/AmazonSNS.java +++ b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/AmazonSNS.java @@ -533,6 +533,33 @@ DeleteSMSSandboxPhoneNumberResult deleteSMSSandboxPhoneNumber( void deleteTopic(DeleteTopicRequest deleteTopicRequest) throws AmazonClientException, AmazonServiceException; + /** + *

+ * Retrieves the specified inline DataProtectionPolicy document + * that is stored in the specified Amazon SNS topic. + *

+ * + * @param getDataProtectionPolicyRequest + * @return getDataProtectionPolicyResult The response from the + * GetDataProtectionPolicy service method, as returned by Amazon + * Simple Notification Service. + * @throws InvalidParameterException + * @throws InternalErrorException + * @throws NotFoundException + * @throws AuthorizationErrorException + * @throws InvalidSecurityException + * @throws AmazonClientException If any internal errors are encountered + * inside the client while attempting to make the request or + * handle the response. For example if a network connection is + * not available. + * @throws AmazonServiceException If an error response is returned by Amazon + * Simple Notification Service indicating either a problem with + * the data in the request, or a server side issue. + */ + GetDataProtectionPolicyResult getDataProtectionPolicy( + GetDataProtectionPolicyRequest getDataProtectionPolicyRequest) + throws AmazonClientException, AmazonServiceException; + /** *

* Retrieves the endpoint attributes for a device on one of the supported @@ -1111,6 +1138,7 @@ OptInPhoneNumberResult optInPhoneNumber(OptInPhoneNumberRequest optInPhoneNumber * @throws KMSThrottlingException * @throws KMSAccessDeniedException * @throws InvalidSecurityException + * @throws ValidationException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is @@ -1186,6 +1214,7 @@ PublishResult publish(PublishRequest publishRequest) throws AmazonClientExceptio * @throws KMSThrottlingException * @throws KMSAccessDeniedException * @throws InvalidSecurityException + * @throws ValidationException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is @@ -1197,6 +1226,29 @@ PublishResult publish(PublishRequest publishRequest) throws AmazonClientExceptio PublishBatchResult publishBatch(PublishBatchRequest publishBatchRequest) throws AmazonClientException, AmazonServiceException; + /** + *

+ * Adds or updates an inline policy document that is stored in the specified + * Amazon SNS topic. + *

+ * + * @param putDataProtectionPolicyRequest + * @throws InvalidParameterException + * @throws InternalErrorException + * @throws NotFoundException + * @throws AuthorizationErrorException + * @throws InvalidSecurityException + * @throws AmazonClientException If any internal errors are encountered + * inside the client while attempting to make the request or + * handle the response. For example if a network connection is + * not available. + * @throws AmazonServiceException If an error response is returned by Amazon + * Simple Notification Service indicating either a problem with + * the data in the request, or a server side issue. + */ + void putDataProtectionPolicy(PutDataProtectionPolicyRequest putDataProtectionPolicyRequest) + throws AmazonClientException, AmazonServiceException; + /** *

* Removes a statement from a topic's access control policy. @@ -2474,6 +2526,7 @@ void setTopicAttributes(String topicArn, String attributeName, String attributeV * @throws KMSThrottlingException * @throws KMSAccessDeniedException * @throws InvalidSecurityException + * @throws ValidationException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is @@ -2657,6 +2710,7 @@ PublishResult publish(String topicArn, String message) throws AmazonClientExcept * @throws KMSThrottlingException * @throws KMSAccessDeniedException * @throws InvalidSecurityException + * @throws ValidationException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is diff --git a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/AmazonSNSAsync.java b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/AmazonSNSAsync.java index a92664de16..69cc71b42e 100644 --- a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/AmazonSNSAsync.java +++ b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/AmazonSNSAsync.java @@ -985,6 +985,65 @@ Future deleteTopicAsync(DeleteTopicRequest deleteTopicRequest, AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException; + /** + *

+ * Retrieves the specified inline DataProtectionPolicy document + * that is stored in the specified Amazon SNS topic. + *

+ * + * @param getDataProtectionPolicyRequest + * @return A Java Future object containing the response from the + * GetDataProtectionPolicy service method, as returned by Amazon + * Simple Notification Service. + * @throws InvalidParameterException + * @throws InternalErrorException + * @throws NotFoundException + * @throws AuthorizationErrorException + * @throws InvalidSecurityException + * @throws AmazonClientException If any internal errors are encountered + * inside the client while attempting to make the request or + * handle the response. For example if a network connection is + * not available. + * @throws AmazonServiceException If an error response is returned by Amazon + * Simple Notification Service indicating either a problem with + * the data in the request, or a server side issue. + */ + Future getDataProtectionPolicyAsync( + GetDataProtectionPolicyRequest getDataProtectionPolicyRequest) + throws AmazonServiceException, AmazonClientException; + + /** + *

+ * Retrieves the specified inline DataProtectionPolicy document + * that is stored in the specified Amazon SNS topic. + *

+ * + * @param getDataProtectionPolicyRequest + * @param asyncHandler Asynchronous callback handler for events in the + * life-cycle of the request. Users could provide the + * implementation of the four callback methods in this interface + * to process the operation result or handle the exception. + * @return A Java Future object containing the response from the + * GetDataProtectionPolicy service method, as returned by Amazon + * Simple Notification Service. + * @throws InvalidParameterException + * @throws InternalErrorException + * @throws NotFoundException + * @throws AuthorizationErrorException + * @throws InvalidSecurityException + * @throws AmazonClientException If any internal errors are encountered + * inside the client while attempting to make the request or + * handle the response. For example if a network connection is + * not available. + * @throws AmazonServiceException If an error response is returned by Amazon + * Simple Notification Service indicating either a problem with + * the data in the request, or a server side issue. + */ + Future getDataProtectionPolicyAsync( + GetDataProtectionPolicyRequest getDataProtectionPolicyRequest, + AsyncHandler asyncHandler) + throws AmazonServiceException, AmazonClientException; + /** *

* Retrieves the endpoint attributes for a device on one of the supported @@ -2178,6 +2237,7 @@ Future optInPhoneNumberAsync( * @throws KMSThrottlingException * @throws KMSAccessDeniedException * @throws InvalidSecurityException + * @throws ValidationException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is @@ -2248,6 +2308,7 @@ Future publishAsync(PublishRequest publishRequest) * @throws KMSThrottlingException * @throws KMSAccessDeniedException * @throws InvalidSecurityException + * @throws ValidationException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is @@ -2325,6 +2386,7 @@ Future publishAsync(PublishRequest publishRequest, * @throws KMSThrottlingException * @throws KMSAccessDeniedException * @throws InvalidSecurityException + * @throws ValidationException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is @@ -2405,6 +2467,7 @@ Future publishBatchAsync(PublishBatchRequest publishBatchReq * @throws KMSThrottlingException * @throws KMSAccessDeniedException * @throws InvalidSecurityException + * @throws ValidationException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is @@ -2417,6 +2480,65 @@ Future publishBatchAsync(PublishBatchRequest publishBatchReq AsyncHandler asyncHandler) throws AmazonServiceException, AmazonClientException; + /** + *

+ * Adds or updates an inline policy document that is stored in the specified + * Amazon SNS topic. + *

+ * + * @param putDataProtectionPolicyRequest + * @return A Java Future object containing the response from the + * PutDataProtectionPolicy service method, as returned by Amazon + * Simple Notification Service. + * @throws InvalidParameterException + * @throws InternalErrorException + * @throws NotFoundException + * @throws AuthorizationErrorException + * @throws InvalidSecurityException + * @throws AmazonClientException If any internal errors are encountered + * inside the client while attempting to make the request or + * handle the response. For example if a network connection is + * not available. + * @throws AmazonServiceException If an error response is returned by Amazon + * Simple Notification Service indicating either a problem with + * the data in the request, or a server side issue. + */ + Future putDataProtectionPolicyAsync( + PutDataProtectionPolicyRequest putDataProtectionPolicyRequest) + throws AmazonServiceException, AmazonClientException; + + /** + *

+ * Adds or updates an inline policy document that is stored in the specified + * Amazon SNS topic. + *

+ * + * @param putDataProtectionPolicyRequest + * @param asyncHandler Asynchronous callback handler for events in the + * life-cycle of the request. Users could provide the + * implementation of the four callback methods in this interface + * to process the operation result or handle the exception. + * @return A Java Future object containing the response from the + * PutDataProtectionPolicy service method, as returned by Amazon + * Simple Notification Service. + * @throws InvalidParameterException + * @throws InternalErrorException + * @throws NotFoundException + * @throws AuthorizationErrorException + * @throws InvalidSecurityException + * @throws AmazonClientException If any internal errors are encountered + * inside the client while attempting to make the request or + * handle the response. For example if a network connection is + * not available. + * @throws AmazonServiceException If an error response is returned by Amazon + * Simple Notification Service indicating either a problem with + * the data in the request, or a server side issue. + */ + Future putDataProtectionPolicyAsync( + PutDataProtectionPolicyRequest putDataProtectionPolicyRequest, + AsyncHandler asyncHandler) + throws AmazonServiceException, AmazonClientException; + /** *

* Removes a statement from a topic's access control policy. diff --git a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/AmazonSNSAsyncClient.java b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/AmazonSNSAsyncClient.java index 1b296c12f9..27604976db 100644 --- a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/AmazonSNSAsyncClient.java +++ b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/AmazonSNSAsyncClient.java @@ -1391,6 +1391,81 @@ public Void call() throws Exception { }); } + /** + *

+ * Retrieves the specified inline DataProtectionPolicy document + * that is stored in the specified Amazon SNS topic. + *

+ * + * @param getDataProtectionPolicyRequest + * @return A Java Future object containing the response from the + * GetDataProtectionPolicy service method, as returned by Amazon + * Simple Notification Service. + * @throws InvalidParameterException + * @throws InternalErrorException + * @throws NotFoundException + * @throws AuthorizationErrorException + * @throws InvalidSecurityException + * @throws AmazonClientException If any internal errors are encountered + * inside the client while attempting to make the request or + * handle the response. For example if a network connection is + * not available. + * @throws AmazonServiceException If an error response is returned by Amazon + * Simple Notification Service indicating either a problem with + * the data in the request, or a server side issue. + */ + public Future getDataProtectionPolicyAsync( + final GetDataProtectionPolicyRequest getDataProtectionPolicyRequest) + throws AmazonServiceException, AmazonClientException { + return executorService.submit(new Callable() { + public GetDataProtectionPolicyResult call() throws Exception { + return getDataProtectionPolicy(getDataProtectionPolicyRequest); + } + }); + } + + /** + *

+ * Retrieves the specified inline DataProtectionPolicy document + * that is stored in the specified Amazon SNS topic. + *

+ * + * @param getDataProtectionPolicyRequest + * @return A Java Future object containing the response from the + * GetDataProtectionPolicy service method, as returned by Amazon + * Simple Notification Service. + * @throws InvalidParameterException + * @throws InternalErrorException + * @throws NotFoundException + * @throws AuthorizationErrorException + * @throws InvalidSecurityException + * @throws AmazonClientException If any internal errors are encountered + * inside the client while attempting to make the request or + * handle the response. For example if a network connection is + * not available. + * @throws AmazonServiceException If an error response is returned by Amazon + * Simple Notification Service indicating either a problem with + * the data in the request, or a server side issue. + */ + public Future getDataProtectionPolicyAsync( + final GetDataProtectionPolicyRequest getDataProtectionPolicyRequest, + final AsyncHandler asyncHandler) + throws AmazonServiceException, AmazonClientException { + return executorService.submit(new Callable() { + public GetDataProtectionPolicyResult call() throws Exception { + GetDataProtectionPolicyResult result = null; + try { + result = getDataProtectionPolicy(getDataProtectionPolicyRequest); + } catch (Exception ex) { + asyncHandler.onError(ex); + throw ex; + } + asyncHandler.onSuccess(getDataProtectionPolicyRequest, result); + return result; + } + }); + } + /** *

* Retrieves the endpoint attributes for a device on one of the supported @@ -2840,6 +2915,7 @@ public OptInPhoneNumberResult call() throws Exception { * @throws KMSThrottlingException * @throws KMSAccessDeniedException * @throws InvalidSecurityException + * @throws ValidationException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is @@ -2912,6 +2988,7 @@ public PublishResult call() throws Exception { * @throws KMSThrottlingException * @throws KMSAccessDeniedException * @throws InvalidSecurityException + * @throws ValidationException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is @@ -3003,6 +3080,7 @@ public PublishResult call() throws Exception { * @throws KMSThrottlingException * @throws KMSAccessDeniedException * @throws InvalidSecurityException + * @throws ValidationException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is @@ -3086,6 +3164,7 @@ public PublishBatchResult call() throws Exception { * @throws KMSThrottlingException * @throws KMSAccessDeniedException * @throws InvalidSecurityException + * @throws ValidationException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is @@ -3113,6 +3192,82 @@ public PublishBatchResult call() throws Exception { }); } + /** + *

+ * Adds or updates an inline policy document that is stored in the specified + * Amazon SNS topic. + *

+ * + * @param putDataProtectionPolicyRequest + * @return A Java Future object containing the response from the + * PutDataProtectionPolicy service method, as returned by Amazon + * Simple Notification Service. + * @throws InvalidParameterException + * @throws InternalErrorException + * @throws NotFoundException + * @throws AuthorizationErrorException + * @throws InvalidSecurityException + * @throws AmazonClientException If any internal errors are encountered + * inside the client while attempting to make the request or + * handle the response. For example if a network connection is + * not available. + * @throws AmazonServiceException If an error response is returned by Amazon + * Simple Notification Service indicating either a problem with + * the data in the request, or a server side issue. + */ + public Future putDataProtectionPolicyAsync( + final PutDataProtectionPolicyRequest putDataProtectionPolicyRequest) + throws AmazonServiceException, AmazonClientException { + return executorService.submit(new Callable() { + public Void call() throws Exception { + putDataProtectionPolicy(putDataProtectionPolicyRequest); + return null; + } + }); + } + + /** + *

+ * Adds or updates an inline policy document that is stored in the specified + * Amazon SNS topic. + *

+ * + * @param putDataProtectionPolicyRequest + * @return A Java Future object containing the response from the + * PutDataProtectionPolicy service method, as returned by Amazon + * Simple Notification Service. + * @throws InvalidParameterException + * @throws InternalErrorException + * @throws NotFoundException + * @throws AuthorizationErrorException + * @throws InvalidSecurityException + * @throws AmazonClientException If any internal errors are encountered + * inside the client while attempting to make the request or + * handle the response. For example if a network connection is + * not available. + * @throws AmazonServiceException If an error response is returned by Amazon + * Simple Notification Service indicating either a problem with + * the data in the request, or a server side issue. + */ + public Future putDataProtectionPolicyAsync( + final PutDataProtectionPolicyRequest putDataProtectionPolicyRequest, + final AsyncHandler asyncHandler) + throws AmazonServiceException, AmazonClientException { + return executorService.submit(new Callable() { + public Void call() throws Exception { + Void result = null; + try { + putDataProtectionPolicy(putDataProtectionPolicyRequest); + } catch (Exception ex) { + asyncHandler.onError(ex); + throw ex; + } + asyncHandler.onSuccess(putDataProtectionPolicyRequest, result); + return result; + } + }); + } + /** *

* Removes a statement from a topic's access control policy. diff --git a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/AmazonSNSClient.java b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/AmazonSNSClient.java index 4fd25a3239..023a34f10b 100644 --- a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/AmazonSNSClient.java +++ b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/AmazonSNSClient.java @@ -1010,6 +1010,51 @@ public void deleteTopic(DeleteTopicRequest deleteTopicRequest) } } + /** + *

+ * Retrieves the specified inline DataProtectionPolicy document + * that is stored in the specified Amazon SNS topic. + *

+ * + * @param getDataProtectionPolicyRequest + * @return getDataProtectionPolicyResult The response from the + * GetDataProtectionPolicy service method, as returned by Amazon + * Simple Notification Service. + * @throws InvalidParameterException + * @throws InternalErrorException + * @throws NotFoundException + * @throws AuthorizationErrorException + * @throws InvalidSecurityException + * @throws AmazonClientException If any internal errors are encountered + * inside the client while attempting to make the request or + * handle the response. For example if a network connection is + * not available. + * @throws AmazonServiceException If an error response is returned by Amazon + * Simple Notification Service indicating either a problem with + * the data in the request, or a server side issue. + */ + public GetDataProtectionPolicyResult getDataProtectionPolicy( + GetDataProtectionPolicyRequest getDataProtectionPolicyRequest) + throws AmazonServiceException, AmazonClientException { + ExecutionContext executionContext = createExecutionContext(getDataProtectionPolicyRequest); + AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); + awsRequestMetrics.startEvent(Field.ClientExecuteTime); + Request request = null; + Response response = null; + try { + request = new GetDataProtectionPolicyRequestMarshaller() + .marshall(getDataProtectionPolicyRequest); + // Binds the request metrics to the current request. + request.setAWSRequestMetrics(awsRequestMetrics); + response = invoke(request, new GetDataProtectionPolicyResultStaxUnmarshaller(), + executionContext); + return response.getAwsResponse(); + } finally { + awsRequestMetrics.endEvent(Field.ClientExecuteTime); + endClientExecution(awsRequestMetrics, request, response); + } + } + /** *

* Retrieves the endpoint attributes for a device on one of the supported @@ -1873,6 +1918,7 @@ public OptInPhoneNumberResult optInPhoneNumber(OptInPhoneNumberRequest optInPhon * @throws KMSThrottlingException * @throws KMSAccessDeniedException * @throws InvalidSecurityException + * @throws ValidationException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is @@ -1964,6 +2010,7 @@ public PublishResult publish(PublishRequest publishRequest) * @throws KMSThrottlingException * @throws KMSAccessDeniedException * @throws InvalidSecurityException + * @throws ValidationException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is @@ -1991,6 +2038,46 @@ public PublishBatchResult publishBatch(PublishBatchRequest publishBatchRequest) } } + /** + *

+ * Adds or updates an inline policy document that is stored in the specified + * Amazon SNS topic. + *

+ * + * @param putDataProtectionPolicyRequest + * @throws InvalidParameterException + * @throws InternalErrorException + * @throws NotFoundException + * @throws AuthorizationErrorException + * @throws InvalidSecurityException + * @throws AmazonClientException If any internal errors are encountered + * inside the client while attempting to make the request or + * handle the response. For example if a network connection is + * not available. + * @throws AmazonServiceException If an error response is returned by Amazon + * Simple Notification Service indicating either a problem with + * the data in the request, or a server side issue. + */ + public void putDataProtectionPolicy( + PutDataProtectionPolicyRequest putDataProtectionPolicyRequest) + throws AmazonServiceException, AmazonClientException { + ExecutionContext executionContext = createExecutionContext(putDataProtectionPolicyRequest); + AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); + awsRequestMetrics.startEvent(Field.ClientExecuteTime); + Request request = null; + Response response = null; + try { + request = new PutDataProtectionPolicyRequestMarshaller() + .marshall(putDataProtectionPolicyRequest); + // Binds the request metrics to the current request. + request.setAWSRequestMetrics(awsRequestMetrics); + invoke(request, null, executionContext); + } finally { + awsRequestMetrics.endEvent(Field.ClientExecuteTime); + endClientExecution(awsRequestMetrics, request, response); + } + } + /** *

* Removes a statement from a topic's access control policy. @@ -3519,6 +3606,7 @@ public void unsubscribe(String subscriptionArn) * @throws KMSThrottlingException * @throws KMSAccessDeniedException * @throws InvalidSecurityException + * @throws ValidationException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is @@ -3707,6 +3795,7 @@ public PublishResult publish(String topicArn, String message) * @throws KMSThrottlingException * @throws KMSAccessDeniedException * @throws InvalidSecurityException + * @throws ValidationException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is diff --git a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/CreateTopicRequest.java b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/CreateTopicRequest.java index a3057a2e66..1661aad00f 100644 --- a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/CreateTopicRequest.java +++ b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/CreateTopicRequest.java @@ -159,6 +159,22 @@ public class CreateTopicRequest extends AmazonWebServiceRequest implements Seria */ private java.util.List tags = new java.util.ArrayList(); + /** + *

+ * The body of the policy document you want to use for this topic. + *

+ *

+ * You can only add one policy per topic. + *

+ *

+ * The policy must be in JSON string format. + *

+ *

+ * Length Constraints: Maximum length of 30,720. + *

+ */ + private String dataProtectionPolicy; + /** * Default constructor for CreateTopicRequest object. Callers should use the * setter or fluent setter (with...) methods to initialize any additional @@ -1145,6 +1161,107 @@ public CreateTopicRequest withTags(java.util.Collection tags) { return this; } + /** + *

+ * The body of the policy document you want to use for this topic. + *

+ *

+ * You can only add one policy per topic. + *

+ *

+ * The policy must be in JSON string format. + *

+ *

+ * Length Constraints: Maximum length of 30,720. + *

+ * + * @return

+ * The body of the policy document you want to use for this topic. + *

+ *

+ * You can only add one policy per topic. + *

+ *

+ * The policy must be in JSON string format. + *

+ *

+ * Length Constraints: Maximum length of 30,720. + *

+ */ + public String getDataProtectionPolicy() { + return dataProtectionPolicy; + } + + /** + *

+ * The body of the policy document you want to use for this topic. + *

+ *

+ * You can only add one policy per topic. + *

+ *

+ * The policy must be in JSON string format. + *

+ *

+ * Length Constraints: Maximum length of 30,720. + *

+ * + * @param dataProtectionPolicy

+ * The body of the policy document you want to use for this + * topic. + *

+ *

+ * You can only add one policy per topic. + *

+ *

+ * The policy must be in JSON string format. + *

+ *

+ * Length Constraints: Maximum length of 30,720. + *

+ */ + public void setDataProtectionPolicy(String dataProtectionPolicy) { + this.dataProtectionPolicy = dataProtectionPolicy; + } + + /** + *

+ * The body of the policy document you want to use for this topic. + *

+ *

+ * You can only add one policy per topic. + *

+ *

+ * The policy must be in JSON string format. + *

+ *

+ * Length Constraints: Maximum length of 30,720. + *

+ *

+ * Returns a reference to this object so that method calls can be chained + * together. + * + * @param dataProtectionPolicy

+ * The body of the policy document you want to use for this + * topic. + *

+ *

+ * You can only add one policy per topic. + *

+ *

+ * The policy must be in JSON string format. + *

+ *

+ * Length Constraints: Maximum length of 30,720. + *

+ * @return A reference to this updated object so that method calls can be + * chained together. + */ + public CreateTopicRequest withDataProtectionPolicy(String dataProtectionPolicy) { + this.dataProtectionPolicy = dataProtectionPolicy; + return this; + } + /** * Returns a string representation of this object; useful for testing and * debugging. @@ -1161,7 +1278,9 @@ public String toString() { if (getAttributes() != null) sb.append("Attributes: " + getAttributes() + ","); if (getTags() != null) - sb.append("Tags: " + getTags()); + sb.append("Tags: " + getTags() + ","); + if (getDataProtectionPolicy() != null) + sb.append("DataProtectionPolicy: " + getDataProtectionPolicy()); sb.append("}"); return sb.toString(); } @@ -1174,6 +1293,8 @@ public int hashCode() { hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); + hashCode = prime * hashCode + + ((getDataProtectionPolicy() == null) ? 0 : getDataProtectionPolicy().hashCode()); return hashCode; } @@ -1201,6 +1322,11 @@ public boolean equals(Object obj) { return false; if (other.getTags() != null && other.getTags().equals(this.getTags()) == false) return false; + if (other.getDataProtectionPolicy() == null ^ this.getDataProtectionPolicy() == null) + return false; + if (other.getDataProtectionPolicy() != null + && other.getDataProtectionPolicy().equals(this.getDataProtectionPolicy()) == false) + return false; return true; } } diff --git a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/GetDataProtectionPolicyRequest.java b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/GetDataProtectionPolicyRequest.java new file mode 100644 index 0000000000..4c250be81c --- /dev/null +++ b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/GetDataProtectionPolicyRequest.java @@ -0,0 +1,175 @@ +/* + * Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.amazonaws.services.sns.model; + +import java.io.Serializable; + +import com.amazonaws.AmazonWebServiceRequest; + +/** + *

+ * Retrieves the specified inline DataProtectionPolicy document + * that is stored in the specified Amazon SNS topic. + *

+ */ +public class GetDataProtectionPolicyRequest extends AmazonWebServiceRequest implements Serializable { + /** + *

+ * The ARN of the topic whose DataProtectionPolicy you want to + * get. + *

+ *

+ * For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General + * Reference. + *

+ */ + private String resourceArn; + + /** + *

+ * The ARN of the topic whose DataProtectionPolicy you want to + * get. + *

+ *

+ * For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General + * Reference. + *

+ * + * @return

+ * The ARN of the topic whose DataProtectionPolicy you + * want to get. + *

+ *

+ * For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services + * General Reference. + *

+ */ + public String getResourceArn() { + return resourceArn; + } + + /** + *

+ * The ARN of the topic whose DataProtectionPolicy you want to + * get. + *

+ *

+ * For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General + * Reference. + *

+ * + * @param resourceArn

+ * The ARN of the topic whose DataProtectionPolicy + * you want to get. + *

+ *

+ * For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services + * General Reference. + *

+ */ + public void setResourceArn(String resourceArn) { + this.resourceArn = resourceArn; + } + + /** + *

+ * The ARN of the topic whose DataProtectionPolicy you want to + * get. + *

+ *

+ * For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General + * Reference. + *

+ *

+ * Returns a reference to this object so that method calls can be chained + * together. + * + * @param resourceArn

+ * The ARN of the topic whose DataProtectionPolicy + * you want to get. + *

+ *

+ * For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services + * General Reference. + *

+ * @return A reference to this updated object so that method calls can be + * chained together. + */ + public GetDataProtectionPolicyRequest withResourceArn(String resourceArn) { + this.resourceArn = resourceArn; + return this; + } + + /** + * Returns a string representation of this object; useful for testing and + * debugging. + * + * @return A string representation of this object. + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + if (getResourceArn() != null) + sb.append("ResourceArn: " + getResourceArn()); + sb.append("}"); + return sb.toString(); + } + + @Override + public int hashCode() { + final int prime = 31; + int hashCode = 1; + + hashCode = prime * hashCode + + ((getResourceArn() == null) ? 0 : getResourceArn().hashCode()); + return hashCode; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + + if (obj instanceof GetDataProtectionPolicyRequest == false) + return false; + GetDataProtectionPolicyRequest other = (GetDataProtectionPolicyRequest) obj; + + if (other.getResourceArn() == null ^ this.getResourceArn() == null) + return false; + if (other.getResourceArn() != null + && other.getResourceArn().equals(this.getResourceArn()) == false) + return false; + return true; + } +} diff --git a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/GetDataProtectionPolicyResult.java b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/GetDataProtectionPolicyResult.java new file mode 100644 index 0000000000..6fba9437b6 --- /dev/null +++ b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/GetDataProtectionPolicyResult.java @@ -0,0 +1,121 @@ +/* + * Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.amazonaws.services.sns.model; + +import java.io.Serializable; + +public class GetDataProtectionPolicyResult implements Serializable { + /** + *

+ * Retrieves the DataProtectionPolicy in JSON string format. + *

+ */ + private String dataProtectionPolicy; + + /** + *

+ * Retrieves the DataProtectionPolicy in JSON string format. + *

+ * + * @return

+ * Retrieves the DataProtectionPolicy in JSON string + * format. + *

+ */ + public String getDataProtectionPolicy() { + return dataProtectionPolicy; + } + + /** + *

+ * Retrieves the DataProtectionPolicy in JSON string format. + *

+ * + * @param dataProtectionPolicy

+ * Retrieves the DataProtectionPolicy in JSON string + * format. + *

+ */ + public void setDataProtectionPolicy(String dataProtectionPolicy) { + this.dataProtectionPolicy = dataProtectionPolicy; + } + + /** + *

+ * Retrieves the DataProtectionPolicy in JSON string format. + *

+ *

+ * Returns a reference to this object so that method calls can be chained + * together. + * + * @param dataProtectionPolicy

+ * Retrieves the DataProtectionPolicy in JSON string + * format. + *

+ * @return A reference to this updated object so that method calls can be + * chained together. + */ + public GetDataProtectionPolicyResult withDataProtectionPolicy(String dataProtectionPolicy) { + this.dataProtectionPolicy = dataProtectionPolicy; + return this; + } + + /** + * Returns a string representation of this object; useful for testing and + * debugging. + * + * @return A string representation of this object. + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + if (getDataProtectionPolicy() != null) + sb.append("DataProtectionPolicy: " + getDataProtectionPolicy()); + sb.append("}"); + return sb.toString(); + } + + @Override + public int hashCode() { + final int prime = 31; + int hashCode = 1; + + hashCode = prime * hashCode + + ((getDataProtectionPolicy() == null) ? 0 : getDataProtectionPolicy().hashCode()); + return hashCode; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + + if (obj instanceof GetDataProtectionPolicyResult == false) + return false; + GetDataProtectionPolicyResult other = (GetDataProtectionPolicyResult) obj; + + if (other.getDataProtectionPolicy() == null ^ this.getDataProtectionPolicy() == null) + return false; + if (other.getDataProtectionPolicy() != null + && other.getDataProtectionPolicy().equals(this.getDataProtectionPolicy()) == false) + return false; + return true; + } +} diff --git a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/PutDataProtectionPolicyRequest.java b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/PutDataProtectionPolicyRequest.java new file mode 100644 index 0000000000..51bcb0068c --- /dev/null +++ b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/PutDataProtectionPolicyRequest.java @@ -0,0 +1,284 @@ +/* + * Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.amazonaws.services.sns.model; + +import java.io.Serializable; + +import com.amazonaws.AmazonWebServiceRequest; + +/** + *

+ * Adds or updates an inline policy document that is stored in the specified + * Amazon SNS topic. + *

+ */ +public class PutDataProtectionPolicyRequest extends AmazonWebServiceRequest implements Serializable { + /** + *

+ * The ARN of the topic whose DataProtectionPolicy you want to + * add or update. + *

+ *

+ * For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General + * Reference. + *

+ */ + private String resourceArn; + + /** + *

+ * The JSON serialization of the topic's DataProtectionPolicy. + *

+ *

+ * The DataProtectionPolicy must be in JSON string format. + *

+ *

+ * Length Constraints: Maximum length of 30,720. + *

+ */ + private String dataProtectionPolicy; + + /** + *

+ * The ARN of the topic whose DataProtectionPolicy you want to + * add or update. + *

+ *

+ * For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General + * Reference. + *

+ * + * @return

+ * The ARN of the topic whose DataProtectionPolicy you + * want to add or update. + *

+ *

+ * For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services + * General Reference. + *

+ */ + public String getResourceArn() { + return resourceArn; + } + + /** + *

+ * The ARN of the topic whose DataProtectionPolicy you want to + * add or update. + *

+ *

+ * For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General + * Reference. + *

+ * + * @param resourceArn

+ * The ARN of the topic whose DataProtectionPolicy + * you want to add or update. + *

+ *

+ * For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services + * General Reference. + *

+ */ + public void setResourceArn(String resourceArn) { + this.resourceArn = resourceArn; + } + + /** + *

+ * The ARN of the topic whose DataProtectionPolicy you want to + * add or update. + *

+ *

+ * For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General + * Reference. + *

+ *

+ * Returns a reference to this object so that method calls can be chained + * together. + * + * @param resourceArn

+ * The ARN of the topic whose DataProtectionPolicy + * you want to add or update. + *

+ *

+ * For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services + * General Reference. + *

+ * @return A reference to this updated object so that method calls can be + * chained together. + */ + public PutDataProtectionPolicyRequest withResourceArn(String resourceArn) { + this.resourceArn = resourceArn; + return this; + } + + /** + *

+ * The JSON serialization of the topic's DataProtectionPolicy. + *

+ *

+ * The DataProtectionPolicy must be in JSON string format. + *

+ *

+ * Length Constraints: Maximum length of 30,720. + *

+ * + * @return

+ * The JSON serialization of the topic's + * DataProtectionPolicy. + *

+ *

+ * The DataProtectionPolicy must be in JSON string + * format. + *

+ *

+ * Length Constraints: Maximum length of 30,720. + *

+ */ + public String getDataProtectionPolicy() { + return dataProtectionPolicy; + } + + /** + *

+ * The JSON serialization of the topic's DataProtectionPolicy. + *

+ *

+ * The DataProtectionPolicy must be in JSON string format. + *

+ *

+ * Length Constraints: Maximum length of 30,720. + *

+ * + * @param dataProtectionPolicy

+ * The JSON serialization of the topic's + * DataProtectionPolicy. + *

+ *

+ * The DataProtectionPolicy must be in JSON string + * format. + *

+ *

+ * Length Constraints: Maximum length of 30,720. + *

+ */ + public void setDataProtectionPolicy(String dataProtectionPolicy) { + this.dataProtectionPolicy = dataProtectionPolicy; + } + + /** + *

+ * The JSON serialization of the topic's DataProtectionPolicy. + *

+ *

+ * The DataProtectionPolicy must be in JSON string format. + *

+ *

+ * Length Constraints: Maximum length of 30,720. + *

+ *

+ * Returns a reference to this object so that method calls can be chained + * together. + * + * @param dataProtectionPolicy

+ * The JSON serialization of the topic's + * DataProtectionPolicy. + *

+ *

+ * The DataProtectionPolicy must be in JSON string + * format. + *

+ *

+ * Length Constraints: Maximum length of 30,720. + *

+ * @return A reference to this updated object so that method calls can be + * chained together. + */ + public PutDataProtectionPolicyRequest withDataProtectionPolicy(String dataProtectionPolicy) { + this.dataProtectionPolicy = dataProtectionPolicy; + return this; + } + + /** + * Returns a string representation of this object; useful for testing and + * debugging. + * + * @return A string representation of this object. + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + if (getResourceArn() != null) + sb.append("ResourceArn: " + getResourceArn() + ","); + if (getDataProtectionPolicy() != null) + sb.append("DataProtectionPolicy: " + getDataProtectionPolicy()); + sb.append("}"); + return sb.toString(); + } + + @Override + public int hashCode() { + final int prime = 31; + int hashCode = 1; + + hashCode = prime * hashCode + + ((getResourceArn() == null) ? 0 : getResourceArn().hashCode()); + hashCode = prime * hashCode + + ((getDataProtectionPolicy() == null) ? 0 : getDataProtectionPolicy().hashCode()); + return hashCode; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + + if (obj instanceof PutDataProtectionPolicyRequest == false) + return false; + PutDataProtectionPolicyRequest other = (PutDataProtectionPolicyRequest) obj; + + if (other.getResourceArn() == null ^ this.getResourceArn() == null) + return false; + if (other.getResourceArn() != null + && other.getResourceArn().equals(this.getResourceArn()) == false) + return false; + if (other.getDataProtectionPolicy() == null ^ this.getDataProtectionPolicy() == null) + return false; + if (other.getDataProtectionPolicy() != null + && other.getDataProtectionPolicy().equals(this.getDataProtectionPolicy()) == false) + return false; + return true; + } +} diff --git a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/transform/CreateTopicRequestMarshaller.java b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/transform/CreateTopicRequestMarshaller.java index 6573017b65..7c71509654 100644 --- a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/transform/CreateTopicRequestMarshaller.java +++ b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/transform/CreateTopicRequestMarshaller.java @@ -79,6 +79,11 @@ public Request marshall(CreateTopicRequest createTopicReques } prefix = tagsPrefix; } + if (createTopicRequest.getDataProtectionPolicy() != null) { + prefix = "DataProtectionPolicy"; + String dataProtectionPolicy = createTopicRequest.getDataProtectionPolicy(); + request.addParameter(prefix, StringUtils.fromString(dataProtectionPolicy)); + } return request; } diff --git a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/transform/GetDataProtectionPolicyRequestMarshaller.java b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/transform/GetDataProtectionPolicyRequestMarshaller.java new file mode 100644 index 0000000000..974f56296a --- /dev/null +++ b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/transform/GetDataProtectionPolicyRequestMarshaller.java @@ -0,0 +1,52 @@ +/* + * Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.amazonaws.services.sns.model.transform; + +import com.amazonaws.AmazonClientException; +import com.amazonaws.Request; +import com.amazonaws.DefaultRequest; +import com.amazonaws.services.sns.model.*; +import com.amazonaws.transform.Marshaller; +import com.amazonaws.util.StringUtils; + +/** + * StAX request marshaller for GetDataProtectionPolicyRequest + */ +public class GetDataProtectionPolicyRequestMarshaller implements + Marshaller, GetDataProtectionPolicyRequest> { + + public Request marshall( + GetDataProtectionPolicyRequest getDataProtectionPolicyRequest) { + if (getDataProtectionPolicyRequest == null) { + throw new AmazonClientException( + "Invalid argument passed to marshall(GetDataProtectionPolicyRequest)"); + } + + Request request = new DefaultRequest( + getDataProtectionPolicyRequest, "AmazonSNS"); + request.addParameter("Action", "GetDataProtectionPolicy"); + request.addParameter("Version", "2010-03-31"); + + String prefix; + if (getDataProtectionPolicyRequest.getResourceArn() != null) { + prefix = "ResourceArn"; + String resourceArn = getDataProtectionPolicyRequest.getResourceArn(); + request.addParameter(prefix, StringUtils.fromString(resourceArn)); + } + + return request; + } +} diff --git a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/transform/GetDataProtectionPolicyResultStaxUnmarshaller.java b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/transform/GetDataProtectionPolicyResultStaxUnmarshaller.java new file mode 100644 index 0000000000..5b7242b465 --- /dev/null +++ b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/transform/GetDataProtectionPolicyResultStaxUnmarshaller.java @@ -0,0 +1,72 @@ +/* + * Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.amazonaws.services.sns.model.transform; + +import java.util.Map; +import java.util.Map.Entry; + +import org.xmlpull.v1.XmlPullParser; + +import com.amazonaws.services.sns.model.*; +import com.amazonaws.transform.Unmarshaller; +import com.amazonaws.transform.MapEntry; +import com.amazonaws.transform.StaxUnmarshallerContext; +import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*; + +/** + * StAX unmarshaller for response GetDataProtectionPolicyResult + */ +public class GetDataProtectionPolicyResultStaxUnmarshaller implements + Unmarshaller { + + public GetDataProtectionPolicyResult unmarshall(StaxUnmarshallerContext context) + throws Exception { + GetDataProtectionPolicyResult getDataProtectionPolicyResult = new GetDataProtectionPolicyResult(); + + int originalDepth = context.getCurrentDepth(); + int targetDepth = originalDepth + 1; + + if (context.isStartOfDocument()) + targetDepth += 2; + + while (true) { + int xmlEvent = context.nextEvent(); + if (xmlEvent == XmlPullParser.END_DOCUMENT) + break; + + if (xmlEvent == XmlPullParser.START_TAG) { + if (context.testExpression("DataProtectionPolicy", targetDepth)) { + getDataProtectionPolicyResult.setDataProtectionPolicy(StringStaxUnmarshaller + .getInstance().unmarshall(context)); + continue; + } + } else if (xmlEvent == XmlPullParser.END_TAG) { + if (context.getCurrentDepth() < originalDepth) { + break; + } + } + } + return getDataProtectionPolicyResult; + } + + private static GetDataProtectionPolicyResultStaxUnmarshaller instance; + + public static GetDataProtectionPolicyResultStaxUnmarshaller getInstance() { + if (instance == null) + instance = new GetDataProtectionPolicyResultStaxUnmarshaller(); + return instance; + } +} diff --git a/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/transform/PutDataProtectionPolicyRequestMarshaller.java b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/transform/PutDataProtectionPolicyRequestMarshaller.java new file mode 100644 index 0000000000..d6ac532d30 --- /dev/null +++ b/aws-android-sdk-sns/src/main/java/com/amazonaws/services/sns/model/transform/PutDataProtectionPolicyRequestMarshaller.java @@ -0,0 +1,57 @@ +/* + * Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.amazonaws.services.sns.model.transform; + +import com.amazonaws.AmazonClientException; +import com.amazonaws.Request; +import com.amazonaws.DefaultRequest; +import com.amazonaws.services.sns.model.*; +import com.amazonaws.transform.Marshaller; +import com.amazonaws.util.StringUtils; + +/** + * StAX request marshaller for PutDataProtectionPolicyRequest + */ +public class PutDataProtectionPolicyRequestMarshaller implements + Marshaller, PutDataProtectionPolicyRequest> { + + public Request marshall( + PutDataProtectionPolicyRequest putDataProtectionPolicyRequest) { + if (putDataProtectionPolicyRequest == null) { + throw new AmazonClientException( + "Invalid argument passed to marshall(PutDataProtectionPolicyRequest)"); + } + + Request request = new DefaultRequest( + putDataProtectionPolicyRequest, "AmazonSNS"); + request.addParameter("Action", "PutDataProtectionPolicy"); + request.addParameter("Version", "2010-03-31"); + + String prefix; + if (putDataProtectionPolicyRequest.getResourceArn() != null) { + prefix = "ResourceArn"; + String resourceArn = putDataProtectionPolicyRequest.getResourceArn(); + request.addParameter(prefix, StringUtils.fromString(resourceArn)); + } + if (putDataProtectionPolicyRequest.getDataProtectionPolicy() != null) { + prefix = "DataProtectionPolicy"; + String dataProtectionPolicy = putDataProtectionPolicyRequest.getDataProtectionPolicy(); + request.addParameter(prefix, StringUtils.fromString(dataProtectionPolicy)); + } + + return request; + } +}