You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

387 lines
8.1 KiB

  1. // Copyright 2019 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // https://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // Code generated by gapic-generator. DO NOT EDIT.
  15. package iot_test
  16. import (
  17. "context"
  18. iot "cloud.google.com/go/iot/apiv1"
  19. "google.golang.org/api/iterator"
  20. iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
  21. iampb "google.golang.org/genproto/googleapis/iam/v1"
  22. )
  23. func ExampleNewDeviceManagerClient() {
  24. ctx := context.Background()
  25. c, err := iot.NewDeviceManagerClient(ctx)
  26. if err != nil {
  27. // TODO: Handle error.
  28. }
  29. // TODO: Use client.
  30. _ = c
  31. }
  32. func ExampleDeviceManagerClient_CreateDeviceRegistry() {
  33. ctx := context.Background()
  34. c, err := iot.NewDeviceManagerClient(ctx)
  35. if err != nil {
  36. // TODO: Handle error.
  37. }
  38. req := &iotpb.CreateDeviceRegistryRequest{
  39. // TODO: Fill request struct fields.
  40. }
  41. resp, err := c.CreateDeviceRegistry(ctx, req)
  42. if err != nil {
  43. // TODO: Handle error.
  44. }
  45. // TODO: Use resp.
  46. _ = resp
  47. }
  48. func ExampleDeviceManagerClient_GetDeviceRegistry() {
  49. ctx := context.Background()
  50. c, err := iot.NewDeviceManagerClient(ctx)
  51. if err != nil {
  52. // TODO: Handle error.
  53. }
  54. req := &iotpb.GetDeviceRegistryRequest{
  55. // TODO: Fill request struct fields.
  56. }
  57. resp, err := c.GetDeviceRegistry(ctx, req)
  58. if err != nil {
  59. // TODO: Handle error.
  60. }
  61. // TODO: Use resp.
  62. _ = resp
  63. }
  64. func ExampleDeviceManagerClient_UpdateDeviceRegistry() {
  65. ctx := context.Background()
  66. c, err := iot.NewDeviceManagerClient(ctx)
  67. if err != nil {
  68. // TODO: Handle error.
  69. }
  70. req := &iotpb.UpdateDeviceRegistryRequest{
  71. // TODO: Fill request struct fields.
  72. }
  73. resp, err := c.UpdateDeviceRegistry(ctx, req)
  74. if err != nil {
  75. // TODO: Handle error.
  76. }
  77. // TODO: Use resp.
  78. _ = resp
  79. }
  80. func ExampleDeviceManagerClient_DeleteDeviceRegistry() {
  81. ctx := context.Background()
  82. c, err := iot.NewDeviceManagerClient(ctx)
  83. if err != nil {
  84. // TODO: Handle error.
  85. }
  86. req := &iotpb.DeleteDeviceRegistryRequest{
  87. // TODO: Fill request struct fields.
  88. }
  89. err = c.DeleteDeviceRegistry(ctx, req)
  90. if err != nil {
  91. // TODO: Handle error.
  92. }
  93. }
  94. func ExampleDeviceManagerClient_ListDeviceRegistries() {
  95. ctx := context.Background()
  96. c, err := iot.NewDeviceManagerClient(ctx)
  97. if err != nil {
  98. // TODO: Handle error.
  99. }
  100. req := &iotpb.ListDeviceRegistriesRequest{
  101. // TODO: Fill request struct fields.
  102. }
  103. it := c.ListDeviceRegistries(ctx, req)
  104. for {
  105. resp, err := it.Next()
  106. if err == iterator.Done {
  107. break
  108. }
  109. if err != nil {
  110. // TODO: Handle error.
  111. }
  112. // TODO: Use resp.
  113. _ = resp
  114. }
  115. }
  116. func ExampleDeviceManagerClient_CreateDevice() {
  117. ctx := context.Background()
  118. c, err := iot.NewDeviceManagerClient(ctx)
  119. if err != nil {
  120. // TODO: Handle error.
  121. }
  122. req := &iotpb.CreateDeviceRequest{
  123. // TODO: Fill request struct fields.
  124. }
  125. resp, err := c.CreateDevice(ctx, req)
  126. if err != nil {
  127. // TODO: Handle error.
  128. }
  129. // TODO: Use resp.
  130. _ = resp
  131. }
  132. func ExampleDeviceManagerClient_GetDevice() {
  133. ctx := context.Background()
  134. c, err := iot.NewDeviceManagerClient(ctx)
  135. if err != nil {
  136. // TODO: Handle error.
  137. }
  138. req := &iotpb.GetDeviceRequest{
  139. // TODO: Fill request struct fields.
  140. }
  141. resp, err := c.GetDevice(ctx, req)
  142. if err != nil {
  143. // TODO: Handle error.
  144. }
  145. // TODO: Use resp.
  146. _ = resp
  147. }
  148. func ExampleDeviceManagerClient_UpdateDevice() {
  149. ctx := context.Background()
  150. c, err := iot.NewDeviceManagerClient(ctx)
  151. if err != nil {
  152. // TODO: Handle error.
  153. }
  154. req := &iotpb.UpdateDeviceRequest{
  155. // TODO: Fill request struct fields.
  156. }
  157. resp, err := c.UpdateDevice(ctx, req)
  158. if err != nil {
  159. // TODO: Handle error.
  160. }
  161. // TODO: Use resp.
  162. _ = resp
  163. }
  164. func ExampleDeviceManagerClient_DeleteDevice() {
  165. ctx := context.Background()
  166. c, err := iot.NewDeviceManagerClient(ctx)
  167. if err != nil {
  168. // TODO: Handle error.
  169. }
  170. req := &iotpb.DeleteDeviceRequest{
  171. // TODO: Fill request struct fields.
  172. }
  173. err = c.DeleteDevice(ctx, req)
  174. if err != nil {
  175. // TODO: Handle error.
  176. }
  177. }
  178. func ExampleDeviceManagerClient_ListDevices() {
  179. ctx := context.Background()
  180. c, err := iot.NewDeviceManagerClient(ctx)
  181. if err != nil {
  182. // TODO: Handle error.
  183. }
  184. req := &iotpb.ListDevicesRequest{
  185. // TODO: Fill request struct fields.
  186. }
  187. it := c.ListDevices(ctx, req)
  188. for {
  189. resp, err := it.Next()
  190. if err == iterator.Done {
  191. break
  192. }
  193. if err != nil {
  194. // TODO: Handle error.
  195. }
  196. // TODO: Use resp.
  197. _ = resp
  198. }
  199. }
  200. func ExampleDeviceManagerClient_ModifyCloudToDeviceConfig() {
  201. ctx := context.Background()
  202. c, err := iot.NewDeviceManagerClient(ctx)
  203. if err != nil {
  204. // TODO: Handle error.
  205. }
  206. req := &iotpb.ModifyCloudToDeviceConfigRequest{
  207. // TODO: Fill request struct fields.
  208. }
  209. resp, err := c.ModifyCloudToDeviceConfig(ctx, req)
  210. if err != nil {
  211. // TODO: Handle error.
  212. }
  213. // TODO: Use resp.
  214. _ = resp
  215. }
  216. func ExampleDeviceManagerClient_ListDeviceConfigVersions() {
  217. ctx := context.Background()
  218. c, err := iot.NewDeviceManagerClient(ctx)
  219. if err != nil {
  220. // TODO: Handle error.
  221. }
  222. req := &iotpb.ListDeviceConfigVersionsRequest{
  223. // TODO: Fill request struct fields.
  224. }
  225. resp, err := c.ListDeviceConfigVersions(ctx, req)
  226. if err != nil {
  227. // TODO: Handle error.
  228. }
  229. // TODO: Use resp.
  230. _ = resp
  231. }
  232. func ExampleDeviceManagerClient_ListDeviceStates() {
  233. ctx := context.Background()
  234. c, err := iot.NewDeviceManagerClient(ctx)
  235. if err != nil {
  236. // TODO: Handle error.
  237. }
  238. req := &iotpb.ListDeviceStatesRequest{
  239. // TODO: Fill request struct fields.
  240. }
  241. resp, err := c.ListDeviceStates(ctx, req)
  242. if err != nil {
  243. // TODO: Handle error.
  244. }
  245. // TODO: Use resp.
  246. _ = resp
  247. }
  248. func ExampleDeviceManagerClient_SetIamPolicy() {
  249. ctx := context.Background()
  250. c, err := iot.NewDeviceManagerClient(ctx)
  251. if err != nil {
  252. // TODO: Handle error.
  253. }
  254. req := &iampb.SetIamPolicyRequest{
  255. // TODO: Fill request struct fields.
  256. }
  257. resp, err := c.SetIamPolicy(ctx, req)
  258. if err != nil {
  259. // TODO: Handle error.
  260. }
  261. // TODO: Use resp.
  262. _ = resp
  263. }
  264. func ExampleDeviceManagerClient_GetIamPolicy() {
  265. ctx := context.Background()
  266. c, err := iot.NewDeviceManagerClient(ctx)
  267. if err != nil {
  268. // TODO: Handle error.
  269. }
  270. req := &iampb.GetIamPolicyRequest{
  271. // TODO: Fill request struct fields.
  272. }
  273. resp, err := c.GetIamPolicy(ctx, req)
  274. if err != nil {
  275. // TODO: Handle error.
  276. }
  277. // TODO: Use resp.
  278. _ = resp
  279. }
  280. func ExampleDeviceManagerClient_TestIamPermissions() {
  281. ctx := context.Background()
  282. c, err := iot.NewDeviceManagerClient(ctx)
  283. if err != nil {
  284. // TODO: Handle error.
  285. }
  286. req := &iampb.TestIamPermissionsRequest{
  287. // TODO: Fill request struct fields.
  288. }
  289. resp, err := c.TestIamPermissions(ctx, req)
  290. if err != nil {
  291. // TODO: Handle error.
  292. }
  293. // TODO: Use resp.
  294. _ = resp
  295. }
  296. func ExampleDeviceManagerClient_SendCommandToDevice() {
  297. ctx := context.Background()
  298. c, err := iot.NewDeviceManagerClient(ctx)
  299. if err != nil {
  300. // TODO: Handle error.
  301. }
  302. req := &iotpb.SendCommandToDeviceRequest{
  303. // TODO: Fill request struct fields.
  304. }
  305. resp, err := c.SendCommandToDevice(ctx, req)
  306. if err != nil {
  307. // TODO: Handle error.
  308. }
  309. // TODO: Use resp.
  310. _ = resp
  311. }
  312. func ExampleDeviceManagerClient_BindDeviceToGateway() {
  313. ctx := context.Background()
  314. c, err := iot.NewDeviceManagerClient(ctx)
  315. if err != nil {
  316. // TODO: Handle error.
  317. }
  318. req := &iotpb.BindDeviceToGatewayRequest{
  319. // TODO: Fill request struct fields.
  320. }
  321. resp, err := c.BindDeviceToGateway(ctx, req)
  322. if err != nil {
  323. // TODO: Handle error.
  324. }
  325. // TODO: Use resp.
  326. _ = resp
  327. }
  328. func ExampleDeviceManagerClient_UnbindDeviceFromGateway() {
  329. ctx := context.Background()
  330. c, err := iot.NewDeviceManagerClient(ctx)
  331. if err != nil {
  332. // TODO: Handle error.
  333. }
  334. req := &iotpb.UnbindDeviceFromGatewayRequest{
  335. // TODO: Fill request struct fields.
  336. }
  337. resp, err := c.UnbindDeviceFromGateway(ctx, req)
  338. if err != nil {
  339. // TODO: Handle error.
  340. }
  341. // TODO: Use resp.
  342. _ = resp
  343. }