com.amazonaws.services.sns.AmazonSNSClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-sns Show documentation
/*
* Copyright 2018-2023 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;
import org.w3c.dom.*;
import java.net.*;
import java.util.*;
import javax.annotation.Generated;
import org.apache.commons.logging.*;
import com.amazonaws.*;
import com.amazonaws.annotation.SdkInternalApi;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.internal.auth.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.protocol.json.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.client.AwsSyncClientParams;
import com.amazonaws.client.builder.AdvancedConfig;
import com.amazonaws.services.sns.AmazonSNSClientBuilder;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.sns.model.*;
import com.amazonaws.services.sns.model.transform.*;
/**
* Client for accessing Amazon SNS. All service calls made using this client are blocking, and will not return until the
* service call completes.
*
* Amazon Simple Notification Service
*
* Amazon Simple Notification Service (Amazon SNS) is a web service that enables you to build distributed web-enabled
* applications. Applications can use Amazon SNS to easily push real-time notification messages to interested
* subscribers over multiple delivery protocols. For more information about this product see the Amazon SNS product page. For detailed information about Amazon SNS features and
* their associated API calls, see the Amazon SNS Developer
* Guide.
*
*
* For information on the permissions you need to use this API, see Identity and access
* management in Amazon SNS in the Amazon SNS Developer Guide.
*
*
* We also provide SDKs that enable you to access Amazon SNS from your preferred programming language. The SDKs contain
* functionality that automatically takes care of tasks such as: cryptographically signing your service requests,
* retrying requests, and handling error responses. For a list of available SDKs, go to Tools for Amazon Web Services.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AmazonSNSClient extends AmazonWebServiceClient implements AmazonSNS {
/** Provider for AWS credentials. */
private final AWSCredentialsProvider awsCredentialsProvider;
private static final Log log = LogFactory.getLog(AmazonSNS.class);
/** Default signing name for the service. */
private static final String DEFAULT_SIGNING_NAME = "sns";
/** Client configuration factory providing ClientConfigurations tailored to this client */
protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
private final AdvancedConfig advancedConfig;
/**
* Map of exception unmarshallers for all modeled exceptions
*/
private final Map> exceptionUnmarshallersMap = new HashMap>();
/**
* List of exception unmarshallers for all modeled exceptions Even though this exceptionUnmarshallers is not used in
* Clients, this is not removed since this was directly used by Client extended classes. Using this list can cause
* performance impact.
*/
protected final List> exceptionUnmarshallers = new ArrayList>();
protected Unmarshaller defaultUnmarshaller;
/**
* Constructs a new client to invoke service methods on Amazon SNS. A credentials provider chain will be used that
* searches for credentials in this order:
*
* - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
* - Java System Properties - aws.accessKeyId and aws.secretKey
* - Instance profile credentials delivered through the Amazon EC2 metadata service
*
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @see DefaultAWSCredentialsProviderChain
* @deprecated use {@link AmazonSNSClientBuilder#defaultClient()}
*/
@Deprecated
public AmazonSNSClient() {
this(DefaultAWSCredentialsProviderChain.getInstance(), configFactory.getConfig());
}
/**
* Constructs a new client to invoke service methods on Amazon SNS. A credentials provider chain will be used that
* searches for credentials in this order:
*
* - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
* - Java System Properties - aws.accessKeyId and aws.secretKey
* - Instance profile credentials delivered through the Amazon EC2 metadata service
*
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientConfiguration
* The client configuration options controlling how this client connects to Amazon SNS (ex: proxy settings,
* retry counts, etc.).
*
* @see DefaultAWSCredentialsProviderChain
* @deprecated use {@link AmazonSNSClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AmazonSNSClient(ClientConfiguration clientConfiguration) {
this(DefaultAWSCredentialsProviderChain.getInstance(), clientConfiguration);
}
/**
* Constructs a new client to invoke service methods on Amazon SNS using the specified AWS account credentials.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param awsCredentials
* The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
* @deprecated use {@link AmazonSNSClientBuilder#withCredentials(AWSCredentialsProvider)} for example:
* {@code AmazonSNSClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build();}
*/
@Deprecated
public AmazonSNSClient(AWSCredentials awsCredentials) {
this(awsCredentials, configFactory.getConfig());
}
/**
* Constructs a new client to invoke service methods on Amazon SNS using the specified AWS account credentials and
* client configuration options.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param awsCredentials
* The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client connects to Amazon SNS (ex: proxy settings,
* retry counts, etc.).
* @deprecated use {@link AmazonSNSClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AmazonSNSClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AmazonSNSClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration) {
super(clientConfiguration);
this.awsCredentialsProvider = new StaticCredentialsProvider(awsCredentials);
this.advancedConfig = AdvancedConfig.EMPTY;
init();
}
/**
* Constructs a new client to invoke service methods on Amazon SNS using the specified AWS account credentials
* provider.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
* @deprecated use {@link AmazonSNSClientBuilder#withCredentials(AWSCredentialsProvider)}
*/
@Deprecated
public AmazonSNSClient(AWSCredentialsProvider awsCredentialsProvider) {
this(awsCredentialsProvider, configFactory.getConfig());
}
/**
* Constructs a new client to invoke service methods on Amazon SNS using the specified AWS account credentials
* provider and client configuration options.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client connects to Amazon SNS (ex: proxy settings,
* retry counts, etc.).
* @deprecated use {@link AmazonSNSClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AmazonSNSClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AmazonSNSClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) {
this(awsCredentialsProvider, clientConfiguration, null);
}
/**
* Constructs a new client to invoke service methods on Amazon SNS using the specified AWS account credentials
* provider, client configuration options, and request metric collector.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client connects to Amazon SNS (ex: proxy settings,
* retry counts, etc.).
* @param requestMetricCollector
* optional request metric collector
* @deprecated use {@link AmazonSNSClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AmazonSNSClientBuilder#withClientConfiguration(ClientConfiguration)} and
* {@link AmazonSNSClientBuilder#withMetricsCollector(RequestMetricCollector)}
*/
@Deprecated
public AmazonSNSClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricCollector) {
super(clientConfiguration, requestMetricCollector);
this.awsCredentialsProvider = awsCredentialsProvider;
this.advancedConfig = AdvancedConfig.EMPTY;
init();
}
public static AmazonSNSClientBuilder builder() {
return AmazonSNSClientBuilder.standard();
}
/**
* Constructs a new client to invoke service methods on Amazon SNS using the specified parameters.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AmazonSNSClient(AwsSyncClientParams clientParams) {
this(clientParams, false);
}
/**
* Constructs a new client to invoke service methods on Amazon SNS using the specified parameters.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AmazonSNSClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) {
super(clientParams);
this.awsCredentialsProvider = clientParams.getCredentialsProvider();
this.advancedConfig = clientParams.getAdvancedConfig();
init();
}
private void init() {
if (exceptionUnmarshallersMap.get("SubscriptionLimitExceeded") == null) {
exceptionUnmarshallersMap.put("SubscriptionLimitExceeded", new SubscriptionLimitExceededExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new SubscriptionLimitExceededExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("InvalidParameter") == null) {
exceptionUnmarshallersMap.put("InvalidParameter", new InvalidParameterExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new InvalidParameterExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("BatchEntryIdsNotDistinct") == null) {
exceptionUnmarshallersMap.put("BatchEntryIdsNotDistinct", new BatchEntryIdsNotDistinctExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new BatchEntryIdsNotDistinctExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("ParameterValueInvalid") == null) {
exceptionUnmarshallersMap.put("ParameterValueInvalid", new InvalidParameterValueExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new InvalidParameterValueExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("EndpointDisabled") == null) {
exceptionUnmarshallersMap.put("EndpointDisabled", new EndpointDisabledExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new EndpointDisabledExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("FilterPolicyLimitExceeded") == null) {
exceptionUnmarshallersMap.put("FilterPolicyLimitExceeded", new FilterPolicyLimitExceededExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new FilterPolicyLimitExceededExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("UserError") == null) {
exceptionUnmarshallersMap.put("UserError", new UserErrorExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new UserErrorExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("KMSAccessDenied") == null) {
exceptionUnmarshallersMap.put("KMSAccessDenied", new KMSAccessDeniedExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new KMSAccessDeniedExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("KMSInvalidState") == null) {
exceptionUnmarshallersMap.put("KMSInvalidState", new KMSInvalidStateExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new KMSInvalidStateExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("StaleTag") == null) {
exceptionUnmarshallersMap.put("StaleTag", new StaleTagExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new StaleTagExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("NotFound") == null) {
exceptionUnmarshallersMap.put("NotFound", new NotFoundExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new NotFoundExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("KMSDisabled") == null) {
exceptionUnmarshallersMap.put("KMSDisabled", new KMSDisabledExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new KMSDisabledExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("VerificationException") == null) {
exceptionUnmarshallersMap.put("VerificationException", new VerificationExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new VerificationExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("Throttled") == null) {
exceptionUnmarshallersMap.put("Throttled", new ThrottledExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new ThrottledExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("InternalError") == null) {
exceptionUnmarshallersMap.put("InternalError", new InternalErrorExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new InternalErrorExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("EmptyBatchRequest") == null) {
exceptionUnmarshallersMap.put("EmptyBatchRequest", new EmptyBatchRequestExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new EmptyBatchRequestExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("InvalidSecurity") == null) {
exceptionUnmarshallersMap.put("InvalidSecurity", new InvalidSecurityExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new InvalidSecurityExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("OptedOut") == null) {
exceptionUnmarshallersMap.put("OptedOut", new OptedOutExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new OptedOutExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("KMSOptInRequired") == null) {
exceptionUnmarshallersMap.put("KMSOptInRequired", new KMSOptInRequiredExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new KMSOptInRequiredExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("TooManyEntriesInBatchRequest") == null) {
exceptionUnmarshallersMap.put("TooManyEntriesInBatchRequest", new TooManyEntriesInBatchRequestExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new TooManyEntriesInBatchRequestExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("ResourceNotFound") == null) {
exceptionUnmarshallersMap.put("ResourceNotFound", new ResourceNotFoundExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new ResourceNotFoundExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("BatchRequestTooLong") == null) {
exceptionUnmarshallersMap.put("BatchRequestTooLong", new BatchRequestTooLongExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new BatchRequestTooLongExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("ValidationException") == null) {
exceptionUnmarshallersMap.put("ValidationException", new ValidationExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new ValidationExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("KMSNotFound") == null) {
exceptionUnmarshallersMap.put("KMSNotFound", new KMSNotFoundExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new KMSNotFoundExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("TopicLimitExceeded") == null) {
exceptionUnmarshallersMap.put("TopicLimitExceeded", new TopicLimitExceededExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new TopicLimitExceededExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("TagPolicy") == null) {
exceptionUnmarshallersMap.put("TagPolicy", new TagPolicyExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new TagPolicyExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("TagLimitExceeded") == null) {
exceptionUnmarshallersMap.put("TagLimitExceeded", new TagLimitExceededExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new TagLimitExceededExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("PlatformApplicationDisabled") == null) {
exceptionUnmarshallersMap.put("PlatformApplicationDisabled", new PlatformApplicationDisabledExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new PlatformApplicationDisabledExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("KMSThrottling") == null) {
exceptionUnmarshallersMap.put("KMSThrottling", new KMSThrottlingExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new KMSThrottlingExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("AuthorizationError") == null) {
exceptionUnmarshallersMap.put("AuthorizationError", new AuthorizationErrorExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new AuthorizationErrorExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("ConcurrentAccess") == null) {
exceptionUnmarshallersMap.put("ConcurrentAccess", new ConcurrentAccessExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new ConcurrentAccessExceptionUnmarshaller());
if (exceptionUnmarshallersMap.get("InvalidBatchEntryId") == null) {
exceptionUnmarshallersMap.put("InvalidBatchEntryId", new InvalidBatchEntryIdExceptionUnmarshaller());
}
exceptionUnmarshallers.add(new InvalidBatchEntryIdExceptionUnmarshaller());
defaultUnmarshaller = new StandardErrorUnmarshaller(com.amazonaws.services.sns.model.AmazonSNSException.class);
exceptionUnmarshallers.add(new StandardErrorUnmarshaller(com.amazonaws.services.sns.model.AmazonSNSException.class));
setServiceNameIntern(DEFAULT_SIGNING_NAME);
setEndpointPrefix(ENDPOINT_PREFIX);
// calling this.setEndPoint(...) will also modify the signer accordingly
this.setEndpoint("https://sns.us-east-1.amazonaws.com");
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/sns/request.handlers"));
requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/sns/request.handler2s"));
requestHandler2s.addAll(chainFactory.getGlobalHandlers());
}
/**
*
* Adds a statement to a topic's access control policy, granting access for the specified Amazon Web Services
* accounts to the specified actions.
*
*
*
* To remove the ability to change topic permissions, you must deny permissions to the AddPermission
,
* RemovePermission
, and SetTopicAttributes
actions in your IAM policy.
*
*
*
* @param addPermissionRequest
* @return Result of the AddPermission 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.AddPermission
* @see AWS API
* Documentation
*/
@Override
public AddPermissionResult addPermission(AddPermissionRequest request) {
request = beforeClientExecution(request);
return executeAddPermission(request);
}
@SdkInternalApi
final AddPermissionResult executeAddPermission(AddPermissionRequest addPermissionRequest) {
ExecutionContext executionContext = createExecutionContext(addPermissionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new AddPermissionRequestMarshaller().marshall(super.beforeMarshalling(addPermissionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AddPermission");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(new AddPermissionResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public AddPermissionResult addPermission(String topicArn, String label, java.util.List aWSAccountIds, java.util.List actionNames) {
return addPermission(new AddPermissionRequest().withTopicArn(topicArn).withLabel(label).withAWSAccountIds(aWSAccountIds).withActionNames(actionNames));
}
/**
*
* Accepts a phone number and indicates whether the phone holder has opted out of receiving SMS messages from your
* Amazon Web Services account. You cannot send SMS messages to a number that is opted out.
*
*
* To resume sending messages, you can opt in the number by using the OptInPhoneNumber
action.
*
*
* @param checkIfPhoneNumberIsOptedOutRequest
* The input for the CheckIfPhoneNumberIsOptedOut
action.
* @return Result of the CheckIfPhoneNumberIsOptedOut operation returned by the service.
* @throws ThrottledException
* Indicates that the rate at which requests have been submitted for this action exceeds the limit for your
* Amazon Web Services account.
* @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.CheckIfPhoneNumberIsOptedOut
* @see AWS API Documentation
*/
@Override
public CheckIfPhoneNumberIsOptedOutResult checkIfPhoneNumberIsOptedOut(CheckIfPhoneNumberIsOptedOutRequest request) {
request = beforeClientExecution(request);
return executeCheckIfPhoneNumberIsOptedOut(request);
}
@SdkInternalApi
final CheckIfPhoneNumberIsOptedOutResult executeCheckIfPhoneNumberIsOptedOut(CheckIfPhoneNumberIsOptedOutRequest checkIfPhoneNumberIsOptedOutRequest) {
ExecutionContext executionContext = createExecutionContext(checkIfPhoneNumberIsOptedOutRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CheckIfPhoneNumberIsOptedOutRequestMarshaller().marshall(super.beforeMarshalling(checkIfPhoneNumberIsOptedOutRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CheckIfPhoneNumberIsOptedOut");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new CheckIfPhoneNumberIsOptedOutResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Verifies an endpoint owner's intent to receive messages by validating the token sent to the endpoint by an
* earlier Subscribe
action. If the token is valid, the action creates a new subscription and returns
* its Amazon Resource Name (ARN). This call requires an AWS signature only when the
* AuthenticateOnUnsubscribe
flag is set to "true".
*
*
* @param confirmSubscriptionRequest
* Input for ConfirmSubscription action.
* @return Result of the ConfirmSubscription operation returned by the service.
* @throws SubscriptionLimitExceededException
* Indicates that the customer already owns the maximum allowed number of subscriptions.
* @throws InvalidParameterException
* Indicates that a request parameter does not comply with the associated constraints.
* @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.
* @throws FilterPolicyLimitExceededException
* Indicates that the number of filter polices in your Amazon Web Services account exceeds the limit. To add
* more filter polices, submit an Amazon SNS Limit Increase case in the Amazon Web Services Support Center.
* @sample AmazonSNS.ConfirmSubscription
* @see AWS API
* Documentation
*/
@Override
public ConfirmSubscriptionResult confirmSubscription(ConfirmSubscriptionRequest request) {
request = beforeClientExecution(request);
return executeConfirmSubscription(request);
}
@SdkInternalApi
final ConfirmSubscriptionResult executeConfirmSubscription(ConfirmSubscriptionRequest confirmSubscriptionRequest) {
ExecutionContext executionContext = createExecutionContext(confirmSubscriptionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ConfirmSubscriptionRequestMarshaller().marshall(super.beforeMarshalling(confirmSubscriptionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ConfirmSubscription");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new ConfirmSubscriptionResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public ConfirmSubscriptionResult confirmSubscription(String topicArn, String token, String authenticateOnUnsubscribe) {
return confirmSubscription(new ConfirmSubscriptionRequest().withTopicArn(topicArn).withToken(token)
.withAuthenticateOnUnsubscribe(authenticateOnUnsubscribe));
}
@Override
public ConfirmSubscriptionResult confirmSubscription(String topicArn, String token) {
return confirmSubscription(new ConfirmSubscriptionRequest().withTopicArn(topicArn).withToken(token));
}
/**
*
* 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.
*
*
* 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
using certificate credentials, PlatformPrincipal
* is SSL certificate
and PlatformCredential
is private key
.
*
*
* -
*
* For APNS
and APNS_SANDBOX
using token credentials, PlatformPrincipal
is
* signing key ID
and PlatformCredential
is signing 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.
* @return Result of the CreatePlatformApplication 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.
* @sample AmazonSNS.CreatePlatformApplication
* @see AWS
* API Documentation
*/
@Override
public CreatePlatformApplicationResult createPlatformApplication(CreatePlatformApplicationRequest request) {
request = beforeClientExecution(request);
return executeCreatePlatformApplication(request);
}
@SdkInternalApi
final CreatePlatformApplicationResult executeCreatePlatformApplication(CreatePlatformApplicationRequest createPlatformApplicationRequest) {
ExecutionContext executionContext = createExecutionContext(createPlatformApplicationRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreatePlatformApplicationRequestMarshaller().marshall(super.beforeMarshalling(createPlatformApplicationRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreatePlatformApplication");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new CreatePlatformApplicationResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates an endpoint for a device and mobile app on one of the supported push notification services, such as GCM
* (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
* for Baidu.
*
*
* @param createPlatformEndpointRequest
* Input for CreatePlatformEndpoint action.
* @return Result of the CreatePlatformEndpoint 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.CreatePlatformEndpoint
* @see AWS API
* Documentation
*/
@Override
public CreatePlatformEndpointResult createPlatformEndpoint(CreatePlatformEndpointRequest request) {
request = beforeClientExecution(request);
return executeCreatePlatformEndpoint(request);
}
@SdkInternalApi
final CreatePlatformEndpointResult executeCreatePlatformEndpoint(CreatePlatformEndpointRequest createPlatformEndpointRequest) {
ExecutionContext executionContext = createExecutionContext(createPlatformEndpointRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreatePlatformEndpointRequestMarshaller().marshall(super.beforeMarshalling(createPlatformEndpointRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreatePlatformEndpoint");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new CreatePlatformEndpointResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Adds a destination phone number to an Amazon Web Services account in the SMS sandbox and sends a one-time
* password (OTP) to that phone number.
*
*
* When you start using Amazon SNS to send SMS messages, your Amazon Web Services account is in the SMS
* sandbox. The SMS sandbox provides a safe environment for you to try Amazon SNS features without risking your
* reputation as an SMS sender. While your Amazon Web Services account is in the SMS sandbox, you can use all of the
* features of Amazon SNS. However, you can send SMS messages only to verified destination phone numbers. For more
* information, including how to move out of the sandbox to send messages without restrictions, see SMS sandbox in the Amazon SNS
* Developer Guide.
*
*
* @param createSMSSandboxPhoneNumberRequest
* @return Result of the CreateSMSSandboxPhoneNumber operation returned by the service.
* @throws AuthorizationErrorException
* Indicates that the user has been denied access to the requested resource.
* @throws InternalErrorException
* Indicates an internal service error.
* @throws InvalidParameterException
* Indicates that a request parameter does not comply with the associated constraints.
* @throws OptedOutException
* Indicates that the specified phone number opted out of receiving SMS messages from your Amazon Web
* Services account. You can't send SMS messages to phone numbers that opt out.
* @throws UserErrorException
* Indicates that a request parameter does not comply with the associated constraints.
* @throws ThrottledException
* Indicates that the rate at which requests have been submitted for this action exceeds the limit for your
* Amazon Web Services account.
* @sample AmazonSNS.CreateSMSSandboxPhoneNumber
* @see AWS API Documentation
*/
@Override
public CreateSMSSandboxPhoneNumberResult createSMSSandboxPhoneNumber(CreateSMSSandboxPhoneNumberRequest request) {
request = beforeClientExecution(request);
return executeCreateSMSSandboxPhoneNumber(request);
}
@SdkInternalApi
final CreateSMSSandboxPhoneNumberResult executeCreateSMSSandboxPhoneNumber(CreateSMSSandboxPhoneNumberRequest createSMSSandboxPhoneNumberRequest) {
ExecutionContext executionContext = createExecutionContext(createSMSSandboxPhoneNumberRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateSMSSandboxPhoneNumberRequestMarshaller().marshall(super.beforeMarshalling(createSMSSandboxPhoneNumberRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateSMSSandboxPhoneNumber");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new CreateSMSSandboxPhoneNumberResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates a topic to which notifications can be published. Users can create at most 100,000 standard topics (at
* most 1,000 FIFO topics). For more information, see Creating an Amazon SNS topic in the
* Amazon SNS Developer Guide. 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.
*
*
* @param createTopicRequest
* Input for CreateTopic action.
* @return Result of the CreateTopic operation returned by the service.
* @throws InvalidParameterException
* Indicates that a request parameter does not comply with the associated constraints.
* @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.
* @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.
* @sample AmazonSNS.CreateTopic
* @see AWS API
* Documentation
*/
@Override
public CreateTopicResult createTopic(CreateTopicRequest request) {
request = beforeClientExecution(request);
return executeCreateTopic(request);
}
@SdkInternalApi
final CreateTopicResult executeCreateTopic(CreateTopicRequest createTopicRequest) {
ExecutionContext executionContext = createExecutionContext(createTopicRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateTopicRequestMarshaller().marshall(super.beforeMarshalling(createTopicRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateTopic");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(new CreateTopicResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public CreateTopicResult createTopic(String name) {
return createTopic(new CreateTopicRequest().withName(name));
}
/**
*
* Deletes the endpoint for a device and mobile app from Amazon SNS. This action is idempotent. For more
* information, see Using Amazon SNS Mobile
* Push Notifications.
*
*
* When you delete an endpoint that is also subscribed to a topic, then you must also unsubscribe the endpoint from
* the topic.
*
*
* @param deleteEndpointRequest
* Input for DeleteEndpoint action.
* @return Result of the DeleteEndpoint 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.
* @sample AmazonSNS.DeleteEndpoint
* @see AWS API
* Documentation
*/
@Override
public DeleteEndpointResult deleteEndpoint(DeleteEndpointRequest request) {
request = beforeClientExecution(request);
return executeDeleteEndpoint(request);
}
@SdkInternalApi
final DeleteEndpointResult executeDeleteEndpoint(DeleteEndpointRequest deleteEndpointRequest) {
ExecutionContext executionContext = createExecutionContext(deleteEndpointRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteEndpointRequestMarshaller().marshall(super.beforeMarshalling(deleteEndpointRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteEndpoint");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new DeleteEndpointResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @return Result of the DeletePlatformApplication 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.
* @sample AmazonSNS.DeletePlatformApplication
* @see AWS
* API Documentation
*/
@Override
public DeletePlatformApplicationResult deletePlatformApplication(DeletePlatformApplicationRequest request) {
request = beforeClientExecution(request);
return executeDeletePlatformApplication(request);
}
@SdkInternalApi
final DeletePlatformApplicationResult executeDeletePlatformApplication(DeletePlatformApplicationRequest deletePlatformApplicationRequest) {
ExecutionContext executionContext = createExecutionContext(deletePlatformApplicationRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeletePlatformApplicationRequestMarshaller().marshall(super.beforeMarshalling(deletePlatformApplicationRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeletePlatformApplication");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new DeletePlatformApplicationResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes an Amazon Web Services account's verified or pending phone number from the SMS sandbox.
*
*
* When you start using Amazon SNS to send SMS messages, your Amazon Web Services account is in the SMS
* sandbox. The SMS sandbox provides a safe environment for you to try Amazon SNS features without risking your
* reputation as an SMS sender. While your Amazon Web Services account is in the SMS sandbox, you can use all of the
* features of Amazon SNS. However, you can send SMS messages only to verified destination phone numbers. For more
* information, including how to move out of the sandbox to send messages without restrictions, see SMS sandbox in the Amazon SNS
* Developer Guide.
*
*
* @param deleteSMSSandboxPhoneNumberRequest
* @return Result of the DeleteSMSSandboxPhoneNumber operation returned by the service.
* @throws AuthorizationErrorException
* Indicates that the user has been denied access to the requested resource.
* @throws InternalErrorException
* Indicates an internal service error.
* @throws InvalidParameterException
* Indicates that a request parameter does not comply with the associated constraints.
* @throws ResourceNotFoundException
* Can’t perform the action on the specified resource. Make sure that the resource exists.
* @throws UserErrorException
* Indicates that a request parameter does not comply with the associated constraints.
* @throws ThrottledException
* Indicates that the rate at which requests have been submitted for this action exceeds the limit for your
* Amazon Web Services account.
* @sample AmazonSNS.DeleteSMSSandboxPhoneNumber
* @see AWS API Documentation
*/
@Override
public DeleteSMSSandboxPhoneNumberResult deleteSMSSandboxPhoneNumber(DeleteSMSSandboxPhoneNumberRequest request) {
request = beforeClientExecution(request);
return executeDeleteSMSSandboxPhoneNumber(request);
}
@SdkInternalApi
final DeleteSMSSandboxPhoneNumberResult executeDeleteSMSSandboxPhoneNumber(DeleteSMSSandboxPhoneNumberRequest deleteSMSSandboxPhoneNumberRequest) {
ExecutionContext executionContext = createExecutionContext(deleteSMSSandboxPhoneNumberRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteSMSSandboxPhoneNumberRequestMarshaller().marshall(super.beforeMarshalling(deleteSMSSandboxPhoneNumberRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteSMSSandboxPhoneNumber");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new DeleteSMSSandboxPhoneNumberResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes a topic and all its subscriptions. Deleting a topic might prevent some messages previously sent to the
* topic from being delivered to subscribers. This action is idempotent, so deleting a topic that does not exist
* does not result in an error.
*
*
* @param deleteTopicRequest
* @return Result of the DeleteTopic 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.
* @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.
* @sample AmazonSNS.DeleteTopic
* @see AWS API
* Documentation
*/
@Override
public DeleteTopicResult deleteTopic(DeleteTopicRequest request) {
request = beforeClientExecution(request);
return executeDeleteTopic(request);
}
@SdkInternalApi
final DeleteTopicResult executeDeleteTopic(DeleteTopicRequest deleteTopicRequest) {
ExecutionContext executionContext = createExecutionContext(deleteTopicRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteTopicRequestMarshaller().marshall(super.beforeMarshalling(deleteTopicRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteTopic");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(new DeleteTopicResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public DeleteTopicResult deleteTopic(String topicArn) {
return deleteTopic(new DeleteTopicRequest().withTopicArn(topicArn));
}
/**
*
* Retrieves the specified inline DataProtectionPolicy
document that is stored in the specified Amazon
* SNS topic.
*
*
* @param getDataProtectionPolicyRequest
* @return Result of the GetDataProtectionPolicy 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 NotFoundException
* Indicates that the requested resource does not exist.
* @throws AuthorizationErrorException
* Indicates that the user has been denied access to the requested resource.
* @throws InvalidSecurityException
* The credential signature isn't valid. You must use an HTTPS endpoint and sign your request using
* Signature Version 4.
* @sample AmazonSNS.GetDataProtectionPolicy
* @see AWS
* API Documentation
*/
@Override
public GetDataProtectionPolicyResult getDataProtectionPolicy(GetDataProtectionPolicyRequest request) {
request = beforeClientExecution(request);
return executeGetDataProtectionPolicy(request);
}
@SdkInternalApi
final GetDataProtectionPolicyResult executeGetDataProtectionPolicy(GetDataProtectionPolicyRequest getDataProtectionPolicyRequest) {
ExecutionContext executionContext = createExecutionContext(getDataProtectionPolicyRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetDataProtectionPolicyRequestMarshaller().marshall(super.beforeMarshalling(getDataProtectionPolicyRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetDataProtectionPolicy");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new GetDataProtectionPolicyResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Retrieves the endpoint attributes for a device on one of the supported push notification services, such as GCM
* (Firebase Cloud Messaging) and APNS. For more information, see Using Amazon SNS Mobile Push
* Notifications.
*
*
* @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
* @see AWS API
* Documentation
*/
@Override
public GetEndpointAttributesResult getEndpointAttributes(GetEndpointAttributesRequest request) {
request = beforeClientExecution(request);
return executeGetEndpointAttributes(request);
}
@SdkInternalApi
final GetEndpointAttributesResult executeGetEndpointAttributes(GetEndpointAttributesRequest getEndpointAttributesRequest) {
ExecutionContext executionContext = createExecutionContext(getEndpointAttributesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetEndpointAttributesRequestMarshaller().marshall(super.beforeMarshalling(getEndpointAttributesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetEndpointAttributes");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new GetEndpointAttributesResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Retrieves the attributes of the platform application object for the supported push notification services, such as
* APNS and GCM (Firebase Cloud Messaging). For more information, see Using Amazon SNS Mobile Push
* Notifications.
*
*
* @param getPlatformApplicationAttributesRequest
* Input for GetPlatformApplicationAttributes action.
* @return Result of the GetPlatformApplicationAttributes 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.GetPlatformApplicationAttributes
* @see AWS API Documentation
*/
@Override
public GetPlatformApplicationAttributesResult getPlatformApplicationAttributes(GetPlatformApplicationAttributesRequest request) {
request = beforeClientExecution(request);
return executeGetPlatformApplicationAttributes(request);
}
@SdkInternalApi
final GetPlatformApplicationAttributesResult executeGetPlatformApplicationAttributes(
GetPlatformApplicationAttributesRequest getPlatformApplicationAttributesRequest) {
ExecutionContext executionContext = createExecutionContext(getPlatformApplicationAttributesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetPlatformApplicationAttributesRequestMarshaller().marshall(super.beforeMarshalling(getPlatformApplicationAttributesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetPlatformApplicationAttributes");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new GetPlatformApplicationAttributesResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns the settings for sending SMS messages from your Amazon Web Services account.
*
*
* These settings are set with the SetSMSAttributes
action.
*
*
* @param getSMSAttributesRequest
* The input for the GetSMSAttributes
request.
* @return Result of the GetSMSAttributes operation returned by the service.
* @throws ThrottledException
* Indicates that the rate at which requests have been submitted for this action exceeds the limit for your
* Amazon Web Services account.
* @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
* @see AWS API
* Documentation
*/
@Override
public GetSMSAttributesResult getSMSAttributes(GetSMSAttributesRequest request) {
request = beforeClientExecution(request);
return executeGetSMSAttributes(request);
}
@SdkInternalApi
final GetSMSAttributesResult executeGetSMSAttributes(GetSMSAttributesRequest getSMSAttributesRequest) {
ExecutionContext executionContext = createExecutionContext(getSMSAttributesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetSMSAttributesRequestMarshaller().marshall(super.beforeMarshalling(getSMSAttributesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetSMSAttributes");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new GetSMSAttributesResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Retrieves the SMS sandbox status for the calling Amazon Web Services account in the target Amazon Web Services
* Region.
*
*
* When you start using Amazon SNS to send SMS messages, your Amazon Web Services account is in the SMS
* sandbox. The SMS sandbox provides a safe environment for you to try Amazon SNS features without risking your
* reputation as an SMS sender. While your Amazon Web Services account is in the SMS sandbox, you can use all of the
* features of Amazon SNS. However, you can send SMS messages only to verified destination phone numbers. For more
* information, including how to move out of the sandbox to send messages without restrictions, see SMS sandbox in the Amazon SNS
* Developer Guide.
*
*
* @param getSMSSandboxAccountStatusRequest
* @return Result of the GetSMSSandboxAccountStatus operation returned by the service.
* @throws AuthorizationErrorException
* Indicates that the user has been denied access to the requested resource.
* @throws InternalErrorException
* Indicates an internal service error.
* @throws ThrottledException
* Indicates that the rate at which requests have been submitted for this action exceeds the limit for your
* Amazon Web Services account.
* @sample AmazonSNS.GetSMSSandboxAccountStatus
* @see AWS
* API Documentation
*/
@Override
public GetSMSSandboxAccountStatusResult getSMSSandboxAccountStatus(GetSMSSandboxAccountStatusRequest request) {
request = beforeClientExecution(request);
return executeGetSMSSandboxAccountStatus(request);
}
@SdkInternalApi
final GetSMSSandboxAccountStatusResult executeGetSMSSandboxAccountStatus(GetSMSSandboxAccountStatusRequest getSMSSandboxAccountStatusRequest) {
ExecutionContext executionContext = createExecutionContext(getSMSSandboxAccountStatusRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetSMSSandboxAccountStatusRequestMarshaller().marshall(super.beforeMarshalling(getSMSSandboxAccountStatusRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetSMSSandboxAccountStatus");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new GetSMSSandboxAccountStatusResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns all of the properties of a subscription.
*
*
* @param getSubscriptionAttributesRequest
* Input for GetSubscriptionAttributes.
* @return Result of the GetSubscriptionAttributes 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 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
* @see AWS
* API Documentation
*/
@Override
public GetSubscriptionAttributesResult getSubscriptionAttributes(GetSubscriptionAttributesRequest request) {
request = beforeClientExecution(request);
return executeGetSubscriptionAttributes(request);
}
@SdkInternalApi
final GetSubscriptionAttributesResult executeGetSubscriptionAttributes(GetSubscriptionAttributesRequest getSubscriptionAttributesRequest) {
ExecutionContext executionContext = createExecutionContext(getSubscriptionAttributesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetSubscriptionAttributesRequestMarshaller().marshall(super.beforeMarshalling(getSubscriptionAttributesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetSubscriptionAttributes");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new GetSubscriptionAttributesResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public GetSubscriptionAttributesResult getSubscriptionAttributes(String subscriptionArn) {
return getSubscriptionAttributes(new GetSubscriptionAttributesRequest().withSubscriptionArn(subscriptionArn));
}
/**
*
* Returns all of the properties of a topic. Topic properties returned might differ based on the authorization of
* the user.
*
*
* @param getTopicAttributesRequest
* Input for GetTopicAttributes action.
* @return Result of the GetTopicAttributes 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 NotFoundException
* Indicates that the requested resource does not exist.
* @throws AuthorizationErrorException
* Indicates that the user has been denied access to the requested resource.
* @throws InvalidSecurityException
* The credential signature isn't valid. You must use an HTTPS endpoint and sign your request using
* Signature Version 4.
* @sample AmazonSNS.GetTopicAttributes
* @see AWS API
* Documentation
*/
@Override
public GetTopicAttributesResult getTopicAttributes(GetTopicAttributesRequest request) {
request = beforeClientExecution(request);
return executeGetTopicAttributes(request);
}
@SdkInternalApi
final GetTopicAttributesResult executeGetTopicAttributes(GetTopicAttributesRequest getTopicAttributesRequest) {
ExecutionContext executionContext = createExecutionContext(getTopicAttributesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetTopicAttributesRequestMarshaller().marshall(super.beforeMarshalling(getTopicAttributesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetTopicAttributes");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new GetTopicAttributesResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public GetTopicAttributesResult getTopicAttributes(String topicArn) {
return getTopicAttributes(new GetTopicAttributesRequest().withTopicArn(topicArn));
}
/**
*
* 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).
*
*
* @param listEndpointsByPlatformApplicationRequest
* Input for ListEndpointsByPlatformApplication action.
* @return Result of the ListEndpointsByPlatformApplication 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.ListEndpointsByPlatformApplication
* @see AWS API Documentation
*/
@Override
public ListEndpointsByPlatformApplicationResult listEndpointsByPlatformApplication(ListEndpointsByPlatformApplicationRequest request) {
request = beforeClientExecution(request);
return executeListEndpointsByPlatformApplication(request);
}
@SdkInternalApi
final ListEndpointsByPlatformApplicationResult executeListEndpointsByPlatformApplication(
ListEndpointsByPlatformApplicationRequest listEndpointsByPlatformApplicationRequest) {
ExecutionContext executionContext = createExecutionContext(listEndpointsByPlatformApplicationRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListEndpointsByPlatformApplicationRequestMarshaller()
.marshall(super.beforeMarshalling(listEndpointsByPlatformApplicationRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListEndpointsByPlatformApplication");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new ListEndpointsByPlatformApplicationResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Lists the calling Amazon Web Services account's dedicated origination numbers and their metadata. For more
* information about origination numbers, see Origination numbers in the Amazon SNS Developer Guide.
*
*
* @param listOriginationNumbersRequest
* @return Result of the ListOriginationNumbers operation returned by the service.
* @throws InternalErrorException
* Indicates an internal service error.
* @throws AuthorizationErrorException
* Indicates that the user has been denied access to the requested resource.
* @throws ThrottledException
* Indicates that the rate at which requests have been submitted for this action exceeds the limit for your
* Amazon Web Services account.
* @throws InvalidParameterException
* Indicates that a request parameter does not comply with the associated constraints.
* @throws ValidationException
* Indicates that a parameter in the request is invalid.
* @sample AmazonSNS.ListOriginationNumbers
* @see AWS API
* Documentation
*/
@Override
public ListOriginationNumbersResult listOriginationNumbers(ListOriginationNumbersRequest request) {
request = beforeClientExecution(request);
return executeListOriginationNumbers(request);
}
@SdkInternalApi
final ListOriginationNumbersResult executeListOriginationNumbers(ListOriginationNumbersRequest listOriginationNumbersRequest) {
ExecutionContext executionContext = createExecutionContext(listOriginationNumbersRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListOriginationNumbersRequestMarshaller().marshall(super.beforeMarshalling(listOriginationNumbersRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListOriginationNumbers");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new ListOriginationNumbersResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns a list of phone numbers that are opted out, meaning you cannot send SMS messages to them.
*
*
* The results for ListPhoneNumbersOptedOut
are paginated, and each page returns up to 100 phone
* numbers. If additional phone numbers are available after the first page of results, then a NextToken
* string will be returned. To receive the next page, you call ListPhoneNumbersOptedOut
again using the
* NextToken
string received from the previous call. When there are no more records to return,
* NextToken
will be null.
*
*
* @param listPhoneNumbersOptedOutRequest
* The input for the ListPhoneNumbersOptedOut
action.
* @return Result of the ListPhoneNumbersOptedOut operation returned by the service.
* @throws ThrottledException
* Indicates that the rate at which requests have been submitted for this action exceeds the limit for your
* Amazon Web Services account.
* @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
* @see AWS
* API Documentation
*/
@Override
public ListPhoneNumbersOptedOutResult listPhoneNumbersOptedOut(ListPhoneNumbersOptedOutRequest request) {
request = beforeClientExecution(request);
return executeListPhoneNumbersOptedOut(request);
}
@SdkInternalApi
final ListPhoneNumbersOptedOutResult executeListPhoneNumbersOptedOut(ListPhoneNumbersOptedOutRequest listPhoneNumbersOptedOutRequest) {
ExecutionContext executionContext = createExecutionContext(listPhoneNumbersOptedOutRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListPhoneNumbersOptedOutRequestMarshaller().marshall(super.beforeMarshalling(listPhoneNumbersOptedOutRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListPhoneNumbersOptedOut");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new ListPhoneNumbersOptedOutResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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).
*
*
* @param listPlatformApplicationsRequest
* Input for ListPlatformApplications action.
* @return Result of the ListPlatformApplications 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.
* @sample AmazonSNS.ListPlatformApplications
* @see AWS
* API Documentation
*/
@Override
public ListPlatformApplicationsResult listPlatformApplications(ListPlatformApplicationsRequest request) {
request = beforeClientExecution(request);
return executeListPlatformApplications(request);
}
@SdkInternalApi
final ListPlatformApplicationsResult executeListPlatformApplications(ListPlatformApplicationsRequest listPlatformApplicationsRequest) {
ExecutionContext executionContext = createExecutionContext(listPlatformApplicationsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListPlatformApplicationsRequestMarshaller().marshall(super.beforeMarshalling(listPlatformApplicationsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListPlatformApplications");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new ListPlatformApplicationsResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public ListPlatformApplicationsResult listPlatformApplications() {
return listPlatformApplications(new ListPlatformApplicationsRequest());
}
/**
*
* Lists the calling Amazon Web Services account's current verified and pending destination phone numbers in the SMS
* sandbox.
*
*
* When you start using Amazon SNS to send SMS messages, your Amazon Web Services account is in the SMS
* sandbox. The SMS sandbox provides a safe environment for you to try Amazon SNS features without risking your
* reputation as an SMS sender. While your Amazon Web Services account is in the SMS sandbox, you can use all of the
* features of Amazon SNS. However, you can send SMS messages only to verified destination phone numbers. For more
* information, including how to move out of the sandbox to send messages without restrictions, see SMS sandbox in the Amazon SNS
* Developer Guide.
*
*
* @param listSMSSandboxPhoneNumbersRequest
* @return Result of the ListSMSSandboxPhoneNumbers operation returned by the service.
* @throws AuthorizationErrorException
* Indicates that the user has been denied access to the requested resource.
* @throws InternalErrorException
* Indicates an internal service error.
* @throws InvalidParameterException
* Indicates that a request parameter does not comply with the associated constraints.
* @throws ResourceNotFoundException
* Can’t perform the action on the specified resource. Make sure that the resource exists.
* @throws ThrottledException
* Indicates that the rate at which requests have been submitted for this action exceeds the limit for your
* Amazon Web Services account.
* @sample AmazonSNS.ListSMSSandboxPhoneNumbers
* @see AWS
* API Documentation
*/
@Override
public ListSMSSandboxPhoneNumbersResult listSMSSandboxPhoneNumbers(ListSMSSandboxPhoneNumbersRequest request) {
request = beforeClientExecution(request);
return executeListSMSSandboxPhoneNumbers(request);
}
@SdkInternalApi
final ListSMSSandboxPhoneNumbersResult executeListSMSSandboxPhoneNumbers(ListSMSSandboxPhoneNumbersRequest listSMSSandboxPhoneNumbersRequest) {
ExecutionContext executionContext = createExecutionContext(listSMSSandboxPhoneNumbersRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListSMSSandboxPhoneNumbersRequestMarshaller().marshall(super.beforeMarshalling(listSMSSandboxPhoneNumbersRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListSMSSandboxPhoneNumbers");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new ListSMSSandboxPhoneNumbersResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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).
*
*
* @param listSubscriptionsRequest
* Input for ListSubscriptions action.
* @return Result of the ListSubscriptions 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.
* @sample AmazonSNS.ListSubscriptions
* @see AWS API
* Documentation
*/
@Override
public ListSubscriptionsResult listSubscriptions(ListSubscriptionsRequest request) {
request = beforeClientExecution(request);
return executeListSubscriptions(request);
}
@SdkInternalApi
final ListSubscriptionsResult executeListSubscriptions(ListSubscriptionsRequest listSubscriptionsRequest) {
ExecutionContext executionContext = createExecutionContext(listSubscriptionsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListSubscriptionsRequestMarshaller().marshall(super.beforeMarshalling(listSubscriptionsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListSubscriptions");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new ListSubscriptionsResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public ListSubscriptionsResult listSubscriptions() {
return listSubscriptions(new ListSubscriptionsRequest());
}
@Override
public ListSubscriptionsResult listSubscriptions(String nextToken) {
return listSubscriptions(new ListSubscriptionsRequest().withNextToken(nextToken));
}
/**
*
* 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).
*
*
* @param listSubscriptionsByTopicRequest
* Input for ListSubscriptionsByTopic action.
* @return Result of the ListSubscriptionsByTopic 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 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
* @see AWS
* API Documentation
*/
@Override
public ListSubscriptionsByTopicResult listSubscriptionsByTopic(ListSubscriptionsByTopicRequest request) {
request = beforeClientExecution(request);
return executeListSubscriptionsByTopic(request);
}
@SdkInternalApi
final ListSubscriptionsByTopicResult executeListSubscriptionsByTopic(ListSubscriptionsByTopicRequest listSubscriptionsByTopicRequest) {
ExecutionContext executionContext = createExecutionContext(listSubscriptionsByTopicRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListSubscriptionsByTopicRequestMarshaller().marshall(super.beforeMarshalling(listSubscriptionsByTopicRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListSubscriptionsByTopic");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new ListSubscriptionsByTopicResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public ListSubscriptionsByTopicResult listSubscriptionsByTopic(String topicArn) {
return listSubscriptionsByTopic(new ListSubscriptionsByTopicRequest().withTopicArn(topicArn));
}
@Override
public ListSubscriptionsByTopicResult listSubscriptionsByTopic(String topicArn, String nextToken) {
return listSubscriptionsByTopic(new ListSubscriptionsByTopicRequest().withTopicArn(topicArn).withNextToken(nextToken));
}
/**
*
* 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 listTagsForResourceRequest
* @return Result of the ListTagsForResource operation returned by the service.
* @throws ResourceNotFoundException
* Can’t perform the action on the specified resource. Make sure that the resource 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.
* @sample AmazonSNS.ListTagsForResource
* @see AWS API
* Documentation
*/
@Override
public ListTagsForResourceResult listTagsForResource(ListTagsForResourceRequest request) {
request = beforeClientExecution(request);
return executeListTagsForResource(request);
}
@SdkInternalApi
final ListTagsForResourceResult executeListTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) {
ExecutionContext executionContext = createExecutionContext(listTagsForResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTagsForResourceRequestMarshaller().marshall(super.beforeMarshalling(listTagsForResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTagsForResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new ListTagsForResourceResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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).
*
*
* @param listTopicsRequest
* @return Result of the ListTopics 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.
* @sample AmazonSNS.ListTopics
* @see AWS API
* Documentation
*/
@Override
public ListTopicsResult listTopics(ListTopicsRequest request) {
request = beforeClientExecution(request);
return executeListTopics(request);
}
@SdkInternalApi
final ListTopicsResult executeListTopics(ListTopicsRequest listTopicsRequest) {
ExecutionContext executionContext = createExecutionContext(listTopicsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTopicsRequestMarshaller().marshall(super.beforeMarshalling(listTopicsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTopics");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(new ListTopicsResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public ListTopicsResult listTopics() {
return listTopics(new ListTopicsRequest());
}
@Override
public ListTopicsResult listTopics(String nextToken) {
return listTopics(new ListTopicsRequest().withNextToken(nextToken));
}
/**
*
* Use this request to opt in a phone number that is opted out, which enables you to resume sending SMS messages to
* the number.
*
*
* You can opt in a phone number only once every 30 days.
*
*
* @param optInPhoneNumberRequest
* Input for the OptInPhoneNumber action.
* @return Result of the OptInPhoneNumber operation returned by the service.
* @throws ThrottledException
* Indicates that the rate at which requests have been submitted for this action exceeds the limit for your
* Amazon Web Services account.
* @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
* @see AWS API
* Documentation
*/
@Override
public OptInPhoneNumberResult optInPhoneNumber(OptInPhoneNumberRequest request) {
request = beforeClientExecution(request);
return executeOptInPhoneNumber(request);
}
@SdkInternalApi
final OptInPhoneNumberResult executeOptInPhoneNumber(OptInPhoneNumberRequest optInPhoneNumberRequest) {
ExecutionContext executionContext = createExecutionContext(optInPhoneNumberRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new OptInPhoneNumberRequestMarshaller().marshall(super.beforeMarshalling(optInPhoneNumberRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "OptInPhoneNumber");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new OptInPhoneNumberResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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
* topic. The format of the message depends on the notification protocol for each subscribed endpoint.
*
*
* When a messageId
is returned, the message is saved and Amazon SNS immediately delivers it to
* subscribers.
*
*
* To use the Publish
action for publishing a message to a mobile endpoint, such as an app on a Kindle
* device or mobile phone, you must specify the EndpointArn for the TargetArn parameter. The EndpointArn is returned
* when making a call with the CreatePlatformEndpoint
action.
*
*
* For more information about formatting messages, see Send Custom
* Platform-Specific Payloads in Messages to Mobile Devices.
*
*
*
* You can publish messages only to topics and endpoints in the same Amazon Web Services Region.
*
*
*
* @param publishRequest
* Input for Publish action.
* @return Result of the Publish operation returned by the service.
* @throws InvalidParameterException
* Indicates that a request parameter does not comply with the associated constraints.
* @throws InvalidParameterValueException
* 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 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.
* @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 Key Management Service Developer Guide.
* @throws KMSNotFoundException
* The request was rejected because the specified entity or resource can't be found.
* @throws KMSOptInRequiredException
* The Amazon Web Services 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 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 ValidationException
* Indicates that a parameter in the request is invalid.
* @sample AmazonSNS.Publish
* @see AWS API
* Documentation
*/
@Override
public PublishResult publish(PublishRequest request) {
request = beforeClientExecution(request);
return executePublish(request);
}
@SdkInternalApi
final PublishResult executePublish(PublishRequest publishRequest) {
ExecutionContext executionContext = createExecutionContext(publishRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new PublishRequestMarshaller().marshall(super.beforeMarshalling(publishRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "Publish");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(new PublishResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public PublishResult publish(String topicArn, String message) {
return publish(new PublishRequest().withTopicArn(topicArn).withMessage(message));
}
@Override
public PublishResult publish(String topicArn, String message, String subject) {
return publish(new PublishRequest().withTopicArn(topicArn).withMessage(message).withSubject(subject));
}
/**
*
* Publishes up to ten messages to the specified topic. This is a batch version of Publish
. For FIFO
* topics, multiple messages within a single batch are published in the order they are sent, and messages are
* deduplicated within the batch and across batches for 5 minutes.
*
*
* The result of publishing each message is reported individually in the response. Because the batch request can
* result in a combination of successful and unsuccessful actions, you should check for batch errors even when the
* call returns an HTTP status code of 200
.
*
*
* The maximum allowed individual message size and the maximum total payload size (the sum of the individual lengths
* of all of the batched messages) are both 256 KB (262,144 bytes).
*
*
* Some actions take lists of parameters. These lists are specified using the param.n
notation. Values
* of n
are integers starting from 1. For example, a parameter list with two elements looks like this:
*
*
* &AttributeName.1=first
*
*
* &AttributeName.2=second
*
*
* If you send a batch message to a topic, Amazon SNS publishes the batch message to each endpoint that is
* subscribed to the topic. The format of the batch message depends on the notification protocol for each subscribed
* endpoint.
*
*
* When a messageId
is returned, the batch message is saved and Amazon SNS immediately delivers the
* message to subscribers.
*
*
* @param publishBatchRequest
* @return Result of the PublishBatch operation returned by the service.
* @throws InvalidParameterException
* Indicates that a request parameter does not comply with the associated constraints.
* @throws InvalidParameterValueException
* 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 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.
* @throws BatchEntryIdsNotDistinctException
* Two or more batch entries in the request have the same Id
.
* @throws BatchRequestTooLongException
* The length of all the batch messages put together is more than the limit.
* @throws EmptyBatchRequestException
* The batch request doesn't contain any entries.
* @throws InvalidBatchEntryIdException
* The Id
of a batch entry in a batch request doesn't abide by the specification.
* @throws TooManyEntriesInBatchRequestException
* The batch request contains more entries than permissible.
* @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 Key Management Service Developer Guide.
* @throws KMSNotFoundException
* The request was rejected because the specified entity or resource can't be found.
* @throws KMSOptInRequiredException
* The Amazon Web Services 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 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 ValidationException
* Indicates that a parameter in the request is invalid.
* @sample AmazonSNS.PublishBatch
* @see AWS API
* Documentation
*/
@Override
public PublishBatchResult publishBatch(PublishBatchRequest request) {
request = beforeClientExecution(request);
return executePublishBatch(request);
}
@SdkInternalApi
final PublishBatchResult executePublishBatch(PublishBatchRequest publishBatchRequest) {
ExecutionContext executionContext = createExecutionContext(publishBatchRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new PublishBatchRequestMarshaller().marshall(super.beforeMarshalling(publishBatchRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PublishBatch");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(new PublishBatchResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Adds or updates an inline policy document that is stored in the specified Amazon SNS topic.
*
*
* @param putDataProtectionPolicyRequest
* @return Result of the PutDataProtectionPolicy 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 NotFoundException
* Indicates that the requested resource does not exist.
* @throws AuthorizationErrorException
* Indicates that the user has been denied access to the requested resource.
* @throws InvalidSecurityException
* The credential signature isn't valid. You must use an HTTPS endpoint and sign your request using
* Signature Version 4.
* @sample AmazonSNS.PutDataProtectionPolicy
* @see AWS
* API Documentation
*/
@Override
public PutDataProtectionPolicyResult putDataProtectionPolicy(PutDataProtectionPolicyRequest request) {
request = beforeClientExecution(request);
return executePutDataProtectionPolicy(request);
}
@SdkInternalApi
final PutDataProtectionPolicyResult executePutDataProtectionPolicy(PutDataProtectionPolicyRequest putDataProtectionPolicyRequest) {
ExecutionContext executionContext = createExecutionContext(putDataProtectionPolicyRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new PutDataProtectionPolicyRequestMarshaller().marshall(super.beforeMarshalling(putDataProtectionPolicyRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutDataProtectionPolicy");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new PutDataProtectionPolicyResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Removes a statement from a topic's access control policy.
*
*
*
* To remove the ability to change topic permissions, you must deny permissions to the AddPermission
,
* RemovePermission
, and SetTopicAttributes
actions in your IAM policy.
*
*
*
* @param removePermissionRequest
* Input for RemovePermission action.
* @return Result of the RemovePermission 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.RemovePermission
* @see AWS API
* Documentation
*/
@Override
public RemovePermissionResult removePermission(RemovePermissionRequest request) {
request = beforeClientExecution(request);
return executeRemovePermission(request);
}
@SdkInternalApi
final RemovePermissionResult executeRemovePermission(RemovePermissionRequest removePermissionRequest) {
ExecutionContext executionContext = createExecutionContext(removePermissionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new RemovePermissionRequestMarshaller().marshall(super.beforeMarshalling(removePermissionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RemovePermission");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new RemovePermissionResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public RemovePermissionResult removePermission(String topicArn, String label) {
return removePermission(new RemovePermissionRequest().withTopicArn(topicArn).withLabel(label));
}
/**
*
* Sets the attributes for an endpoint for a device on one of the supported push notification services, such as GCM
* (Firebase Cloud Messaging) and APNS. For more information, see Using Amazon SNS Mobile Push
* Notifications.
*
*
* @param setEndpointAttributesRequest
* Input for SetEndpointAttributes action.
* @return Result of the SetEndpointAttributes 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.SetEndpointAttributes
* @see AWS API
* Documentation
*/
@Override
public SetEndpointAttributesResult setEndpointAttributes(SetEndpointAttributesRequest request) {
request = beforeClientExecution(request);
return executeSetEndpointAttributes(request);
}
@SdkInternalApi
final SetEndpointAttributesResult executeSetEndpointAttributes(SetEndpointAttributesRequest setEndpointAttributesRequest) {
ExecutionContext executionContext = createExecutionContext(setEndpointAttributesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new SetEndpointAttributesRequestMarshaller().marshall(super.beforeMarshalling(setEndpointAttributesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SetEndpointAttributes");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new SetEndpointAttributesResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Sets the attributes of the platform application object for the supported push notification services, such as APNS
* 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.
* @return Result of the SetPlatformApplicationAttributes 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.SetPlatformApplicationAttributes
* @see AWS API Documentation
*/
@Override
public SetPlatformApplicationAttributesResult setPlatformApplicationAttributes(SetPlatformApplicationAttributesRequest request) {
request = beforeClientExecution(request);
return executeSetPlatformApplicationAttributes(request);
}
@SdkInternalApi
final SetPlatformApplicationAttributesResult executeSetPlatformApplicationAttributes(
SetPlatformApplicationAttributesRequest setPlatformApplicationAttributesRequest) {
ExecutionContext executionContext = createExecutionContext(setPlatformApplicationAttributesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new SetPlatformApplicationAttributesRequestMarshaller().marshall(super.beforeMarshalling(setPlatformApplicationAttributesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SetPlatformApplicationAttributes");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new SetPlatformApplicationAttributesResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Use this request to set the default settings for sending SMS messages and receiving daily SMS usage reports.
*
*
* 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 Publishing to a mobile phone in
* the Amazon SNS Developer Guide.
*
*
*
* To use this operation, you must grant the Amazon SNS service principal (sns.amazonaws.com
)
* permission to perform the s3:ListBucket
action.
*
*
*
* @param setSMSAttributesRequest
* The input for the SetSMSAttributes action.
* @return Result of the SetSMSAttributes operation returned by the service.
* @throws InvalidParameterException
* Indicates that a request parameter does not comply with the associated constraints.
* @throws ThrottledException
* Indicates that the rate at which requests have been submitted for this action exceeds the limit for your
* Amazon Web Services 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
* @see AWS API
* Documentation
*/
@Override
public SetSMSAttributesResult setSMSAttributes(SetSMSAttributesRequest request) {
request = beforeClientExecution(request);
return executeSetSMSAttributes(request);
}
@SdkInternalApi
final SetSMSAttributesResult executeSetSMSAttributes(SetSMSAttributesRequest setSMSAttributesRequest) {
ExecutionContext executionContext = createExecutionContext(setSMSAttributesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new SetSMSAttributesRequestMarshaller().marshall(super.beforeMarshalling(setSMSAttributesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SetSMSAttributes");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new SetSMSAttributesResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Allows a subscription owner to set an attribute of the subscription to a new value.
*
*
* @param setSubscriptionAttributesRequest
* Input for SetSubscriptionAttributes action.
* @return Result of the SetSubscriptionAttributes operation returned by the service.
* @throws InvalidParameterException
* Indicates that a request parameter does not comply with the associated constraints.
* @throws FilterPolicyLimitExceededException
* Indicates that the number of filter polices in your Amazon Web Services account exceeds the limit. To add
* more filter polices, submit an Amazon SNS Limit Increase case in the Amazon Web Services Support Center.
* @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
* @see AWS
* API Documentation
*/
@Override
public SetSubscriptionAttributesResult setSubscriptionAttributes(SetSubscriptionAttributesRequest request) {
request = beforeClientExecution(request);
return executeSetSubscriptionAttributes(request);
}
@SdkInternalApi
final SetSubscriptionAttributesResult executeSetSubscriptionAttributes(SetSubscriptionAttributesRequest setSubscriptionAttributesRequest) {
ExecutionContext executionContext = createExecutionContext(setSubscriptionAttributesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new SetSubscriptionAttributesRequestMarshaller().marshall(super.beforeMarshalling(setSubscriptionAttributesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SetSubscriptionAttributes");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new SetSubscriptionAttributesResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public SetSubscriptionAttributesResult setSubscriptionAttributes(String subscriptionArn, String attributeName, String attributeValue) {
return setSubscriptionAttributes(new SetSubscriptionAttributesRequest().withSubscriptionArn(subscriptionArn).withAttributeName(attributeName)
.withAttributeValue(attributeValue));
}
/**
*
* Allows a topic owner to set an attribute of the topic to a new value.
*
*
*
* To remove the ability to change topic permissions, you must deny permissions to the AddPermission
,
* RemovePermission
, and SetTopicAttributes
actions in your IAM policy.
*
*
*
* @param setTopicAttributesRequest
* Input for SetTopicAttributes action.
* @return Result of the SetTopicAttributes 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 NotFoundException
* Indicates that the requested resource does not exist.
* @throws AuthorizationErrorException
* Indicates that the user has been denied access to the requested resource.
* @throws InvalidSecurityException
* The credential signature isn't valid. You must use an HTTPS endpoint and sign your request using
* Signature Version 4.
* @sample AmazonSNS.SetTopicAttributes
* @see AWS API
* Documentation
*/
@Override
public SetTopicAttributesResult setTopicAttributes(SetTopicAttributesRequest request) {
request = beforeClientExecution(request);
return executeSetTopicAttributes(request);
}
@SdkInternalApi
final SetTopicAttributesResult executeSetTopicAttributes(SetTopicAttributesRequest setTopicAttributesRequest) {
ExecutionContext executionContext = createExecutionContext(setTopicAttributesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new SetTopicAttributesRequestMarshaller().marshall(super.beforeMarshalling(setTopicAttributesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SetTopicAttributes");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new SetTopicAttributesResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public SetTopicAttributesResult setTopicAttributes(String topicArn, String attributeName, String attributeValue) {
return setTopicAttributes(new SetTopicAttributesRequest().withTopicArn(topicArn).withAttributeName(attributeName).withAttributeValue(attributeValue));
}
/**
*
* 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 Amazon Web Services account, the endpoint owner must run 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).
*
*
* @param subscribeRequest
* Input for Subscribe action.
* @return Result of the Subscribe operation returned by the service.
* @throws SubscriptionLimitExceededException
* Indicates that the customer already owns the maximum allowed number of subscriptions.
* @throws FilterPolicyLimitExceededException
* Indicates that the number of filter polices in your Amazon Web Services account exceeds the limit. To add
* more filter polices, submit an Amazon SNS Limit Increase case in the Amazon Web Services Support Center.
* @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 InvalidSecurityException
* The credential signature isn't valid. You must use an HTTPS endpoint and sign your request using
* Signature Version 4.
* @sample AmazonSNS.Subscribe
* @see AWS API
* Documentation
*/
@Override
public SubscribeResult subscribe(SubscribeRequest request) {
request = beforeClientExecution(request);
return executeSubscribe(request);
}
@SdkInternalApi
final SubscribeResult executeSubscribe(SubscribeRequest subscribeRequest) {
ExecutionContext executionContext = createExecutionContext(subscribeRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new SubscribeRequestMarshaller().marshall(super.beforeMarshalling(subscribeRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "Subscribe");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(new SubscribeResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public SubscribeResult subscribe(String topicArn, String protocol, String endpoint) {
return subscribe(new SubscribeRequest().withTopicArn(topicArn).withProtocol(protocol).withEndpoint(endpoint));
}
/**
*
* 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 Amazon Web Services account, per Amazon Web Services Region. If your
* application requires a higher throughput, file a technical support
* request.
*
*
*
*
* @param tagResourceRequest
* @return Result of the TagResource operation returned by the service.
* @throws ResourceNotFoundException
* Can’t perform the action on the specified resource. Make sure that the resource 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.
* @sample AmazonSNS.TagResource
* @see AWS API
* Documentation
*/
@Override
public TagResourceResult tagResource(TagResourceRequest request) {
request = beforeClientExecution(request);
return executeTagResource(request);
}
@SdkInternalApi
final TagResourceResult executeTagResource(TagResourceRequest tagResourceRequest) {
ExecutionContext executionContext = createExecutionContext(tagResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new TagResourceRequestMarshaller().marshall(super.beforeMarshalling(tagResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(new TagResourceResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes a subscription. If the subscription requires authentication for deletion, only the owner of the
* subscription or the topic's owner can unsubscribe, and an Amazon Web Services signature is required. If the
* Unsubscribe
call does not require authentication and the requester is not the subscription owner, a
* final cancellation message is delivered to the endpoint, so that the endpoint owner can easily resubscribe to the
* topic if the Unsubscribe
request was unintended.
*
*
*
* Amazon SQS queue subscriptions require authentication for deletion. Only the owner of the subscription, or the
* owner of the topic can unsubscribe using the required Amazon Web Services signature.
*
*
*
* This action is throttled at 100 transactions per second (TPS).
*
*
* @param unsubscribeRequest
* Input for Unsubscribe action.
* @return Result of the Unsubscribe 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.
* @throws InvalidSecurityException
* The credential signature isn't valid. You must use an HTTPS endpoint and sign your request using
* Signature Version 4.
* @sample AmazonSNS.Unsubscribe
* @see AWS API
* Documentation
*/
@Override
public UnsubscribeResult unsubscribe(UnsubscribeRequest request) {
request = beforeClientExecution(request);
return executeUnsubscribe(request);
}
@SdkInternalApi
final UnsubscribeResult executeUnsubscribe(UnsubscribeRequest unsubscribeRequest) {
ExecutionContext executionContext = createExecutionContext(unsubscribeRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UnsubscribeRequestMarshaller().marshall(super.beforeMarshalling(unsubscribeRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "Unsubscribe");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(new UnsubscribeResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public UnsubscribeResult unsubscribe(String subscriptionArn) {
return unsubscribe(new UnsubscribeRequest().withSubscriptionArn(subscriptionArn));
}
/**
*
* Remove tags from the specified Amazon SNS topic. For an overview, see Amazon SNS Tags in the Amazon SNS Developer
* Guide.
*
*
* @param untagResourceRequest
* @return Result of the UntagResource operation returned by the service.
* @throws ResourceNotFoundException
* Can’t perform the action on the specified resource. Make sure that the resource 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.
* @sample AmazonSNS.UntagResource
* @see AWS API
* Documentation
*/
@Override
public UntagResourceResult untagResource(UntagResourceRequest request) {
request = beforeClientExecution(request);
return executeUntagResource(request);
}
@SdkInternalApi
final UntagResourceResult executeUntagResource(UntagResourceRequest untagResourceRequest) {
ExecutionContext executionContext = createExecutionContext(untagResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UntagResourceRequestMarshaller().marshall(super.beforeMarshalling(untagResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UntagResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(new UntagResourceResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Verifies a destination phone number with a one-time password (OTP) for the calling Amazon Web Services account.
*
*
* When you start using Amazon SNS to send SMS messages, your Amazon Web Services account is in the SMS
* sandbox. The SMS sandbox provides a safe environment for you to try Amazon SNS features without risking your
* reputation as an SMS sender. While your Amazon Web Services account is in the SMS sandbox, you can use all of the
* features of Amazon SNS. However, you can send SMS messages only to verified destination phone numbers. For more
* information, including how to move out of the sandbox to send messages without restrictions, see SMS sandbox in the Amazon SNS
* Developer Guide.
*
*
* @param verifySMSSandboxPhoneNumberRequest
* @return Result of the VerifySMSSandboxPhoneNumber operation returned by the service.
* @throws AuthorizationErrorException
* Indicates that the user has been denied access to the requested resource.
* @throws InternalErrorException
* Indicates an internal service error.
* @throws InvalidParameterException
* Indicates that a request parameter does not comply with the associated constraints.
* @throws ResourceNotFoundException
* Can’t perform the action on the specified resource. Make sure that the resource exists.
* @throws VerificationException
* Indicates that the one-time password (OTP) used for verification is invalid.
* @throws ThrottledException
* Indicates that the rate at which requests have been submitted for this action exceeds the limit for your
* Amazon Web Services account.
* @sample AmazonSNS.VerifySMSSandboxPhoneNumber
* @see AWS API Documentation
*/
@Override
public VerifySMSSandboxPhoneNumberResult verifySMSSandboxPhoneNumber(VerifySMSSandboxPhoneNumberRequest request) {
request = beforeClientExecution(request);
return executeVerifySMSSandboxPhoneNumber(request);
}
@SdkInternalApi
final VerifySMSSandboxPhoneNumberResult executeVerifySMSSandboxPhoneNumber(VerifySMSSandboxPhoneNumberRequest verifySMSSandboxPhoneNumberRequest) {
ExecutionContext executionContext = createExecutionContext(verifySMSSandboxPhoneNumberRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new VerifySMSSandboxPhoneNumberRequestMarshaller().marshall(super.beforeMarshalling(verifySMSSandboxPhoneNumberRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "VerifySMSSandboxPhoneNumber");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new VerifySMSSandboxPhoneNumberResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* 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 the request.
*
* @param request
* The originally executed request
*
* @return The response metadata for the specified request, or null if none is available.
*/
public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) {
return client.getResponseMetadataForRequest(request);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private Response invoke(Request request, HttpResponseHandler> responseHandler,
ExecutionContext executionContext) {
return invoke(request, responseHandler, executionContext, null, null);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private Response invoke(Request request, HttpResponseHandler> responseHandler,
ExecutionContext executionContext, URI cachedEndpoint, URI uriFromEndpointTrait) {
executionContext.setCredentialsProvider(CredentialUtils.getCredentialsProvider(request.getOriginalRequest(), awsCredentialsProvider));
return doInvoke(request, responseHandler, executionContext, cachedEndpoint, uriFromEndpointTrait);
}
/**
* Invoke with no authentication. Credentials are not required and any credentials set on the client or request will
* be ignored for this operation.
**/
private Response anonymousInvoke(Request request,
HttpResponseHandler> responseHandler, ExecutionContext executionContext) {
return doInvoke(request, responseHandler, executionContext, null, null);
}
/**
* Invoke the request using the http client. Assumes credentials (or lack thereof) have been configured in the
* ExecutionContext beforehand.
**/
private Response doInvoke(Request request, HttpResponseHandler> responseHandler,
ExecutionContext executionContext, URI discoveredEndpoint, URI uriFromEndpointTrait) {
if (discoveredEndpoint != null) {
request.setEndpoint(discoveredEndpoint);
request.getOriginalRequest().getRequestClientOptions().appendUserAgent("endpoint-discovery");
} else if (uriFromEndpointTrait != null) {
request.setEndpoint(uriFromEndpointTrait);
} else {
request.setEndpoint(endpoint);
}
request.setTimeOffset(timeOffset);
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallersMap, defaultUnmarshaller);
return client.execute(request, responseHandler, errorResponseHandler, executionContext);
}
@Override
public void shutdown() {
super.shutdown();
}
}