service.go 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package iotdataplane
  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. // AWS IoT-Data enables secure, bi-directional communication between Internet-connected
  12. // things (such as sensors, actuators, embedded devices, or smart appliances)
  13. // and the AWS cloud. It implements a broker for applications and things to
  14. // publish messages over HTTP (Publish) and retrieve, update, and delete thing
  15. // shadows. A thing shadow is a persistent representation of your things and
  16. // their state in the AWS cloud.
  17. //The service client's operations are safe to be used concurrently.
  18. // It is not safe to mutate any of the client's properties though.
  19. type IoTDataPlane struct {
  20. *client.Client
  21. }
  22. // Used for custom client initialization logic
  23. var initClient func(*client.Client)
  24. // Used for custom request initialization logic
  25. var initRequest func(*request.Request)
  26. // A ServiceName is the name of the service the client will make API calls to.
  27. const ServiceName = "data.iot"
  28. // New creates a new instance of the IoTDataPlane client with a session.
  29. // If additional configuration is needed for the client instance use the optional
  30. // aws.Config parameter to add your extra config.
  31. //
  32. // Example:
  33. // // Create a IoTDataPlane client from just a session.
  34. // svc := iotdataplane.New(mySession)
  35. //
  36. // // Create a IoTDataPlane client with additional configuration
  37. // svc := iotdataplane.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  38. func New(p client.ConfigProvider, cfgs ...*aws.Config) *IoTDataPlane {
  39. c := p.ClientConfig(ServiceName, cfgs...)
  40. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  41. }
  42. // newClient creates, initializes and returns a new service client instance.
  43. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *IoTDataPlane {
  44. svc := &IoTDataPlane{
  45. Client: client.New(
  46. cfg,
  47. metadata.ClientInfo{
  48. ServiceName: ServiceName,
  49. SigningName: "iotdata",
  50. SigningRegion: signingRegion,
  51. Endpoint: endpoint,
  52. APIVersion: "2015-05-28",
  53. },
  54. handlers,
  55. ),
  56. }
  57. // Handlers
  58. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  59. svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
  60. svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
  61. svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
  62. svc.Handlers.UnmarshalError.PushBackNamed(restjson.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 IoTDataPlane operation and runs any
  70. // custom request initialization.
  71. func (c *IoTDataPlane) 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. }