api.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  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. // See DeleteThingShadow for usage and error information.
  17. //
  18. // Creating a request object using this method should be used when you want to inject
  19. // custom logic into the request's lifecycle using a custom handler, or if you want to
  20. // access properties on the request object before or after sending the request. If
  21. // you just want the service response, call the DeleteThingShadow method directly
  22. // instead.
  23. //
  24. // Note: You must call the "Send" method on the returned request object in order
  25. // to execute the request.
  26. //
  27. // // Example sending a request using the DeleteThingShadowRequest method.
  28. // req, resp := client.DeleteThingShadowRequest(params)
  29. //
  30. // err := req.Send()
  31. // if err == nil { // resp is now filled
  32. // fmt.Println(resp)
  33. // }
  34. //
  35. func (c *IoTDataPlane) DeleteThingShadowRequest(input *DeleteThingShadowInput) (req *request.Request, output *DeleteThingShadowOutput) {
  36. op := &request.Operation{
  37. Name: opDeleteThingShadow,
  38. HTTPMethod: "DELETE",
  39. HTTPPath: "/things/{thingName}/shadow",
  40. }
  41. if input == nil {
  42. input = &DeleteThingShadowInput{}
  43. }
  44. req = c.newRequest(op, input, output)
  45. output = &DeleteThingShadowOutput{}
  46. req.Data = output
  47. return
  48. }
  49. // DeleteThingShadow API operation for AWS IoT Data Plane.
  50. //
  51. // Deletes the thing shadow for the specified thing.
  52. //
  53. // For more information, see DeleteThingShadow (http://docs.aws.amazon.com/iot/latest/developerguide/API_DeleteThingShadow.html)
  54. // in the AWS IoT Developer Guide.
  55. //
  56. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  57. // with awserr.Error's Code and Message methods to get detailed information about
  58. // the error.
  59. //
  60. // See the AWS API reference guide for AWS IoT Data Plane's
  61. // API operation DeleteThingShadow for usage and error information.
  62. //
  63. // Returned Error Codes:
  64. // * ResourceNotFoundException
  65. // The specified resource does not exist.
  66. //
  67. // * InvalidRequestException
  68. // The request is not valid.
  69. //
  70. // * ThrottlingException
  71. // The rate exceeds the limit.
  72. //
  73. // * UnauthorizedException
  74. // You are not authorized to perform this operation.
  75. //
  76. // * ServiceUnavailableException
  77. // The service is temporarily unavailable.
  78. //
  79. // * InternalFailureException
  80. // An unexpected error has occurred.
  81. //
  82. // * MethodNotAllowedException
  83. // The specified combination of HTTP verb and URI is not supported.
  84. //
  85. // * UnsupportedDocumentEncodingException
  86. // The document encoding is not supported.
  87. //
  88. func (c *IoTDataPlane) DeleteThingShadow(input *DeleteThingShadowInput) (*DeleteThingShadowOutput, error) {
  89. req, out := c.DeleteThingShadowRequest(input)
  90. err := req.Send()
  91. return out, err
  92. }
  93. const opGetThingShadow = "GetThingShadow"
  94. // GetThingShadowRequest generates a "aws/request.Request" representing the
  95. // client's request for the GetThingShadow operation. The "output" return
  96. // value can be used to capture response data after the request's "Send" method
  97. // is called.
  98. //
  99. // See GetThingShadow for usage and error information.
  100. //
  101. // Creating a request object using this method should be used when you want to inject
  102. // custom logic into the request's lifecycle using a custom handler, or if you want to
  103. // access properties on the request object before or after sending the request. If
  104. // you just want the service response, call the GetThingShadow method directly
  105. // instead.
  106. //
  107. // Note: You must call the "Send" method on the returned request object in order
  108. // to execute the request.
  109. //
  110. // // Example sending a request using the GetThingShadowRequest method.
  111. // req, resp := client.GetThingShadowRequest(params)
  112. //
  113. // err := req.Send()
  114. // if err == nil { // resp is now filled
  115. // fmt.Println(resp)
  116. // }
  117. //
  118. func (c *IoTDataPlane) GetThingShadowRequest(input *GetThingShadowInput) (req *request.Request, output *GetThingShadowOutput) {
  119. op := &request.Operation{
  120. Name: opGetThingShadow,
  121. HTTPMethod: "GET",
  122. HTTPPath: "/things/{thingName}/shadow",
  123. }
  124. if input == nil {
  125. input = &GetThingShadowInput{}
  126. }
  127. req = c.newRequest(op, input, output)
  128. output = &GetThingShadowOutput{}
  129. req.Data = output
  130. return
  131. }
  132. // GetThingShadow API operation for AWS IoT Data Plane.
  133. //
  134. // Gets the thing shadow for the specified thing.
  135. //
  136. // For more information, see GetThingShadow (http://docs.aws.amazon.com/iot/latest/developerguide/API_GetThingShadow.html)
  137. // in the AWS IoT Developer Guide.
  138. //
  139. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  140. // with awserr.Error's Code and Message methods to get detailed information about
  141. // the error.
  142. //
  143. // See the AWS API reference guide for AWS IoT Data Plane's
  144. // API operation GetThingShadow for usage and error information.
  145. //
  146. // Returned Error Codes:
  147. // * InvalidRequestException
  148. // The request is not valid.
  149. //
  150. // * ResourceNotFoundException
  151. // The specified resource does not exist.
  152. //
  153. // * ThrottlingException
  154. // The rate exceeds the limit.
  155. //
  156. // * UnauthorizedException
  157. // You are not authorized to perform this operation.
  158. //
  159. // * ServiceUnavailableException
  160. // The service is temporarily unavailable.
  161. //
  162. // * InternalFailureException
  163. // An unexpected error has occurred.
  164. //
  165. // * MethodNotAllowedException
  166. // The specified combination of HTTP verb and URI is not supported.
  167. //
  168. // * UnsupportedDocumentEncodingException
  169. // The document encoding is not supported.
  170. //
  171. func (c *IoTDataPlane) GetThingShadow(input *GetThingShadowInput) (*GetThingShadowOutput, error) {
  172. req, out := c.GetThingShadowRequest(input)
  173. err := req.Send()
  174. return out, err
  175. }
  176. const opPublish = "Publish"
  177. // PublishRequest generates a "aws/request.Request" representing the
  178. // client's request for the Publish operation. The "output" return
  179. // value can be used to capture response data after the request's "Send" method
  180. // is called.
  181. //
  182. // See Publish for usage and error information.
  183. //
  184. // Creating a request object using this method should be used when you want to inject
  185. // custom logic into the request's lifecycle using a custom handler, or if you want to
  186. // access properties on the request object before or after sending the request. If
  187. // you just want the service response, call the Publish method directly
  188. // instead.
  189. //
  190. // Note: You must call the "Send" method on the returned request object in order
  191. // to execute the request.
  192. //
  193. // // Example sending a request using the PublishRequest method.
  194. // req, resp := client.PublishRequest(params)
  195. //
  196. // err := req.Send()
  197. // if err == nil { // resp is now filled
  198. // fmt.Println(resp)
  199. // }
  200. //
  201. func (c *IoTDataPlane) PublishRequest(input *PublishInput) (req *request.Request, output *PublishOutput) {
  202. op := &request.Operation{
  203. Name: opPublish,
  204. HTTPMethod: "POST",
  205. HTTPPath: "/topics/{topic}",
  206. }
  207. if input == nil {
  208. input = &PublishInput{}
  209. }
  210. req = c.newRequest(op, input, output)
  211. req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler)
  212. req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
  213. output = &PublishOutput{}
  214. req.Data = output
  215. return
  216. }
  217. // Publish API operation for AWS IoT Data Plane.
  218. //
  219. // Publishes state information.
  220. //
  221. // For more information, see HTTP Protocol (http://docs.aws.amazon.com/iot/latest/developerguide/protocols.html#http)
  222. // in the AWS IoT Developer Guide.
  223. //
  224. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  225. // with awserr.Error's Code and Message methods to get detailed information about
  226. // the error.
  227. //
  228. // See the AWS API reference guide for AWS IoT Data Plane's
  229. // API operation Publish for usage and error information.
  230. //
  231. // Returned Error Codes:
  232. // * InternalFailureException
  233. // An unexpected error has occurred.
  234. //
  235. // * InvalidRequestException
  236. // The request is not valid.
  237. //
  238. // * UnauthorizedException
  239. // You are not authorized to perform this operation.
  240. //
  241. // * MethodNotAllowedException
  242. // The specified combination of HTTP verb and URI is not supported.
  243. //
  244. func (c *IoTDataPlane) Publish(input *PublishInput) (*PublishOutput, error) {
  245. req, out := c.PublishRequest(input)
  246. err := req.Send()
  247. return out, err
  248. }
  249. const opUpdateThingShadow = "UpdateThingShadow"
  250. // UpdateThingShadowRequest generates a "aws/request.Request" representing the
  251. // client's request for the UpdateThingShadow operation. The "output" return
  252. // value can be used to capture response data after the request's "Send" method
  253. // is called.
  254. //
  255. // See UpdateThingShadow for usage and error information.
  256. //
  257. // Creating a request object using this method should be used when you want to inject
  258. // custom logic into the request's lifecycle using a custom handler, or if you want to
  259. // access properties on the request object before or after sending the request. If
  260. // you just want the service response, call the UpdateThingShadow method directly
  261. // instead.
  262. //
  263. // Note: You must call the "Send" method on the returned request object in order
  264. // to execute the request.
  265. //
  266. // // Example sending a request using the UpdateThingShadowRequest method.
  267. // req, resp := client.UpdateThingShadowRequest(params)
  268. //
  269. // err := req.Send()
  270. // if err == nil { // resp is now filled
  271. // fmt.Println(resp)
  272. // }
  273. //
  274. func (c *IoTDataPlane) UpdateThingShadowRequest(input *UpdateThingShadowInput) (req *request.Request, output *UpdateThingShadowOutput) {
  275. op := &request.Operation{
  276. Name: opUpdateThingShadow,
  277. HTTPMethod: "POST",
  278. HTTPPath: "/things/{thingName}/shadow",
  279. }
  280. if input == nil {
  281. input = &UpdateThingShadowInput{}
  282. }
  283. req = c.newRequest(op, input, output)
  284. output = &UpdateThingShadowOutput{}
  285. req.Data = output
  286. return
  287. }
  288. // UpdateThingShadow API operation for AWS IoT Data Plane.
  289. //
  290. // Updates the thing shadow for the specified thing.
  291. //
  292. // For more information, see UpdateThingShadow (http://docs.aws.amazon.com/iot/latest/developerguide/API_UpdateThingShadow.html)
  293. // in the AWS IoT Developer Guide.
  294. //
  295. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  296. // with awserr.Error's Code and Message methods to get detailed information about
  297. // the error.
  298. //
  299. // See the AWS API reference guide for AWS IoT Data Plane's
  300. // API operation UpdateThingShadow for usage and error information.
  301. //
  302. // Returned Error Codes:
  303. // * ConflictException
  304. // The specified version does not match the version of the document.
  305. //
  306. // * RequestEntityTooLargeException
  307. // The payload exceeds the maximum size allowed.
  308. //
  309. // * InvalidRequestException
  310. // The request is not valid.
  311. //
  312. // * ThrottlingException
  313. // The rate exceeds the limit.
  314. //
  315. // * UnauthorizedException
  316. // You are not authorized to perform this operation.
  317. //
  318. // * ServiceUnavailableException
  319. // The service is temporarily unavailable.
  320. //
  321. // * InternalFailureException
  322. // An unexpected error has occurred.
  323. //
  324. // * MethodNotAllowedException
  325. // The specified combination of HTTP verb and URI is not supported.
  326. //
  327. // * UnsupportedDocumentEncodingException
  328. // The document encoding is not supported.
  329. //
  330. func (c *IoTDataPlane) UpdateThingShadow(input *UpdateThingShadowInput) (*UpdateThingShadowOutput, error) {
  331. req, out := c.UpdateThingShadowRequest(input)
  332. err := req.Send()
  333. return out, err
  334. }
  335. // The input for the DeleteThingShadow operation.
  336. type DeleteThingShadowInput struct {
  337. _ struct{} `type:"structure"`
  338. // The name of the thing.
  339. //
  340. // ThingName is a required field
  341. ThingName *string `location:"uri" locationName:"thingName" min:"1" type:"string" required:"true"`
  342. }
  343. // String returns the string representation
  344. func (s DeleteThingShadowInput) String() string {
  345. return awsutil.Prettify(s)
  346. }
  347. // GoString returns the string representation
  348. func (s DeleteThingShadowInput) GoString() string {
  349. return s.String()
  350. }
  351. // Validate inspects the fields of the type to determine if they are valid.
  352. func (s *DeleteThingShadowInput) Validate() error {
  353. invalidParams := request.ErrInvalidParams{Context: "DeleteThingShadowInput"}
  354. if s.ThingName == nil {
  355. invalidParams.Add(request.NewErrParamRequired("ThingName"))
  356. }
  357. if s.ThingName != nil && len(*s.ThingName) < 1 {
  358. invalidParams.Add(request.NewErrParamMinLen("ThingName", 1))
  359. }
  360. if invalidParams.Len() > 0 {
  361. return invalidParams
  362. }
  363. return nil
  364. }
  365. // The output from the DeleteThingShadow operation.
  366. type DeleteThingShadowOutput struct {
  367. _ struct{} `type:"structure" payload:"Payload"`
  368. // The state information, in JSON format.
  369. //
  370. // Payload is a required field
  371. Payload []byte `locationName:"payload" type:"blob" required:"true"`
  372. }
  373. // String returns the string representation
  374. func (s DeleteThingShadowOutput) String() string {
  375. return awsutil.Prettify(s)
  376. }
  377. // GoString returns the string representation
  378. func (s DeleteThingShadowOutput) GoString() string {
  379. return s.String()
  380. }
  381. // The input for the GetThingShadow operation.
  382. type GetThingShadowInput struct {
  383. _ struct{} `type:"structure"`
  384. // The name of the thing.
  385. //
  386. // ThingName is a required field
  387. ThingName *string `location:"uri" locationName:"thingName" min:"1" type:"string" required:"true"`
  388. }
  389. // String returns the string representation
  390. func (s GetThingShadowInput) String() string {
  391. return awsutil.Prettify(s)
  392. }
  393. // GoString returns the string representation
  394. func (s GetThingShadowInput) GoString() string {
  395. return s.String()
  396. }
  397. // Validate inspects the fields of the type to determine if they are valid.
  398. func (s *GetThingShadowInput) Validate() error {
  399. invalidParams := request.ErrInvalidParams{Context: "GetThingShadowInput"}
  400. if s.ThingName == nil {
  401. invalidParams.Add(request.NewErrParamRequired("ThingName"))
  402. }
  403. if s.ThingName != nil && len(*s.ThingName) < 1 {
  404. invalidParams.Add(request.NewErrParamMinLen("ThingName", 1))
  405. }
  406. if invalidParams.Len() > 0 {
  407. return invalidParams
  408. }
  409. return nil
  410. }
  411. // The output from the GetThingShadow operation.
  412. type GetThingShadowOutput struct {
  413. _ struct{} `type:"structure" payload:"Payload"`
  414. // The state information, in JSON format.
  415. Payload []byte `locationName:"payload" type:"blob"`
  416. }
  417. // String returns the string representation
  418. func (s GetThingShadowOutput) String() string {
  419. return awsutil.Prettify(s)
  420. }
  421. // GoString returns the string representation
  422. func (s GetThingShadowOutput) GoString() string {
  423. return s.String()
  424. }
  425. // The input for the Publish operation.
  426. type PublishInput struct {
  427. _ struct{} `type:"structure" payload:"Payload"`
  428. // The state information, in JSON format.
  429. Payload []byte `locationName:"payload" type:"blob"`
  430. // The Quality of Service (QoS) level.
  431. Qos *int64 `location:"querystring" locationName:"qos" type:"integer"`
  432. // The name of the MQTT topic.
  433. //
  434. // Topic is a required field
  435. Topic *string `location:"uri" locationName:"topic" type:"string" required:"true"`
  436. }
  437. // String returns the string representation
  438. func (s PublishInput) String() string {
  439. return awsutil.Prettify(s)
  440. }
  441. // GoString returns the string representation
  442. func (s PublishInput) GoString() string {
  443. return s.String()
  444. }
  445. // Validate inspects the fields of the type to determine if they are valid.
  446. func (s *PublishInput) Validate() error {
  447. invalidParams := request.ErrInvalidParams{Context: "PublishInput"}
  448. if s.Topic == nil {
  449. invalidParams.Add(request.NewErrParamRequired("Topic"))
  450. }
  451. if invalidParams.Len() > 0 {
  452. return invalidParams
  453. }
  454. return nil
  455. }
  456. type PublishOutput struct {
  457. _ struct{} `type:"structure"`
  458. }
  459. // String returns the string representation
  460. func (s PublishOutput) String() string {
  461. return awsutil.Prettify(s)
  462. }
  463. // GoString returns the string representation
  464. func (s PublishOutput) GoString() string {
  465. return s.String()
  466. }
  467. // The input for the UpdateThingShadow operation.
  468. type UpdateThingShadowInput struct {
  469. _ struct{} `type:"structure" payload:"Payload"`
  470. // The state information, in JSON format.
  471. //
  472. // Payload is a required field
  473. Payload []byte `locationName:"payload" type:"blob" required:"true"`
  474. // The name of the thing.
  475. //
  476. // ThingName is a required field
  477. ThingName *string `location:"uri" locationName:"thingName" min:"1" type:"string" required:"true"`
  478. }
  479. // String returns the string representation
  480. func (s UpdateThingShadowInput) String() string {
  481. return awsutil.Prettify(s)
  482. }
  483. // GoString returns the string representation
  484. func (s UpdateThingShadowInput) GoString() string {
  485. return s.String()
  486. }
  487. // Validate inspects the fields of the type to determine if they are valid.
  488. func (s *UpdateThingShadowInput) Validate() error {
  489. invalidParams := request.ErrInvalidParams{Context: "UpdateThingShadowInput"}
  490. if s.Payload == nil {
  491. invalidParams.Add(request.NewErrParamRequired("Payload"))
  492. }
  493. if s.ThingName == nil {
  494. invalidParams.Add(request.NewErrParamRequired("ThingName"))
  495. }
  496. if s.ThingName != nil && len(*s.ThingName) < 1 {
  497. invalidParams.Add(request.NewErrParamMinLen("ThingName", 1))
  498. }
  499. if invalidParams.Len() > 0 {
  500. return invalidParams
  501. }
  502. return nil
  503. }
  504. // The output from the UpdateThingShadow operation.
  505. type UpdateThingShadowOutput struct {
  506. _ struct{} `type:"structure" payload:"Payload"`
  507. // The state information, in JSON format.
  508. Payload []byte `locationName:"payload" type:"blob"`
  509. }
  510. // String returns the string representation
  511. func (s UpdateThingShadowOutput) String() string {
  512. return awsutil.Prettify(s)
  513. }
  514. // GoString returns the string representation
  515. func (s UpdateThingShadowOutput) GoString() string {
  516. return s.String()
  517. }