api.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. // Package iotdataplane provides a client for AWS IoT Data Plane.
  3. package iotdataplane
  4. import (
  5. "github.com/aws/aws-sdk-go/aws/awsutil"
  6. "github.com/aws/aws-sdk-go/aws/request"
  7. "github.com/aws/aws-sdk-go/private/protocol"
  8. "github.com/aws/aws-sdk-go/private/protocol/restjson"
  9. )
  10. const opDeleteThingShadow = "DeleteThingShadow"
  11. // DeleteThingShadowRequest generates a "aws/request.Request" representing the
  12. // client's request for the DeleteThingShadow operation. The "output" return
  13. // value can be used to capture response data after the request's "Send" method
  14. // is called.
  15. //
  16. // Creating a request object using this method should be used when you want to inject
  17. // custom logic into the request's lifecycle using a custom handler, or if you want to
  18. // access properties on the request object before or after sending the request. If
  19. // you just want the service response, call the DeleteThingShadow method directly
  20. // instead.
  21. //
  22. // Note: You must call the "Send" method on the returned request object in order
  23. // to execute the request.
  24. //
  25. // // Example sending a request using the DeleteThingShadowRequest method.
  26. // req, resp := client.DeleteThingShadowRequest(params)
  27. //
  28. // err := req.Send()
  29. // if err == nil { // resp is now filled
  30. // fmt.Println(resp)
  31. // }
  32. //
  33. func (c *IoTDataPlane) DeleteThingShadowRequest(input *DeleteThingShadowInput) (req *request.Request, output *DeleteThingShadowOutput) {
  34. op := &request.Operation{
  35. Name: opDeleteThingShadow,
  36. HTTPMethod: "DELETE",
  37. HTTPPath: "/things/{thingName}/shadow",
  38. }
  39. if input == nil {
  40. input = &DeleteThingShadowInput{}
  41. }
  42. req = c.newRequest(op, input, output)
  43. output = &DeleteThingShadowOutput{}
  44. req.Data = output
  45. return
  46. }
  47. // Deletes the thing shadow for the specified thing.
  48. //
  49. // For more information, see DeleteThingShadow (http://docs.aws.amazon.com/iot/latest/developerguide/API_DeleteThingShadow.html)
  50. // in the AWS IoT Developer Guide.
  51. func (c *IoTDataPlane) DeleteThingShadow(input *DeleteThingShadowInput) (*DeleteThingShadowOutput, error) {
  52. req, out := c.DeleteThingShadowRequest(input)
  53. err := req.Send()
  54. return out, err
  55. }
  56. const opGetThingShadow = "GetThingShadow"
  57. // GetThingShadowRequest generates a "aws/request.Request" representing the
  58. // client's request for the GetThingShadow operation. The "output" return
  59. // value can be used to capture response data after the request's "Send" method
  60. // is called.
  61. //
  62. // Creating a request object using this method should be used when you want to inject
  63. // custom logic into the request's lifecycle using a custom handler, or if you want to
  64. // access properties on the request object before or after sending the request. If
  65. // you just want the service response, call the GetThingShadow method directly
  66. // instead.
  67. //
  68. // Note: You must call the "Send" method on the returned request object in order
  69. // to execute the request.
  70. //
  71. // // Example sending a request using the GetThingShadowRequest method.
  72. // req, resp := client.GetThingShadowRequest(params)
  73. //
  74. // err := req.Send()
  75. // if err == nil { // resp is now filled
  76. // fmt.Println(resp)
  77. // }
  78. //
  79. func (c *IoTDataPlane) GetThingShadowRequest(input *GetThingShadowInput) (req *request.Request, output *GetThingShadowOutput) {
  80. op := &request.Operation{
  81. Name: opGetThingShadow,
  82. HTTPMethod: "GET",
  83. HTTPPath: "/things/{thingName}/shadow",
  84. }
  85. if input == nil {
  86. input = &GetThingShadowInput{}
  87. }
  88. req = c.newRequest(op, input, output)
  89. output = &GetThingShadowOutput{}
  90. req.Data = output
  91. return
  92. }
  93. // Gets the thing shadow for the specified thing.
  94. //
  95. // For more information, see GetThingShadow (http://docs.aws.amazon.com/iot/latest/developerguide/API_GetThingShadow.html)
  96. // in the AWS IoT Developer Guide.
  97. func (c *IoTDataPlane) GetThingShadow(input *GetThingShadowInput) (*GetThingShadowOutput, error) {
  98. req, out := c.GetThingShadowRequest(input)
  99. err := req.Send()
  100. return out, err
  101. }
  102. const opPublish = "Publish"
  103. // PublishRequest generates a "aws/request.Request" representing the
  104. // client's request for the Publish operation. The "output" return
  105. // value can be used to capture response data after the request's "Send" method
  106. // is called.
  107. //
  108. // Creating a request object using this method should be used when you want to inject
  109. // custom logic into the request's lifecycle using a custom handler, or if you want to
  110. // access properties on the request object before or after sending the request. If
  111. // you just want the service response, call the Publish method directly
  112. // instead.
  113. //
  114. // Note: You must call the "Send" method on the returned request object in order
  115. // to execute the request.
  116. //
  117. // // Example sending a request using the PublishRequest method.
  118. // req, resp := client.PublishRequest(params)
  119. //
  120. // err := req.Send()
  121. // if err == nil { // resp is now filled
  122. // fmt.Println(resp)
  123. // }
  124. //
  125. func (c *IoTDataPlane) PublishRequest(input *PublishInput) (req *request.Request, output *PublishOutput) {
  126. op := &request.Operation{
  127. Name: opPublish,
  128. HTTPMethod: "POST",
  129. HTTPPath: "/topics/{topic}",
  130. }
  131. if input == nil {
  132. input = &PublishInput{}
  133. }
  134. req = c.newRequest(op, input, output)
  135. req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler)
  136. req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
  137. output = &PublishOutput{}
  138. req.Data = output
  139. return
  140. }
  141. // Publishes state information.
  142. //
  143. // For more information, see HTTP Protocol (http://docs.aws.amazon.com/iot/latest/developerguide/protocols.html#http)
  144. // in the AWS IoT Developer Guide.
  145. func (c *IoTDataPlane) Publish(input *PublishInput) (*PublishOutput, error) {
  146. req, out := c.PublishRequest(input)
  147. err := req.Send()
  148. return out, err
  149. }
  150. const opUpdateThingShadow = "UpdateThingShadow"
  151. // UpdateThingShadowRequest generates a "aws/request.Request" representing the
  152. // client's request for the UpdateThingShadow operation. The "output" return
  153. // value can be used to capture response data after the request's "Send" method
  154. // is called.
  155. //
  156. // Creating a request object using this method should be used when you want to inject
  157. // custom logic into the request's lifecycle using a custom handler, or if you want to
  158. // access properties on the request object before or after sending the request. If
  159. // you just want the service response, call the UpdateThingShadow method directly
  160. // instead.
  161. //
  162. // Note: You must call the "Send" method on the returned request object in order
  163. // to execute the request.
  164. //
  165. // // Example sending a request using the UpdateThingShadowRequest method.
  166. // req, resp := client.UpdateThingShadowRequest(params)
  167. //
  168. // err := req.Send()
  169. // if err == nil { // resp is now filled
  170. // fmt.Println(resp)
  171. // }
  172. //
  173. func (c *IoTDataPlane) UpdateThingShadowRequest(input *UpdateThingShadowInput) (req *request.Request, output *UpdateThingShadowOutput) {
  174. op := &request.Operation{
  175. Name: opUpdateThingShadow,
  176. HTTPMethod: "POST",
  177. HTTPPath: "/things/{thingName}/shadow",
  178. }
  179. if input == nil {
  180. input = &UpdateThingShadowInput{}
  181. }
  182. req = c.newRequest(op, input, output)
  183. output = &UpdateThingShadowOutput{}
  184. req.Data = output
  185. return
  186. }
  187. // Updates the thing shadow for the specified thing.
  188. //
  189. // For more information, see UpdateThingShadow (http://docs.aws.amazon.com/iot/latest/developerguide/API_UpdateThingShadow.html)
  190. // in the AWS IoT Developer Guide.
  191. func (c *IoTDataPlane) UpdateThingShadow(input *UpdateThingShadowInput) (*UpdateThingShadowOutput, error) {
  192. req, out := c.UpdateThingShadowRequest(input)
  193. err := req.Send()
  194. return out, err
  195. }
  196. // The input for the DeleteThingShadow operation.
  197. type DeleteThingShadowInput struct {
  198. _ struct{} `type:"structure"`
  199. // The name of the thing.
  200. ThingName *string `location:"uri" locationName:"thingName" min:"1" type:"string" required:"true"`
  201. }
  202. // String returns the string representation
  203. func (s DeleteThingShadowInput) String() string {
  204. return awsutil.Prettify(s)
  205. }
  206. // GoString returns the string representation
  207. func (s DeleteThingShadowInput) GoString() string {
  208. return s.String()
  209. }
  210. // Validate inspects the fields of the type to determine if they are valid.
  211. func (s *DeleteThingShadowInput) Validate() error {
  212. invalidParams := request.ErrInvalidParams{Context: "DeleteThingShadowInput"}
  213. if s.ThingName == nil {
  214. invalidParams.Add(request.NewErrParamRequired("ThingName"))
  215. }
  216. if s.ThingName != nil && len(*s.ThingName) < 1 {
  217. invalidParams.Add(request.NewErrParamMinLen("ThingName", 1))
  218. }
  219. if invalidParams.Len() > 0 {
  220. return invalidParams
  221. }
  222. return nil
  223. }
  224. // The output from the DeleteThingShadow operation.
  225. type DeleteThingShadowOutput struct {
  226. _ struct{} `type:"structure" payload:"Payload"`
  227. // The state information, in JSON format.
  228. Payload []byte `locationName:"payload" type:"blob" required:"true"`
  229. }
  230. // String returns the string representation
  231. func (s DeleteThingShadowOutput) String() string {
  232. return awsutil.Prettify(s)
  233. }
  234. // GoString returns the string representation
  235. func (s DeleteThingShadowOutput) GoString() string {
  236. return s.String()
  237. }
  238. // The input for the GetThingShadow operation.
  239. type GetThingShadowInput struct {
  240. _ struct{} `type:"structure"`
  241. // The name of the thing.
  242. ThingName *string `location:"uri" locationName:"thingName" min:"1" type:"string" required:"true"`
  243. }
  244. // String returns the string representation
  245. func (s GetThingShadowInput) String() string {
  246. return awsutil.Prettify(s)
  247. }
  248. // GoString returns the string representation
  249. func (s GetThingShadowInput) GoString() string {
  250. return s.String()
  251. }
  252. // Validate inspects the fields of the type to determine if they are valid.
  253. func (s *GetThingShadowInput) Validate() error {
  254. invalidParams := request.ErrInvalidParams{Context: "GetThingShadowInput"}
  255. if s.ThingName == nil {
  256. invalidParams.Add(request.NewErrParamRequired("ThingName"))
  257. }
  258. if s.ThingName != nil && len(*s.ThingName) < 1 {
  259. invalidParams.Add(request.NewErrParamMinLen("ThingName", 1))
  260. }
  261. if invalidParams.Len() > 0 {
  262. return invalidParams
  263. }
  264. return nil
  265. }
  266. // The output from the GetThingShadow operation.
  267. type GetThingShadowOutput struct {
  268. _ struct{} `type:"structure" payload:"Payload"`
  269. // The state information, in JSON format.
  270. Payload []byte `locationName:"payload" type:"blob"`
  271. }
  272. // String returns the string representation
  273. func (s GetThingShadowOutput) String() string {
  274. return awsutil.Prettify(s)
  275. }
  276. // GoString returns the string representation
  277. func (s GetThingShadowOutput) GoString() string {
  278. return s.String()
  279. }
  280. // The input for the Publish operation.
  281. type PublishInput struct {
  282. _ struct{} `type:"structure" payload:"Payload"`
  283. // The state information, in JSON format.
  284. Payload []byte `locationName:"payload" type:"blob"`
  285. // The Quality of Service (QoS) level.
  286. Qos *int64 `location:"querystring" locationName:"qos" type:"integer"`
  287. // The name of the MQTT topic.
  288. Topic *string `location:"uri" locationName:"topic" type:"string" required:"true"`
  289. }
  290. // String returns the string representation
  291. func (s PublishInput) String() string {
  292. return awsutil.Prettify(s)
  293. }
  294. // GoString returns the string representation
  295. func (s PublishInput) GoString() string {
  296. return s.String()
  297. }
  298. // Validate inspects the fields of the type to determine if they are valid.
  299. func (s *PublishInput) Validate() error {
  300. invalidParams := request.ErrInvalidParams{Context: "PublishInput"}
  301. if s.Topic == nil {
  302. invalidParams.Add(request.NewErrParamRequired("Topic"))
  303. }
  304. if invalidParams.Len() > 0 {
  305. return invalidParams
  306. }
  307. return nil
  308. }
  309. type PublishOutput struct {
  310. _ struct{} `type:"structure"`
  311. }
  312. // String returns the string representation
  313. func (s PublishOutput) String() string {
  314. return awsutil.Prettify(s)
  315. }
  316. // GoString returns the string representation
  317. func (s PublishOutput) GoString() string {
  318. return s.String()
  319. }
  320. // The input for the UpdateThingShadow operation.
  321. type UpdateThingShadowInput struct {
  322. _ struct{} `type:"structure" payload:"Payload"`
  323. // The state information, in JSON format.
  324. Payload []byte `locationName:"payload" type:"blob" required:"true"`
  325. // The name of the thing.
  326. ThingName *string `location:"uri" locationName:"thingName" min:"1" type:"string" required:"true"`
  327. }
  328. // String returns the string representation
  329. func (s UpdateThingShadowInput) String() string {
  330. return awsutil.Prettify(s)
  331. }
  332. // GoString returns the string representation
  333. func (s UpdateThingShadowInput) GoString() string {
  334. return s.String()
  335. }
  336. // Validate inspects the fields of the type to determine if they are valid.
  337. func (s *UpdateThingShadowInput) Validate() error {
  338. invalidParams := request.ErrInvalidParams{Context: "UpdateThingShadowInput"}
  339. if s.Payload == nil {
  340. invalidParams.Add(request.NewErrParamRequired("Payload"))
  341. }
  342. if s.ThingName == nil {
  343. invalidParams.Add(request.NewErrParamRequired("ThingName"))
  344. }
  345. if s.ThingName != nil && len(*s.ThingName) < 1 {
  346. invalidParams.Add(request.NewErrParamMinLen("ThingName", 1))
  347. }
  348. if invalidParams.Len() > 0 {
  349. return invalidParams
  350. }
  351. return nil
  352. }
  353. // The output from the UpdateThingShadow operation.
  354. type UpdateThingShadowOutput struct {
  355. _ struct{} `type:"structure" payload:"Payload"`
  356. // The state information, in JSON format.
  357. Payload []byte `locationName:"payload" type:"blob"`
  358. }
  359. // String returns the string representation
  360. func (s UpdateThingShadowOutput) String() string {
  361. return awsutil.Prettify(s)
  362. }
  363. // GoString returns the string representation
  364. func (s UpdateThingShadowOutput) GoString() string {
  365. return s.String()
  366. }