examples_test.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package ses_test
  3. import (
  4. "bytes"
  5. "fmt"
  6. "time"
  7. "github.com/aws/aws-sdk-go/aws"
  8. "github.com/aws/aws-sdk-go/service/ses"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleSES_DeleteIdentity() {
  13. svc := ses.New(nil)
  14. params := &ses.DeleteIdentityInput{
  15. Identity: aws.String("Identity"), // Required
  16. }
  17. resp, err := svc.DeleteIdentity(params)
  18. if err != nil {
  19. // Print the error, cast err to awserr.Error to get the Code and
  20. // Message from an error.
  21. fmt.Println(err.Error())
  22. return
  23. }
  24. // Pretty-print the response data.
  25. fmt.Println(resp)
  26. }
  27. func ExampleSES_DeleteIdentityPolicy() {
  28. svc := ses.New(nil)
  29. params := &ses.DeleteIdentityPolicyInput{
  30. Identity: aws.String("Identity"), // Required
  31. PolicyName: aws.String("PolicyName"), // Required
  32. }
  33. resp, err := svc.DeleteIdentityPolicy(params)
  34. if err != nil {
  35. // Print the error, cast err to awserr.Error to get the Code and
  36. // Message from an error.
  37. fmt.Println(err.Error())
  38. return
  39. }
  40. // Pretty-print the response data.
  41. fmt.Println(resp)
  42. }
  43. func ExampleSES_DeleteVerifiedEmailAddress() {
  44. svc := ses.New(nil)
  45. params := &ses.DeleteVerifiedEmailAddressInput{
  46. EmailAddress: aws.String("Address"), // Required
  47. }
  48. resp, err := svc.DeleteVerifiedEmailAddress(params)
  49. if err != nil {
  50. // Print the error, cast err to awserr.Error to get the Code and
  51. // Message from an error.
  52. fmt.Println(err.Error())
  53. return
  54. }
  55. // Pretty-print the response data.
  56. fmt.Println(resp)
  57. }
  58. func ExampleSES_GetIdentityDkimAttributes() {
  59. svc := ses.New(nil)
  60. params := &ses.GetIdentityDkimAttributesInput{
  61. Identities: []*string{ // Required
  62. aws.String("Identity"), // Required
  63. // More values...
  64. },
  65. }
  66. resp, err := svc.GetIdentityDkimAttributes(params)
  67. if err != nil {
  68. // Print the error, cast err to awserr.Error to get the Code and
  69. // Message from an error.
  70. fmt.Println(err.Error())
  71. return
  72. }
  73. // Pretty-print the response data.
  74. fmt.Println(resp)
  75. }
  76. func ExampleSES_GetIdentityNotificationAttributes() {
  77. svc := ses.New(nil)
  78. params := &ses.GetIdentityNotificationAttributesInput{
  79. Identities: []*string{ // Required
  80. aws.String("Identity"), // Required
  81. // More values...
  82. },
  83. }
  84. resp, err := svc.GetIdentityNotificationAttributes(params)
  85. if err != nil {
  86. // Print the error, cast err to awserr.Error to get the Code and
  87. // Message from an error.
  88. fmt.Println(err.Error())
  89. return
  90. }
  91. // Pretty-print the response data.
  92. fmt.Println(resp)
  93. }
  94. func ExampleSES_GetIdentityPolicies() {
  95. svc := ses.New(nil)
  96. params := &ses.GetIdentityPoliciesInput{
  97. Identity: aws.String("Identity"), // Required
  98. PolicyNames: []*string{ // Required
  99. aws.String("PolicyName"), // Required
  100. // More values...
  101. },
  102. }
  103. resp, err := svc.GetIdentityPolicies(params)
  104. if err != nil {
  105. // Print the error, cast err to awserr.Error to get the Code and
  106. // Message from an error.
  107. fmt.Println(err.Error())
  108. return
  109. }
  110. // Pretty-print the response data.
  111. fmt.Println(resp)
  112. }
  113. func ExampleSES_GetIdentityVerificationAttributes() {
  114. svc := ses.New(nil)
  115. params := &ses.GetIdentityVerificationAttributesInput{
  116. Identities: []*string{ // Required
  117. aws.String("Identity"), // Required
  118. // More values...
  119. },
  120. }
  121. resp, err := svc.GetIdentityVerificationAttributes(params)
  122. if err != nil {
  123. // Print the error, cast err to awserr.Error to get the Code and
  124. // Message from an error.
  125. fmt.Println(err.Error())
  126. return
  127. }
  128. // Pretty-print the response data.
  129. fmt.Println(resp)
  130. }
  131. func ExampleSES_GetSendQuota() {
  132. svc := ses.New(nil)
  133. var params *ses.GetSendQuotaInput
  134. resp, err := svc.GetSendQuota(params)
  135. if err != nil {
  136. // Print the error, cast err to awserr.Error to get the Code and
  137. // Message from an error.
  138. fmt.Println(err.Error())
  139. return
  140. }
  141. // Pretty-print the response data.
  142. fmt.Println(resp)
  143. }
  144. func ExampleSES_GetSendStatistics() {
  145. svc := ses.New(nil)
  146. var params *ses.GetSendStatisticsInput
  147. resp, err := svc.GetSendStatistics(params)
  148. if err != nil {
  149. // Print the error, cast err to awserr.Error to get the Code and
  150. // Message from an error.
  151. fmt.Println(err.Error())
  152. return
  153. }
  154. // Pretty-print the response data.
  155. fmt.Println(resp)
  156. }
  157. func ExampleSES_ListIdentities() {
  158. svc := ses.New(nil)
  159. params := &ses.ListIdentitiesInput{
  160. IdentityType: aws.String("IdentityType"),
  161. MaxItems: aws.Int64(1),
  162. NextToken: aws.String("NextToken"),
  163. }
  164. resp, err := svc.ListIdentities(params)
  165. if err != nil {
  166. // Print the error, cast err to awserr.Error to get the Code and
  167. // Message from an error.
  168. fmt.Println(err.Error())
  169. return
  170. }
  171. // Pretty-print the response data.
  172. fmt.Println(resp)
  173. }
  174. func ExampleSES_ListIdentityPolicies() {
  175. svc := ses.New(nil)
  176. params := &ses.ListIdentityPoliciesInput{
  177. Identity: aws.String("Identity"), // Required
  178. }
  179. resp, err := svc.ListIdentityPolicies(params)
  180. if err != nil {
  181. // Print the error, cast err to awserr.Error to get the Code and
  182. // Message from an error.
  183. fmt.Println(err.Error())
  184. return
  185. }
  186. // Pretty-print the response data.
  187. fmt.Println(resp)
  188. }
  189. func ExampleSES_ListVerifiedEmailAddresses() {
  190. svc := ses.New(nil)
  191. var params *ses.ListVerifiedEmailAddressesInput
  192. resp, err := svc.ListVerifiedEmailAddresses(params)
  193. if err != nil {
  194. // Print the error, cast err to awserr.Error to get the Code and
  195. // Message from an error.
  196. fmt.Println(err.Error())
  197. return
  198. }
  199. // Pretty-print the response data.
  200. fmt.Println(resp)
  201. }
  202. func ExampleSES_PutIdentityPolicy() {
  203. svc := ses.New(nil)
  204. params := &ses.PutIdentityPolicyInput{
  205. Identity: aws.String("Identity"), // Required
  206. Policy: aws.String("Policy"), // Required
  207. PolicyName: aws.String("PolicyName"), // Required
  208. }
  209. resp, err := svc.PutIdentityPolicy(params)
  210. if err != nil {
  211. // Print the error, cast err to awserr.Error to get the Code and
  212. // Message from an error.
  213. fmt.Println(err.Error())
  214. return
  215. }
  216. // Pretty-print the response data.
  217. fmt.Println(resp)
  218. }
  219. func ExampleSES_SendEmail() {
  220. svc := ses.New(nil)
  221. params := &ses.SendEmailInput{
  222. Destination: &ses.Destination{ // Required
  223. BccAddresses: []*string{
  224. aws.String("Address"), // Required
  225. // More values...
  226. },
  227. CcAddresses: []*string{
  228. aws.String("Address"), // Required
  229. // More values...
  230. },
  231. ToAddresses: []*string{
  232. aws.String("Address"), // Required
  233. // More values...
  234. },
  235. },
  236. Message: &ses.Message{ // Required
  237. Body: &ses.Body{ // Required
  238. Html: &ses.Content{
  239. Data: aws.String("MessageData"), // Required
  240. Charset: aws.String("Charset"),
  241. },
  242. Text: &ses.Content{
  243. Data: aws.String("MessageData"), // Required
  244. Charset: aws.String("Charset"),
  245. },
  246. },
  247. Subject: &ses.Content{ // Required
  248. Data: aws.String("MessageData"), // Required
  249. Charset: aws.String("Charset"),
  250. },
  251. },
  252. Source: aws.String("Address"), // Required
  253. ReplyToAddresses: []*string{
  254. aws.String("Address"), // Required
  255. // More values...
  256. },
  257. ReturnPath: aws.String("Address"),
  258. ReturnPathArn: aws.String("AmazonResourceName"),
  259. SourceArn: aws.String("AmazonResourceName"),
  260. }
  261. resp, err := svc.SendEmail(params)
  262. if err != nil {
  263. // Print the error, cast err to awserr.Error to get the Code and
  264. // Message from an error.
  265. fmt.Println(err.Error())
  266. return
  267. }
  268. // Pretty-print the response data.
  269. fmt.Println(resp)
  270. }
  271. func ExampleSES_SendRawEmail() {
  272. svc := ses.New(nil)
  273. params := &ses.SendRawEmailInput{
  274. RawMessage: &ses.RawMessage{ // Required
  275. Data: []byte("PAYLOAD"), // Required
  276. },
  277. Destinations: []*string{
  278. aws.String("Address"), // Required
  279. // More values...
  280. },
  281. FromArn: aws.String("AmazonResourceName"),
  282. ReturnPathArn: aws.String("AmazonResourceName"),
  283. Source: aws.String("Address"),
  284. SourceArn: aws.String("AmazonResourceName"),
  285. }
  286. resp, err := svc.SendRawEmail(params)
  287. if err != nil {
  288. // Print the error, cast err to awserr.Error to get the Code and
  289. // Message from an error.
  290. fmt.Println(err.Error())
  291. return
  292. }
  293. // Pretty-print the response data.
  294. fmt.Println(resp)
  295. }
  296. func ExampleSES_SetIdentityDkimEnabled() {
  297. svc := ses.New(nil)
  298. params := &ses.SetIdentityDkimEnabledInput{
  299. DkimEnabled: aws.Bool(true), // Required
  300. Identity: aws.String("Identity"), // Required
  301. }
  302. resp, err := svc.SetIdentityDkimEnabled(params)
  303. if err != nil {
  304. // Print the error, cast err to awserr.Error to get the Code and
  305. // Message from an error.
  306. fmt.Println(err.Error())
  307. return
  308. }
  309. // Pretty-print the response data.
  310. fmt.Println(resp)
  311. }
  312. func ExampleSES_SetIdentityFeedbackForwardingEnabled() {
  313. svc := ses.New(nil)
  314. params := &ses.SetIdentityFeedbackForwardingEnabledInput{
  315. ForwardingEnabled: aws.Bool(true), // Required
  316. Identity: aws.String("Identity"), // Required
  317. }
  318. resp, err := svc.SetIdentityFeedbackForwardingEnabled(params)
  319. if err != nil {
  320. // Print the error, cast err to awserr.Error to get the Code and
  321. // Message from an error.
  322. fmt.Println(err.Error())
  323. return
  324. }
  325. // Pretty-print the response data.
  326. fmt.Println(resp)
  327. }
  328. func ExampleSES_SetIdentityNotificationTopic() {
  329. svc := ses.New(nil)
  330. params := &ses.SetIdentityNotificationTopicInput{
  331. Identity: aws.String("Identity"), // Required
  332. NotificationType: aws.String("NotificationType"), // Required
  333. SnsTopic: aws.String("NotificationTopic"),
  334. }
  335. resp, err := svc.SetIdentityNotificationTopic(params)
  336. if err != nil {
  337. // Print the error, cast err to awserr.Error to get the Code and
  338. // Message from an error.
  339. fmt.Println(err.Error())
  340. return
  341. }
  342. // Pretty-print the response data.
  343. fmt.Println(resp)
  344. }
  345. func ExampleSES_VerifyDomainDkim() {
  346. svc := ses.New(nil)
  347. params := &ses.VerifyDomainDkimInput{
  348. Domain: aws.String("Domain"), // Required
  349. }
  350. resp, err := svc.VerifyDomainDkim(params)
  351. if err != nil {
  352. // Print the error, cast err to awserr.Error to get the Code and
  353. // Message from an error.
  354. fmt.Println(err.Error())
  355. return
  356. }
  357. // Pretty-print the response data.
  358. fmt.Println(resp)
  359. }
  360. func ExampleSES_VerifyDomainIdentity() {
  361. svc := ses.New(nil)
  362. params := &ses.VerifyDomainIdentityInput{
  363. Domain: aws.String("Domain"), // Required
  364. }
  365. resp, err := svc.VerifyDomainIdentity(params)
  366. if err != nil {
  367. // Print the error, cast err to awserr.Error to get the Code and
  368. // Message from an error.
  369. fmt.Println(err.Error())
  370. return
  371. }
  372. // Pretty-print the response data.
  373. fmt.Println(resp)
  374. }
  375. func ExampleSES_VerifyEmailAddress() {
  376. svc := ses.New(nil)
  377. params := &ses.VerifyEmailAddressInput{
  378. EmailAddress: aws.String("Address"), // Required
  379. }
  380. resp, err := svc.VerifyEmailAddress(params)
  381. if err != nil {
  382. // Print the error, cast err to awserr.Error to get the Code and
  383. // Message from an error.
  384. fmt.Println(err.Error())
  385. return
  386. }
  387. // Pretty-print the response data.
  388. fmt.Println(resp)
  389. }
  390. func ExampleSES_VerifyEmailIdentity() {
  391. svc := ses.New(nil)
  392. params := &ses.VerifyEmailIdentityInput{
  393. EmailAddress: aws.String("Address"), // Required
  394. }
  395. resp, err := svc.VerifyEmailIdentity(params)
  396. if err != nil {
  397. // Print the error, cast err to awserr.Error to get the Code and
  398. // Message from an error.
  399. fmt.Println(err.Error())
  400. return
  401. }
  402. // Pretty-print the response data.
  403. fmt.Println(resp)
  404. }