service.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package machinelearning
  3. import (
  4. "github.com/aws/aws-sdk-go/aws"
  5. "github.com/aws/aws-sdk-go/aws/defaults"
  6. "github.com/aws/aws-sdk-go/aws/request"
  7. "github.com/aws/aws-sdk-go/aws/service"
  8. "github.com/aws/aws-sdk-go/aws/service/serviceinfo"
  9. "github.com/aws/aws-sdk-go/internal/protocol/jsonrpc"
  10. "github.com/aws/aws-sdk-go/internal/signer/v4"
  11. )
  12. // Definition of the public APIs exposed by Amazon Machine Learning
  13. type MachineLearning struct {
  14. *service.Service
  15. }
  16. // Used for custom service initialization logic
  17. var initService func(*service.Service)
  18. // Used for custom request initialization logic
  19. var initRequest func(*request.Request)
  20. // New returns a new MachineLearning client.
  21. func New(config *aws.Config) *MachineLearning {
  22. service := &service.Service{
  23. ServiceInfo: serviceinfo.ServiceInfo{
  24. Config: defaults.DefaultConfig.Merge(config),
  25. ServiceName: "machinelearning",
  26. APIVersion: "2014-12-12",
  27. JSONVersion: "1.1",
  28. TargetPrefix: "AmazonML_20141212",
  29. },
  30. }
  31. service.Initialize()
  32. // Handlers
  33. service.Handlers.Sign.PushBack(v4.Sign)
  34. service.Handlers.Build.PushBack(jsonrpc.Build)
  35. service.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal)
  36. service.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta)
  37. service.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError)
  38. // Run custom service initialization if present
  39. if initService != nil {
  40. initService(service)
  41. }
  42. return &MachineLearning{service}
  43. }
  44. // newRequest creates a new request for a MachineLearning operation and runs any
  45. // custom request initialization.
  46. func (c *MachineLearning) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  47. req := c.NewRequest(op, params, data)
  48. // Run custom request initialization if present
  49. if initRequest != nil {
  50. initRequest(req)
  51. }
  52. return req
  53. }