com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk Show documentation
/*
* Copyright 2010-2014 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.simpleemail;
import org.w3c.dom.*;
import java.net.*;
import java.util.*;
import java.util.Map.Entry;
import com.amazonaws.*;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.services.simpleemail.model.*;
import com.amazonaws.services.simpleemail.model.transform.*;
/**
* Client for accessing AmazonSimpleEmailService. All service calls made
* using this client are blocking, and will not return until the service call
* completes.
*
* Amazon Simple Email Service
* This is the API Reference for Amazon Simple Email Service (Amazon
* SES). This documentation is intended to be used in conjunction with
* the
* Amazon SES Developer Guide
* .
*
*
* NOTE:For a list of Amazon SES endpoints to use in service
* requests, see Regions and Amazon SES in the Amazon SES Developer
* Guide.
*
*/
public class AmazonSimpleEmailServiceClient extends AmazonWebServiceClient implements AmazonSimpleEmailService {
/** Provider for AWS credentials. */
private AWSCredentialsProvider awsCredentialsProvider;
/**
* List of exception unmarshallers for all AmazonSimpleEmailService exceptions.
*/
protected final List> exceptionUnmarshallers
= new ArrayList>();
/**
* Constructs a new client to invoke service methods on
* AmazonSimpleEmailService. 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
*/
public AmazonSimpleEmailServiceClient() {
this(new DefaultAWSCredentialsProviderChain(), new ClientConfiguration());
}
/**
* Constructs a new client to invoke service methods on
* AmazonSimpleEmailService. 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 AmazonSimpleEmailService
* (ex: proxy settings, retry counts, etc.).
*
* @see DefaultAWSCredentialsProviderChain
*/
public AmazonSimpleEmailServiceClient(ClientConfiguration clientConfiguration) {
this(new DefaultAWSCredentialsProviderChain(), clientConfiguration);
}
/**
* Constructs a new client to invoke service methods on
* AmazonSimpleEmailService 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.
*/
public AmazonSimpleEmailServiceClient(AWSCredentials awsCredentials) {
this(awsCredentials, new ClientConfiguration());
}
/**
* Constructs a new client to invoke service methods on
* AmazonSimpleEmailService 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 AmazonSimpleEmailService
* (ex: proxy settings, retry counts, etc.).
*/
public AmazonSimpleEmailServiceClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration) {
super(clientConfiguration);
this.awsCredentialsProvider = new StaticCredentialsProvider(awsCredentials);
init();
}
/**
* Constructs a new client to invoke service methods on
* AmazonSimpleEmailService 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.
*/
public AmazonSimpleEmailServiceClient(AWSCredentialsProvider awsCredentialsProvider) {
this(awsCredentialsProvider, new ClientConfiguration());
}
/**
* Constructs a new client to invoke service methods on
* AmazonSimpleEmailService 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 AmazonSimpleEmailService
* (ex: proxy settings, retry counts, etc.).
*/
public AmazonSimpleEmailServiceClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) {
this(awsCredentialsProvider, clientConfiguration, null);
}
/**
* Constructs a new client to invoke service methods on
* AmazonSimpleEmailService 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 AmazonSimpleEmailService
* (ex: proxy settings, retry counts, etc.).
* @param requestMetricCollector optional request metric collector
*/
public AmazonSimpleEmailServiceClient(AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration,
RequestMetricCollector requestMetricCollector) {
super(clientConfiguration, requestMetricCollector);
this.awsCredentialsProvider = awsCredentialsProvider;
init();
}
private void init() {
exceptionUnmarshallers.add(new MessageRejectedExceptionUnmarshaller());
exceptionUnmarshallers.add(new StandardErrorUnmarshaller());
// calling this.setEndPoint(...) will also modify the signer accordingly
this.setEndpoint("email.us-east-1.amazonaws.com");
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandler2s.addAll(chainFactory.newRequestHandlerChain(
"/com/amazonaws/services/simpleemail/request.handlers"));
requestHandler2s.addAll(chainFactory.newRequestHandler2Chain(
"/com/amazonaws/services/simpleemail/request.handler2s"));
}
/**
*
* Deletes the specified identity (email address or domain) from the list
* of verified identities.
*
*
* This action is throttled at one request per second.
*
*
* @param deleteIdentityRequest Container for the necessary parameters to
* execute the DeleteIdentity service method on AmazonSimpleEmailService.
*
* @return The response from the DeleteIdentity service method, as
* returned by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public DeleteIdentityResult deleteIdentity(DeleteIdentityRequest deleteIdentityRequest) {
ExecutionContext executionContext = createExecutionContext(deleteIdentityRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
Response response = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new DeleteIdentityRequestMarshaller().marshall(deleteIdentityRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
response = invoke(request, new DeleteIdentityResultStaxUnmarshaller(), executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns a list containing all of the email addresses that have been
* verified.
*
*
* IMPORTANT:The ListVerifiedEmailAddresses action is deprecated
* as of the May 15, 2012 release of Domain Verification. The
* ListIdentities action is now preferred.
*
*
* This action is throttled at one request per second.
*
*
* @param listVerifiedEmailAddressesRequest Container for the necessary
* parameters to execute the ListVerifiedEmailAddresses service method on
* AmazonSimpleEmailService.
*
* @return The response from the ListVerifiedEmailAddresses service
* method, as returned by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public ListVerifiedEmailAddressesResult listVerifiedEmailAddresses(ListVerifiedEmailAddressesRequest listVerifiedEmailAddressesRequest) {
ExecutionContext executionContext = createExecutionContext(listVerifiedEmailAddressesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
Response response = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new ListVerifiedEmailAddressesRequestMarshaller().marshall(listVerifiedEmailAddressesRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
response = invoke(request, new ListVerifiedEmailAddressesResultStaxUnmarshaller(), executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns the user's sending statistics. The result is a list of data
* points, representing the last two weeks of sending activity.
*
*
* Each data point in the list contains statistics for a 15-minute
* interval.
*
*
* This action is throttled at one request per second.
*
*
* @param getSendStatisticsRequest Container for the necessary parameters
* to execute the GetSendStatistics service method on
* AmazonSimpleEmailService.
*
* @return The response from the GetSendStatistics service method, as
* returned by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public GetSendStatisticsResult getSendStatistics(GetSendStatisticsRequest getSendStatisticsRequest) {
ExecutionContext executionContext = createExecutionContext(getSendStatisticsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
Response response = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new GetSendStatisticsRequestMarshaller().marshall(getSendStatisticsRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
response = invoke(request, new GetSendStatisticsResultStaxUnmarshaller(), executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Verifies an email address. This action causes a confirmation email
* message to be sent to the specified address.
*
*
* This action is throttled at one request per second.
*
*
* @param verifyEmailIdentityRequest Container for the necessary
* parameters to execute the VerifyEmailIdentity service method on
* AmazonSimpleEmailService.
*
* @return The response from the VerifyEmailIdentity service method, as
* returned by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public VerifyEmailIdentityResult verifyEmailIdentity(VerifyEmailIdentityRequest verifyEmailIdentityRequest) {
ExecutionContext executionContext = createExecutionContext(verifyEmailIdentityRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
Response response = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new VerifyEmailIdentityRequestMarshaller().marshall(verifyEmailIdentityRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
response = invoke(request, new VerifyEmailIdentityResultStaxUnmarshaller(), executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Given a list of verified identities (email addresses and/or domains),
* returns a structure describing identity notification attributes.
*
*
* This action is throttled at one request per second.
*
*
* For more information about feedback notification, see the
* Amazon SES Developer Guide
* .
*
*
* @param getIdentityNotificationAttributesRequest Container for the
* necessary parameters to execute the GetIdentityNotificationAttributes
* service method on AmazonSimpleEmailService.
*
* @return The response from the GetIdentityNotificationAttributes
* service method, as returned by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public GetIdentityNotificationAttributesResult getIdentityNotificationAttributes(GetIdentityNotificationAttributesRequest getIdentityNotificationAttributesRequest) {
ExecutionContext executionContext = createExecutionContext(getIdentityNotificationAttributesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
Response response = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new GetIdentityNotificationAttributesRequestMarshaller().marshall(getIdentityNotificationAttributesRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
response = invoke(request, new GetIdentityNotificationAttributesResultStaxUnmarshaller(), executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns a set of DKIM tokens for a domain. DKIM tokens are
* character strings that represent your domain's identity. Using these
* tokens, you will need to create DNS CNAME records that point to DKIM
* public keys hosted by Amazon SES. Amazon Web Services will eventually
* detect that you have updated your DNS records; this detection process
* may take up to 72 hours. Upon successful detection, Amazon SES will be
* able to DKIM-sign email originating from that domain.
*
*
* This action is throttled at one request per second.
*
*
* To enable or disable Easy DKIM signing for a domain, use the
* SetIdentityDkimEnabled
action.
*
*
* For more information about creating DNS records using DKIM tokens, go
* to the
* Amazon SES Developer Guide
* .
*
*
* @param verifyDomainDkimRequest Container for the necessary parameters
* to execute the VerifyDomainDkim service method on
* AmazonSimpleEmailService.
*
* @return The response from the VerifyDomainDkim service method, as
* returned by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public VerifyDomainDkimResult verifyDomainDkim(VerifyDomainDkimRequest verifyDomainDkimRequest) {
ExecutionContext executionContext = createExecutionContext(verifyDomainDkimRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
Response response = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new VerifyDomainDkimRequestMarshaller().marshall(verifyDomainDkimRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
response = invoke(request, new VerifyDomainDkimResultStaxUnmarshaller(), executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns the current status of Easy DKIM signing for an entity. For
* domain name identities, this action also returns the DKIM tokens that
* are required for Easy DKIM signing, and whether Amazon SES has
* successfully verified that these tokens have been published.
*
*
* This action takes a list of identities as input and returns the
* following information for each:
*
*
*
* - Whether Easy DKIM signing is enabled or disabled.
* - A set of DKIM tokens that represent the identity. If the identity
* is an email address, the tokens represent the domain of that
* address.
* - Whether Amazon SES has successfully verified the DKIM tokens
* published in the domain's DNS. This information is only returned for
* domain name identities, not for email addresses.
*
*
*
* This action is throttled at one request per second.
*
*
* For more information about creating DNS records using DKIM tokens, go
* to the
* Amazon SES Developer Guide
* .
*
*
* @param getIdentityDkimAttributesRequest Container for the necessary
* parameters to execute the GetIdentityDkimAttributes service method on
* AmazonSimpleEmailService.
*
* @return The response from the GetIdentityDkimAttributes service
* method, as returned by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public GetIdentityDkimAttributesResult getIdentityDkimAttributes(GetIdentityDkimAttributesRequest getIdentityDkimAttributesRequest) {
ExecutionContext executionContext = createExecutionContext(getIdentityDkimAttributesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
Response response = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new GetIdentityDkimAttributesRequestMarshaller().marshall(getIdentityDkimAttributesRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
response = invoke(request, new GetIdentityDkimAttributesResultStaxUnmarshaller(), executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Verifies an email address. This action causes a confirmation email
* message to be sent to the specified address.
*
*
* IMPORTANT:The VerifyEmailAddress action is deprecated as of the
* May 15, 2012 release of Domain Verification. The VerifyEmailIdentity
* action is now preferred.
*
*
* This action is throttled at one request per second.
*
*
* @param verifyEmailAddressRequest Container for the necessary
* parameters to execute the VerifyEmailAddress service method on
* AmazonSimpleEmailService.
*
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public void verifyEmailAddress(VerifyEmailAddressRequest verifyEmailAddressRequest) {
ExecutionContext executionContext = createExecutionContext(verifyEmailAddressRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new VerifyEmailAddressRequestMarshaller().marshall(verifyEmailAddressRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
invoke(request, null, executionContext);
} finally {
endClientExecution(awsRequestMetrics, request, null);
}
}
/**
*
* Sends an email message, with header and content specified by the
* client. The SendRawEmail
action is useful for sending
* multipart MIME emails. The raw text of the message must comply with
* Internet email standards; otherwise, the message cannot be sent.
*
*
* IMPORTANT: You can only send email from verified email
* addresses and domains. If you have not requested production access to
* Amazon SES, you must also verify every recipient email address except
* for the recipients provided by the Amazon SES mailbox simulator. For
* more information, go to the Amazon SES Developer Guide.
*
*
* The total size of the message cannot exceed 10 MB. This includes any
* attachments that are part of the message.
*
*
* Amazon SES has a limit on the total number of recipients per message:
* The combined number of To:, CC: and BCC: email addresses cannot exceed
* 50. If you need to send an email message to a larger audience, you can
* divide your recipient list into groups of 50 or fewer, and then call
* Amazon SES repeatedly to send the message to each group.
*
*
* For every message that you send, the total number of recipients (To:,
* CC: and BCC:) is counted against your sending quota - the
* maximum number of emails you can send in a 24-hour period. For
* information about your sending quota, go to the
* Amazon SES Developer Guide
* .
*
*
* @param sendRawEmailRequest Container for the necessary parameters to
* execute the SendRawEmail service method on AmazonSimpleEmailService.
*
* @return The response from the SendRawEmail service method, as returned
* by AmazonSimpleEmailService.
*
* @throws MessageRejectedException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public SendRawEmailResult sendRawEmail(SendRawEmailRequest sendRawEmailRequest) {
ExecutionContext executionContext = createExecutionContext(sendRawEmailRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
Response response = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new SendRawEmailRequestMarshaller().marshall(sendRawEmailRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
response = invoke(request, new SendRawEmailResultStaxUnmarshaller(), executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns a list containing all of the identities (email addresses and
* domains) for a specific AWS Account, regardless of verification
* status.
*
*
* This action is throttled at one request per second.
*
*
* @param listIdentitiesRequest Container for the necessary parameters to
* execute the ListIdentities service method on AmazonSimpleEmailService.
*
* @return The response from the ListIdentities service method, as
* returned by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public ListIdentitiesResult listIdentities(ListIdentitiesRequest listIdentitiesRequest) {
ExecutionContext executionContext = createExecutionContext(listIdentitiesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
Response response = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new ListIdentitiesRequestMarshaller().marshall(listIdentitiesRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
response = invoke(request, new ListIdentitiesResultStaxUnmarshaller(), executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Given a list of identities (email addresses and/or domains), returns
* the verification status and (for domain identities) the verification
* token for each identity.
*
*
* This action is throttled at one request per second.
*
*
* @param getIdentityVerificationAttributesRequest Container for the
* necessary parameters to execute the GetIdentityVerificationAttributes
* service method on AmazonSimpleEmailService.
*
* @return The response from the GetIdentityVerificationAttributes
* service method, as returned by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public GetIdentityVerificationAttributesResult getIdentityVerificationAttributes(GetIdentityVerificationAttributesRequest getIdentityVerificationAttributesRequest) {
ExecutionContext executionContext = createExecutionContext(getIdentityVerificationAttributesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
Response response = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new GetIdentityVerificationAttributesRequestMarshaller().marshall(getIdentityVerificationAttributesRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
response = invoke(request, new GetIdentityVerificationAttributesResultStaxUnmarshaller(), executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Enables or disables Easy DKIM signing of email sent from an identity:
*
*
*
* - If Easy DKIM signing is enabled for a domain name identity (e.g.,
*
example.com
), then Amazon SES will DKIM-sign all email
* sent by addresses under that domain name (e.g.,
* [email protected]
).
* - If Easy DKIM signing is enabled for an email address, then Amazon
* SES will DKIM-sign all email sent by that email address.
*
*
*
* For email addresses (e.g., [email protected]
), you can
* only enable Easy DKIM signing if the corresponding domain (e.g.,
* example.com
) has been set up for Easy DKIM using the AWS
* Console or the VerifyDomainDkim
action.
*
*
* This action is throttled at one request per second.
*
*
* For more information about Easy DKIM signing, go to the
* Amazon SES Developer Guide
* .
*
*
* @param setIdentityDkimEnabledRequest Container for the necessary
* parameters to execute the SetIdentityDkimEnabled service method on
* AmazonSimpleEmailService.
*
* @return The response from the SetIdentityDkimEnabled service method,
* as returned by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public SetIdentityDkimEnabledResult setIdentityDkimEnabled(SetIdentityDkimEnabledRequest setIdentityDkimEnabledRequest) {
ExecutionContext executionContext = createExecutionContext(setIdentityDkimEnabledRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
Response response = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new SetIdentityDkimEnabledRequestMarshaller().marshall(setIdentityDkimEnabledRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
response = invoke(request, new SetIdentityDkimEnabledResultStaxUnmarshaller(), executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns the user's current sending limits.
*
*
* This action is throttled at one request per second.
*
*
* @param getSendQuotaRequest Container for the necessary parameters to
* execute the GetSendQuota service method on AmazonSimpleEmailService.
*
* @return The response from the GetSendQuota service method, as returned
* by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public GetSendQuotaResult getSendQuota(GetSendQuotaRequest getSendQuotaRequest) {
ExecutionContext executionContext = createExecutionContext(getSendQuotaRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
Response response = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new GetSendQuotaRequestMarshaller().marshall(getSendQuotaRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
response = invoke(request, new GetSendQuotaResultStaxUnmarshaller(), executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Given an identity (email address or domain), enables or disables
* whether Amazon SES forwards feedback notifications as email. Feedback
* forwarding may only be disabled when both complaint and bounce topics
* are set.
*
*
* This action is throttled at one request per second.
*
*
* For more information about feedback notification, see the
* Amazon SES Developer Guide
* .
*
*
* @param setIdentityFeedbackForwardingEnabledRequest Container for the
* necessary parameters to execute the
* SetIdentityFeedbackForwardingEnabled service method on
* AmazonSimpleEmailService.
*
* @return The response from the SetIdentityFeedbackForwardingEnabled
* service method, as returned by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public SetIdentityFeedbackForwardingEnabledResult setIdentityFeedbackForwardingEnabled(SetIdentityFeedbackForwardingEnabledRequest setIdentityFeedbackForwardingEnabledRequest) {
ExecutionContext executionContext = createExecutionContext(setIdentityFeedbackForwardingEnabledRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
Response response = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new SetIdentityFeedbackForwardingEnabledRequestMarshaller().marshall(setIdentityFeedbackForwardingEnabledRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
response = invoke(request, new SetIdentityFeedbackForwardingEnabledResultStaxUnmarshaller(), executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Verifies a domain.
*
*
* This action is throttled at one request per second.
*
*
* @param verifyDomainIdentityRequest Container for the necessary
* parameters to execute the VerifyDomainIdentity service method on
* AmazonSimpleEmailService.
*
* @return The response from the VerifyDomainIdentity service method, as
* returned by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public VerifyDomainIdentityResult verifyDomainIdentity(VerifyDomainIdentityRequest verifyDomainIdentityRequest) {
ExecutionContext executionContext = createExecutionContext(verifyDomainIdentityRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
Response response = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new VerifyDomainIdentityRequestMarshaller().marshall(verifyDomainIdentityRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
response = invoke(request, new VerifyDomainIdentityResultStaxUnmarshaller(), executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Composes an email message based on input data, and then immediately
* queues the message for sending.
*
*
* IMPORTANT: You can only send email from verified email
* addresses and domains. If you have not requested production access to
* Amazon SES, you must also verify every recipient email address except
* for the recipients provided by the Amazon SES mailbox simulator. For
* more information, go to the Amazon SES Developer Guide.
*
*
* The total size of the message cannot exceed 10 MB.
*
*
* Amazon SES has a limit on the total number of recipients per message:
* The combined number of To:, CC: and BCC: email addresses cannot exceed
* 50. If you need to send an email message to a larger audience, you can
* divide your recipient list into groups of 50 or fewer, and then call
* Amazon SES repeatedly to send the message to each group.
*
*
* For every message that you send, the total number of recipients (To:,
* CC: and BCC:) is counted against your sending quota - the
* maximum number of emails you can send in a 24-hour period. For
* information about your sending quota, go to the
* Amazon SES Developer Guide
* .
*
*
* @param sendEmailRequest Container for the necessary parameters to
* execute the SendEmail service method on AmazonSimpleEmailService.
*
* @return The response from the SendEmail service method, as returned by
* AmazonSimpleEmailService.
*
* @throws MessageRejectedException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public SendEmailResult sendEmail(SendEmailRequest sendEmailRequest) {
ExecutionContext executionContext = createExecutionContext(sendEmailRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
Response response = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new SendEmailRequestMarshaller().marshall(sendEmailRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
response = invoke(request, new SendEmailResultStaxUnmarshaller(), executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes the specified email address from the list of verified
* addresses.
*
*
* IMPORTANT:The DeleteVerifiedEmailAddress action is deprecated
* as of the May 15, 2012 release of Domain Verification. The
* DeleteIdentity action is now preferred.
*
*
* This action is throttled at one request per second.
*
*
* @param deleteVerifiedEmailAddressRequest Container for the necessary
* parameters to execute the DeleteVerifiedEmailAddress service method on
* AmazonSimpleEmailService.
*
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public void deleteVerifiedEmailAddress(DeleteVerifiedEmailAddressRequest deleteVerifiedEmailAddressRequest) {
ExecutionContext executionContext = createExecutionContext(deleteVerifiedEmailAddressRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new DeleteVerifiedEmailAddressRequestMarshaller().marshall(deleteVerifiedEmailAddressRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
invoke(request, null, executionContext);
} finally {
endClientExecution(awsRequestMetrics, request, null);
}
}
/**
*
* Given an identity (email address or domain), sets the Amazon SNS topic
* to which Amazon SES will publish bounce and complaint notifications
* for emails sent with that identity as the Source
.
* Publishing to topics may only be disabled when feedback
* forwarding is enabled.
*
*
* This action is throttled at one request per second.
*
*
* For more information about feedback notification, see the
* Amazon SES Developer Guide
* .
*
*
* @param setIdentityNotificationTopicRequest Container for the necessary
* parameters to execute the SetIdentityNotificationTopic service method
* on AmazonSimpleEmailService.
*
* @return The response from the SetIdentityNotificationTopic service
* method, as returned by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public SetIdentityNotificationTopicResult setIdentityNotificationTopic(SetIdentityNotificationTopicRequest setIdentityNotificationTopicRequest) {
ExecutionContext executionContext = createExecutionContext(setIdentityNotificationTopicRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request request = null;
Response response = null;
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
try {
request = new SetIdentityNotificationTopicRequestMarshaller().marshall(setIdentityNotificationTopicRequest);
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
response = invoke(request, new SetIdentityNotificationTopicResultStaxUnmarshaller(), executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns a list containing all of the email addresses that have been
* verified.
*
*
* IMPORTANT:The ListVerifiedEmailAddresses action is deprecated
* as of the May 15, 2012 release of Domain Verification. The
* ListIdentities action is now preferred.
*
*
* This action is throttled at one request per second.
*
*
* @return The response from the ListVerifiedEmailAddresses service
* method, as returned by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public ListVerifiedEmailAddressesResult listVerifiedEmailAddresses() throws AmazonServiceException, AmazonClientException {
return listVerifiedEmailAddresses(new ListVerifiedEmailAddressesRequest());
}
/**
*
* Returns the user's sending statistics. The result is a list of data
* points, representing the last two weeks of sending activity.
*
*
* Each data point in the list contains statistics for a 15-minute
* interval.
*
*
* This action is throttled at one request per second.
*
*
* @return The response from the GetSendStatistics service method, as
* returned by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public GetSendStatisticsResult getSendStatistics() throws AmazonServiceException, AmazonClientException {
return getSendStatistics(new GetSendStatisticsRequest());
}
/**
*
* Returns a list containing all of the identities (email addresses and
* domains) for a specific AWS Account, regardless of verification
* status.
*
*
* This action is throttled at one request per second.
*
*
* @return The response from the ListIdentities service method, as
* returned by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public ListIdentitiesResult listIdentities() throws AmazonServiceException, AmazonClientException {
return listIdentities(new ListIdentitiesRequest());
}
/**
*
* Returns the user's current sending limits.
*
*
* This action is throttled at one request per second.
*
*
* @return The response from the GetSendQuota service method, as returned
* by AmazonSimpleEmailService.
*
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonSimpleEmailService indicating
* either a problem with the data in the request, or a server side issue.
*/
public GetSendQuotaResult getSendQuota() throws AmazonServiceException, AmazonClientException {
return getSendQuota(new GetSendQuotaRequest());
}
/**
* 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);
}
private Response invoke(Request request,
Unmarshaller unmarshaller,
ExecutionContext executionContext)
{
request.setEndpoint(endpoint);
request.setTimeOffset(timeOffset);
AmazonWebServiceRequest originalRequest = request.getOriginalRequest();
for (Entry entry : originalRequest.copyPrivateRequestParameters().entrySet()) {
request.addParameter(entry.getKey(), entry.getValue());
}
AWSCredentials credentials = awsCredentialsProvider.getCredentials();
if (originalRequest.getRequestCredentials() != null) {
credentials = originalRequest.getRequestCredentials();
}
executionContext.setCredentials(credentials);
StaxResponseHandler responseHandler = new StaxResponseHandler(unmarshaller);
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallers);
return client.execute(request, responseHandler, errorResponseHandler, executionContext);
}
}