service.go 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package emr
  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/jsonrpc"
  10. )
  11. // Amazon Elastic MapReduce (Amazon EMR) is a web service that makes it easy
  12. // to process large amounts of data efficiently. Amazon EMR uses Hadoop processing
  13. // combined with several AWS products to do tasks such as web indexing, data
  14. // mining, log file analysis, machine learning, scientific simulation, and data
  15. // warehousing.
  16. //The service client's operations are safe to be used concurrently.
  17. // It is not safe to mutate any of the client's properties though.
  18. type EMR struct {
  19. *client.Client
  20. }
  21. // Used for custom client initialization logic
  22. var initClient func(*client.Client)
  23. // Used for custom request initialization logic
  24. var initRequest func(*request.Request)
  25. // A ServiceName is the name of the service the client will make API calls to.
  26. const ServiceName = "elasticmapreduce"
  27. // New creates a new instance of the EMR client with a session.
  28. // If additional configuration is needed for the client instance use the optional
  29. // aws.Config parameter to add your extra config.
  30. //
  31. // Example:
  32. // // Create a EMR client from just a session.
  33. // svc := emr.New(mySession)
  34. //
  35. // // Create a EMR client with additional configuration
  36. // svc := emr.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  37. func New(p client.ConfigProvider, cfgs ...*aws.Config) *EMR {
  38. c := p.ClientConfig(ServiceName, cfgs...)
  39. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  40. }
  41. // newClient creates, initializes and returns a new service client instance.
  42. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *EMR {
  43. svc := &EMR{
  44. Client: client.New(
  45. cfg,
  46. metadata.ClientInfo{
  47. ServiceName: ServiceName,
  48. SigningRegion: signingRegion,
  49. Endpoint: endpoint,
  50. APIVersion: "2009-03-31",
  51. JSONVersion: "1.1",
  52. TargetPrefix: "ElasticMapReduce",
  53. },
  54. handlers,
  55. ),
  56. }
  57. // Handlers
  58. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  59. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  60. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  61. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  62. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  63. // Run custom client initialization if present
  64. if initClient != nil {
  65. initClient(svc.Client)
  66. }
  67. return svc
  68. }
  69. // newRequest creates a new request for a EMR operation and runs any
  70. // custom request initialization.
  71. func (c *EMR) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  72. req := c.NewRequest(op, params, data)
  73. // Run custom request initialization if present
  74. if initRequest != nil {
  75. initRequest(req)
  76. }
  77. return req
  78. }