service.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package ses
  3. import (
  4. "github.com/aws/aws-sdk-go/aws"
  5. "github.com/aws/aws-sdk-go/aws/client"
  6. "github.com/aws/aws-sdk-go/aws/client/metadata"
  7. "github.com/aws/aws-sdk-go/aws/request"
  8. "github.com/aws/aws-sdk-go/aws/signer/v4"
  9. "github.com/aws/aws-sdk-go/private/protocol/query"
  10. )
  11. // This is the API Reference for Amazon Simple Email Service (Amazon SES). This
  12. // documentation is intended to be used in conjunction with the Amazon SES Developer
  13. // Guide (http://docs.aws.amazon.com/ses/latest/DeveloperGuide/Welcome.html).
  14. //
  15. // For a list of Amazon SES endpoints to use in service requests, see Regions
  16. // and Amazon SES (http://docs.aws.amazon.com/ses/latest/DeveloperGuide/regions.html)
  17. // in the Amazon SES Developer Guide.
  18. //The service client's operations are safe to be used concurrently.
  19. // It is not safe to mutate any of the client's properties though.
  20. type SES struct {
  21. *client.Client
  22. }
  23. // Used for custom client initialization logic
  24. var initClient func(*client.Client)
  25. // Used for custom request initialization logic
  26. var initRequest func(*request.Request)
  27. // A ServiceName is the name of the service the client will make API calls to.
  28. const ServiceName = "email"
  29. // New creates a new instance of the SES client with a session.
  30. // If additional configuration is needed for the client instance use the optional
  31. // aws.Config parameter to add your extra config.
  32. //
  33. // Example:
  34. // // Create a SES client from just a session.
  35. // svc := ses.New(mySession)
  36. //
  37. // // Create a SES client with additional configuration
  38. // svc := ses.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  39. func New(p client.ConfigProvider, cfgs ...*aws.Config) *SES {
  40. c := p.ClientConfig(ServiceName, cfgs...)
  41. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  42. }
  43. // newClient creates, initializes and returns a new service client instance.
  44. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *SES {
  45. svc := &SES{
  46. Client: client.New(
  47. cfg,
  48. metadata.ClientInfo{
  49. ServiceName: ServiceName,
  50. SigningName: "ses",
  51. SigningRegion: signingRegion,
  52. Endpoint: endpoint,
  53. APIVersion: "2010-12-01",
  54. },
  55. handlers,
  56. ),
  57. }
  58. // Handlers
  59. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  60. svc.Handlers.Build.PushBackNamed(query.BuildHandler)
  61. svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
  62. svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
  63. svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
  64. // Run custom client initialization if present
  65. if initClient != nil {
  66. initClient(svc.Client)
  67. }
  68. return svc
  69. }
  70. // newRequest creates a new request for a SES operation and runs any
  71. // custom request initialization.
  72. func (c *SES) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  73. req := c.NewRequest(op, params, data)
  74. // Run custom request initialization if present
  75. if initRequest != nil {
  76. initRequest(req)
  77. }
  78. return req
  79. }