forked from aws/aws-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAmazonSimpleEmailServiceClient.java
More file actions
991 lines (937 loc) · 46.2 KB
/
AmazonSimpleEmailServiceClient.java
File metadata and controls
991 lines (937 loc) · 46.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
/*
* Copyright 2010-2013 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.Node;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map.Entry;
import com.amazonaws.*;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.HandlerChainFactory;
import com.amazonaws.handlers.RequestHandler;
import com.amazonaws.http.StaxResponseHandler;
import com.amazonaws.http.DefaultErrorResponseHandler;
import com.amazonaws.http.ExecutionContext;
import com.amazonaws.internal.StaticCredentialsProvider;
import com.amazonaws.transform.Unmarshaller;
import com.amazonaws.transform.StaxUnmarshallerContext;
import com.amazonaws.transform.StandardErrorUnmarshaller;
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.
* <p>
* Amazon Simple Email Service <p>
* 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
* Getting Started Guide and the Amazon SES Developer Guide.
* </p>
* <p>
* For specific details on how to construct a service request, please consult the <a href="http://docs.amazonwebservices.com/ses/latest/DeveloperGuide">
* Amazon SES Developer Guide </a> .
* </p>
* <p>
* <b>NOTE:</b>The endpoint for Amazon SES is located at: https://email.us-east-1.amazonaws.com
* </p>
*/
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<Unmarshaller<AmazonServiceException, Node>> exceptionUnmarshallers
= new ArrayList<Unmarshaller<AmazonServiceException, Node>>();
/** AWS signer for authenticating requests. */
private AWS3Signer signer;
/**
* Constructs a new client to invoke service methods on
* AmazonSimpleEmailService. A credentials provider chain will be used
* that searches for credentials in this order:
* <ul>
* <li> Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY </li>
* <li> Java System Properties - aws.accessKeyId and aws.secretKey </li>
* <li> Instance profile credentials delivered through the Amazon EC2 metadata service </li>
* </ul>
*
* <p>
* All service calls made using this new client object are blocking, and will not
* return until the service call completes.
*
* @see DefaultAWSCredentialsProvider
*/
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:
* <ul>
* <li> Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY </li>
* <li> Java System Properties - aws.accessKeyId and aws.secretKey </li>
* <li> Instance profile credentials delivered through the Amazon EC2 metadata service </li>
* </ul>
*
* <p>
* 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 DefaultAWSCredentialsProvider
*/
public AmazonSimpleEmailServiceClient(ClientConfiguration clientConfiguration) {
this(new DefaultAWSCredentialsProviderChain(), clientConfiguration);
}
/**
* Constructs a new client to invoke service methods on
* AmazonSimpleEmailService using the specified AWS account credentials.
*
* <p>
* 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.
*
* <p>
* 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.
*
* <p>
* 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.
*
* <p>
* 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) {
super(clientConfiguration);
this.awsCredentialsProvider = awsCredentialsProvider;
init();
}
private void init() {
exceptionUnmarshallers.add(new MessageRejectedExceptionUnmarshaller());
exceptionUnmarshallers.add(new StandardErrorUnmarshaller());
setEndpoint("email.us-east-1.amazonaws.com");
signer = new AWS3Signer();
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandlers.addAll(chainFactory.newRequestHandlerChain(
"/com/amazonaws/services/simpleemail/request.handlers"));
}
/**
* <p>
* Deletes the specified identity (email address or domain) from the list
* of verified identities.
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<DeleteIdentityRequest> request = new DeleteIdentityRequestMarshaller().marshall(deleteIdentityRequest);
return invoke(request, new DeleteIdentityResultStaxUnmarshaller());
}
/**
* <p>
* Returns a list containing all of the email addresses that have been
* verified.
* </p>
* <p>
* <b>IMPORTANT:</b>The ListVerifiedEmailAddresses action is deprecated
* as of the May 15, 2012 release of Domain Verification. The
* ListIdentities action is now preferred.
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<ListVerifiedEmailAddressesRequest> request = new ListVerifiedEmailAddressesRequestMarshaller().marshall(listVerifiedEmailAddressesRequest);
return invoke(request, new ListVerifiedEmailAddressesResultStaxUnmarshaller());
}
/**
* <p>
* Returns the user's sending statistics. The result is a list of data
* points, representing the last two weeks of sending activity.
* </p>
* <p>
* Each data point in the list contains statistics for a 15-minute
* interval.
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<GetSendStatisticsRequest> request = new GetSendStatisticsRequestMarshaller().marshall(getSendStatisticsRequest);
return invoke(request, new GetSendStatisticsResultStaxUnmarshaller());
}
/**
* <p>
* Verifies an email address. This action causes a confirmation email
* message to be sent to the specified address.
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<VerifyEmailIdentityRequest> request = new VerifyEmailIdentityRequestMarshaller().marshall(verifyEmailIdentityRequest);
return invoke(request, new VerifyEmailIdentityResultStaxUnmarshaller());
}
/**
* <p>
* Given a list of verified identities (email addresses and/or domains),
* returns a structure describing identity notification attributes. For
* more information about feedback notification, see the <a
* href="http://docs.amazonwebservices.com/ses/latest/DeveloperGuide">
* Amazon SES Developer Guide </a> .
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<GetIdentityNotificationAttributesRequest> request = new GetIdentityNotificationAttributesRequestMarshaller().marshall(getIdentityNotificationAttributesRequest);
return invoke(request, new GetIdentityNotificationAttributesResultStaxUnmarshaller());
}
/**
* <p>
* Returns a set of DNS records, or <i>tokens</i> , that must be
* published in the domain name's DNS to complete the DKIM verification
* process. These tokens are DNS <code>CNAME</code> records that point to
* DKIM public keys hosted by Amazon SES. To complete the DKIM
* verification process, these tokens must be published in the domain's
* DNS. The tokens must remain published in order for Easy DKIM signing
* to function correctly.
* </p>
* <p>
* After the tokens are added to the domain's DNS, Amazon SES will be
* able to DKIM-sign email originating from that domain. To enable or
* disable Easy DKIM signing for a domain, use the
* <code>SetIdentityDkimEnabled</code> action.
* </p>
* <p>
* For more information about Easy DKIM, go to the <a
* href="http://docs.amazonwebservices.com/ses/latest/DeveloperGuide">
* Amazon SES Developer Guide </a> .
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<VerifyDomainDkimRequest> request = new VerifyDomainDkimRequestMarshaller().marshall(verifyDomainDkimRequest);
return invoke(request, new VerifyDomainDkimResultStaxUnmarshaller());
}
/**
* <p>
* Returns the DNS records, or <i>tokens</i> , that must be present in
* order for Easy DKIM to sign outgoing email messages.
* </p>
* <p>
* This action takes a list of verified identities as input. It then
* returns the following information for each identity:
* </p>
*
* <ul>
* <li>Whether Easy DKIM signing is enabled or disabled.</li>
* <li>The set of tokens that are required for Easy DKIM signing. These
* tokens must be published in the domain name's DNS records in order for
* DKIM verification to complete, and must remain published in order for
* Easy DKIM signing to operate correctly. (This information is only
* returned for domain name identities, not for email addresses.)</li>
* <li>Whether Amazon SES has successfully verified the DKIM tokens
* published in the domain name's DNS. (This information is only returned
* for domain name identities, not for email addresses.)</li>
*
* </ul>
* <p>
* For more information about Easy DKIM signing, go to the <a
* href="http://docs.amazonwebservices.com/ses/latest/DeveloperGuide">
* Amazon SES Developer Guide </a> .
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<GetIdentityDkimAttributesRequest> request = new GetIdentityDkimAttributesRequestMarshaller().marshall(getIdentityDkimAttributesRequest);
return invoke(request, new GetIdentityDkimAttributesResultStaxUnmarshaller());
}
/**
* <p>
* Verifies an email address. This action causes a confirmation email
* message to be sent to the specified address.
* </p>
* <p>
* <b>IMPORTANT:</b>The VerifyEmailAddress action is deprecated as of the
* May 15, 2012 release of Domain Verification. The VerifyEmailIdentity
* action is now preferred.
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<VerifyEmailAddressRequest> request = new VerifyEmailAddressRequestMarshaller().marshall(verifyEmailAddressRequest);
invoke(request, null);
}
/**
* <p>
* Sends an email message, with header and content specified by the
* client. The <code>SendRawEmail</code> 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.
* </p>
* <p>
* <b>IMPORTANT:</b>If you have not yet requested production access to
* Amazon SES, then you will only be able to send email to and from
* verified email addresses and domains. For more information, go to the
* Amazon SES Developer Guide.
* </p>
* <p>
* The total size of the message cannot exceed 10 MB. This includes any
* attachments that are part of the message.
* </p>
* <p>
* 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.
* </p>
* <p>
* For every message that you send, the total number of recipients (To:,
* CC: and BCC:) is counted against your <i>sending quota</i> - the
* maximum number of emails you can send in a 24-hour period. For
* information about your sending quota, go to the "Managing Your Sending
* Activity" section of the<a
* href="http://docs.amazonwebservices.com/ses/latest/DeveloperGuide">
* Amazon SES Developer Guide </a> .
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<SendRawEmailRequest> request = new SendRawEmailRequestMarshaller().marshall(sendRawEmailRequest);
return invoke(request, new SendRawEmailResultStaxUnmarshaller());
}
/**
* <p>
* Returns a list containing all of the identities (email addresses and
* domains) for a specific AWS Account, regardless of verification
* status.
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<ListIdentitiesRequest> request = new ListIdentitiesRequestMarshaller().marshall(listIdentitiesRequest);
return invoke(request, new ListIdentitiesResultStaxUnmarshaller());
}
/**
* <p>
* Given a list of identities (email addresses and/or domains), returns
* the verification status and (for domain identities) the verification
* token for each identity.
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<GetIdentityVerificationAttributesRequest> request = new GetIdentityVerificationAttributesRequestMarshaller().marshall(getIdentityVerificationAttributesRequest);
return invoke(request, new GetIdentityVerificationAttributesResultStaxUnmarshaller());
}
/**
* <p>
* Enables or disables Easy DKIM signing of email sent from an identity:
* </p>
*
* <ul>
* <li>If Easy DKIM signing is enabled for a domain name identity (e.g.,
* <code>example.com</code> ), then Amazon SES will DKIM-sign all email
* sent by addresses under that domain name (e.g.,
* <code>user@example.com</code> ).</li>
* <li>If Easy DKIM signing is enabled for an email address, then Amazon
* SES will DKIM-sign all email sent by that email address.</li>
*
* </ul>
* <p>
* For email addresses (e.g., <code>user@example.com</code> ), you can
* only enable Easy DKIM signing if the corresponding domain (e.g.,
* <code>example.com</code> ) has been set up for Easy DKIM using the AWS
* Console or the <code>VerifyDomainDkim</code> action.
* </p>
* <p>
* For more information about Easy DKIM signing, go to the <a
* href="http://docs.amazonwebservices.com/ses/latest/DeveloperGuide">
* Amazon SES Developer Guide </a> .
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<SetIdentityDkimEnabledRequest> request = new SetIdentityDkimEnabledRequestMarshaller().marshall(setIdentityDkimEnabledRequest);
return invoke(request, new SetIdentityDkimEnabledResultStaxUnmarshaller());
}
/**
* <p>
* Returns the user's current sending limits.
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<GetSendQuotaRequest> request = new GetSendQuotaRequestMarshaller().marshall(getSendQuotaRequest);
return invoke(request, new GetSendQuotaResultStaxUnmarshaller());
}
/**
* <p>
* 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. For more information about feedback notification, see the <a
* href="http://docs.amazonwebservices.com/ses/latest/DeveloperGuide">
* Amazon SES Developer Guide </a> .
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<SetIdentityFeedbackForwardingEnabledRequest> request = new SetIdentityFeedbackForwardingEnabledRequestMarshaller().marshall(setIdentityFeedbackForwardingEnabledRequest);
return invoke(request, new SetIdentityFeedbackForwardingEnabledResultStaxUnmarshaller());
}
/**
* <p>
* Verifies a domain.
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<VerifyDomainIdentityRequest> request = new VerifyDomainIdentityRequestMarshaller().marshall(verifyDomainIdentityRequest);
return invoke(request, new VerifyDomainIdentityResultStaxUnmarshaller());
}
/**
* <p>
* Composes an email message based on input data, and then immediately
* queues the message for sending.
* </p>
* <p>
* <b>IMPORTANT:</b>If you have not yet requested production access to
* Amazon SES, then you will only be able to send email to and from
* verified email addresses and domains. For more information, go to the
* Amazon SES Developer Guide.
* </p>
* <p>
* The total size of the message cannot exceed 10 MB.
* </p>
* <p>
* 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.
* </p>
* <p>
* For every message that you send, the total number of recipients (To:,
* CC: and BCC:) is counted against your <i>sending quota</i> - the
* maximum number of emails you can send in a 24-hour period. For
* information about your sending quota, go to the "Managing Your Sending
* Activity" section of the<a
* href="http://docs.amazonwebservices.com/ses/latest/DeveloperGuide">
* Amazon SES Developer Guide </a> .
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<SendEmailRequest> request = new SendEmailRequestMarshaller().marshall(sendEmailRequest);
return invoke(request, new SendEmailResultStaxUnmarshaller());
}
/**
* <p>
* Deletes the specified email address from the list of verified
* addresses.
* </p>
* <p>
* <b>IMPORTANT:</b>The DeleteVerifiedEmailAddress action is deprecated
* as of the May 15, 2012 release of Domain Verification. The
* DeleteIdentity action is now preferred.
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<DeleteVerifiedEmailAddressRequest> request = new DeleteVerifiedEmailAddressRequestMarshaller().marshall(deleteVerifiedEmailAddressRequest);
invoke(request, null);
}
/**
* <p>
* 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 <code>Source</code> .
* Publishing to topics may only be disabled when feedback
* forwarding is enabled. For more information about feedback
* notification, see the <a
* href="http://docs.amazonwebservices.com/ses/latest/DeveloperGuide">
* Amazon SES Developer Guide </a> .
* </p>
*
* @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)
throws AmazonServiceException, AmazonClientException {
Request<SetIdentityNotificationTopicRequest> request = new SetIdentityNotificationTopicRequestMarshaller().marshall(setIdentityNotificationTopicRequest);
return invoke(request, new SetIdentityNotificationTopicResultStaxUnmarshaller());
}
/**
* <p>
* Returns a list containing all of the email addresses that have been
* verified.
* </p>
* <p>
* <b>IMPORTANT:</b>The ListVerifiedEmailAddresses action is deprecated
* as of the May 15, 2012 release of Domain Verification. The
* ListIdentities action is now preferred.
* </p>
*
* @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());
}
/**
* <p>
* Returns the user's sending statistics. The result is a list of data
* points, representing the last two weeks of sending activity.
* </p>
* <p>
* Each data point in the list contains statistics for a 15-minute
* interval.
* </p>
*
* @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());
}
/**
* <p>
* Returns a list containing all of the identities (email addresses and
* domains) for a specific AWS Account, regardless of verification
* status.
* </p>
*
* @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());
}
/**
* <p>
* Returns the user's current sending limits.
* </p>
*
* @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());
}
@Override
protected String getServiceAbbreviation() {
return "email";
}
/**
* 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.
* <p>
* 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 <X, Y extends AmazonWebServiceRequest> X invoke(Request<Y> request, Unmarshaller<X, StaxUnmarshallerContext> unmarshaller) {
request.setEndpoint(endpoint);
request.setTimeOffset(timeOffset);
for (Entry<String, String> entry : request.getOriginalRequest().copyPrivateRequestParameters().entrySet()) {
request.addParameter(entry.getKey(), entry.getValue());
}
AWSCredentials credentials = awsCredentialsProvider.getCredentials();
AmazonWebServiceRequest originalRequest = request.getOriginalRequest();
if (originalRequest != null && originalRequest.getRequestCredentials() != null) {
credentials = originalRequest.getRequestCredentials();
}
ExecutionContext executionContext = createExecutionContext();
executionContext.setSigner(signer);
executionContext.setCredentials(credentials);
StaxResponseHandler<X> responseHandler = new StaxResponseHandler<X>(unmarshaller);
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallers);
return (X)client.execute(request, responseHandler, errorResponseHandler, executionContext);
}
}