service.go 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package marketplacemetering
  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. // This reference provides descriptions of the low-level AWS Marketplace Metering
  12. // Service API.
  13. //
  14. // AWS Marketplace sellers can use this API to submit usage data for custom
  15. // usage dimensions.
  16. //
  17. // Submitting Metering Records
  18. //
  19. // MeterUsage- Submits the metering record for a Marketplace product.
  20. //The service client's operations are safe to be used concurrently.
  21. // It is not safe to mutate any of the client's properties though.
  22. type MarketplaceMetering struct {
  23. *client.Client
  24. }
  25. // Used for custom client initialization logic
  26. var initClient func(*client.Client)
  27. // Used for custom request initialization logic
  28. var initRequest func(*request.Request)
  29. // A ServiceName is the name of the service the client will make API calls to.
  30. const ServiceName = "metering.marketplace"
  31. // New creates a new instance of the MarketplaceMetering client with a session.
  32. // If additional configuration is needed for the client instance use the optional
  33. // aws.Config parameter to add your extra config.
  34. //
  35. // Example:
  36. // // Create a MarketplaceMetering client from just a session.
  37. // svc := marketplacemetering.New(mySession)
  38. //
  39. // // Create a MarketplaceMetering client with additional configuration
  40. // svc := marketplacemetering.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  41. func New(p client.ConfigProvider, cfgs ...*aws.Config) *MarketplaceMetering {
  42. c := p.ClientConfig(ServiceName, cfgs...)
  43. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  44. }
  45. // newClient creates, initializes and returns a new service client instance.
  46. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *MarketplaceMetering {
  47. svc := &MarketplaceMetering{
  48. Client: client.New(
  49. cfg,
  50. metadata.ClientInfo{
  51. ServiceName: ServiceName,
  52. SigningName: "aws-marketplace",
  53. SigningRegion: signingRegion,
  54. Endpoint: endpoint,
  55. APIVersion: "2016-01-14",
  56. JSONVersion: "1.1",
  57. TargetPrefix: "AWSMPMeteringService",
  58. },
  59. handlers,
  60. ),
  61. }
  62. // Handlers
  63. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  64. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  65. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  66. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  67. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  68. // Run custom client initialization if present
  69. if initClient != nil {
  70. initClient(svc.Client)
  71. }
  72. return svc
  73. }
  74. // newRequest creates a new request for a MarketplaceMetering operation and runs any
  75. // custom request initialization.
  76. func (c *MarketplaceMetering) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  77. req := c.NewRequest(op, params, data)
  78. // Run custom request initialization if present
  79. if initRequest != nil {
  80. initRequest(req)
  81. }
  82. return req
  83. }