service.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package mobileanalytics
  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/restjson"
  10. )
  11. // Amazon Mobile Analytics is a service for collecting, visualizing, and understanding
  12. // app usage data at scale.
  13. //The service client's operations are safe to be used concurrently.
  14. // It is not safe to mutate any of the client's properties though.
  15. type MobileAnalytics struct {
  16. *client.Client
  17. }
  18. // Used for custom client initialization logic
  19. var initClient func(*client.Client)
  20. // Used for custom request initialization logic
  21. var initRequest func(*request.Request)
  22. // A ServiceName is the name of the service the client will make API calls to.
  23. const ServiceName = "mobileanalytics"
  24. // New creates a new instance of the MobileAnalytics client with a session.
  25. // If additional configuration is needed for the client instance use the optional
  26. // aws.Config parameter to add your extra config.
  27. //
  28. // Example:
  29. // // Create a MobileAnalytics client from just a session.
  30. // svc := mobileanalytics.New(mySession)
  31. //
  32. // // Create a MobileAnalytics client with additional configuration
  33. // svc := mobileanalytics.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  34. func New(p client.ConfigProvider, cfgs ...*aws.Config) *MobileAnalytics {
  35. c := p.ClientConfig(ServiceName, cfgs...)
  36. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  37. }
  38. // newClient creates, initializes and returns a new service client instance.
  39. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *MobileAnalytics {
  40. svc := &MobileAnalytics{
  41. Client: client.New(
  42. cfg,
  43. metadata.ClientInfo{
  44. ServiceName: ServiceName,
  45. SigningRegion: signingRegion,
  46. Endpoint: endpoint,
  47. APIVersion: "2014-06-05",
  48. },
  49. handlers,
  50. ),
  51. }
  52. // Handlers
  53. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  54. svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
  55. svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
  56. svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
  57. svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler)
  58. // Run custom client initialization if present
  59. if initClient != nil {
  60. initClient(svc.Client)
  61. }
  62. return svc
  63. }
  64. // newRequest creates a new request for a MobileAnalytics operation and runs any
  65. // custom request initialization.
  66. func (c *MobileAnalytics) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  67. req := c.NewRequest(op, params, data)
  68. // Run custom request initialization if present
  69. if initRequest != nil {
  70. initRequest(req)
  71. }
  72. return req
  73. }