1// Copyright 2021 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
15// Code generated by protoc-gen-go_gapic. DO NOT EDIT.
16
17package iot_test
18
19import (
20	"context"
21
22	iot "cloud.google.com/go/iot/apiv1"
23	"google.golang.org/api/iterator"
24	iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
25	iampb "google.golang.org/genproto/googleapis/iam/v1"
26)
27
28func ExampleNewDeviceManagerClient() {
29	ctx := context.Background()
30	c, err := iot.NewDeviceManagerClient(ctx)
31	if err != nil {
32		// TODO: Handle error.
33	}
34	// TODO: Use client.
35	_ = c
36}
37
38func ExampleDeviceManagerClient_CreateDeviceRegistry() {
39	// import iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
40
41	ctx := context.Background()
42	c, err := iot.NewDeviceManagerClient(ctx)
43	if err != nil {
44		// TODO: Handle error.
45	}
46
47	req := &iotpb.CreateDeviceRegistryRequest{
48		// TODO: Fill request struct fields.
49	}
50	resp, err := c.CreateDeviceRegistry(ctx, req)
51	if err != nil {
52		// TODO: Handle error.
53	}
54	// TODO: Use resp.
55	_ = resp
56}
57
58func ExampleDeviceManagerClient_GetDeviceRegistry() {
59	// import iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
60
61	ctx := context.Background()
62	c, err := iot.NewDeviceManagerClient(ctx)
63	if err != nil {
64		// TODO: Handle error.
65	}
66
67	req := &iotpb.GetDeviceRegistryRequest{
68		// TODO: Fill request struct fields.
69	}
70	resp, err := c.GetDeviceRegistry(ctx, req)
71	if err != nil {
72		// TODO: Handle error.
73	}
74	// TODO: Use resp.
75	_ = resp
76}
77
78func ExampleDeviceManagerClient_UpdateDeviceRegistry() {
79	// import iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
80
81	ctx := context.Background()
82	c, err := iot.NewDeviceManagerClient(ctx)
83	if err != nil {
84		// TODO: Handle error.
85	}
86
87	req := &iotpb.UpdateDeviceRegistryRequest{
88		// TODO: Fill request struct fields.
89	}
90	resp, err := c.UpdateDeviceRegistry(ctx, req)
91	if err != nil {
92		// TODO: Handle error.
93	}
94	// TODO: Use resp.
95	_ = resp
96}
97
98func ExampleDeviceManagerClient_DeleteDeviceRegistry() {
99	ctx := context.Background()
100	c, err := iot.NewDeviceManagerClient(ctx)
101	if err != nil {
102		// TODO: Handle error.
103	}
104
105	req := &iotpb.DeleteDeviceRegistryRequest{
106		// TODO: Fill request struct fields.
107	}
108	err = c.DeleteDeviceRegistry(ctx, req)
109	if err != nil {
110		// TODO: Handle error.
111	}
112}
113
114func ExampleDeviceManagerClient_ListDeviceRegistries() {
115	// import iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
116	// import "google.golang.org/api/iterator"
117
118	ctx := context.Background()
119	c, err := iot.NewDeviceManagerClient(ctx)
120	if err != nil {
121		// TODO: Handle error.
122	}
123
124	req := &iotpb.ListDeviceRegistriesRequest{
125		// TODO: Fill request struct fields.
126	}
127	it := c.ListDeviceRegistries(ctx, req)
128	for {
129		resp, err := it.Next()
130		if err == iterator.Done {
131			break
132		}
133		if err != nil {
134			// TODO: Handle error.
135		}
136		// TODO: Use resp.
137		_ = resp
138	}
139}
140
141func ExampleDeviceManagerClient_CreateDevice() {
142	// import iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
143
144	ctx := context.Background()
145	c, err := iot.NewDeviceManagerClient(ctx)
146	if err != nil {
147		// TODO: Handle error.
148	}
149
150	req := &iotpb.CreateDeviceRequest{
151		// TODO: Fill request struct fields.
152	}
153	resp, err := c.CreateDevice(ctx, req)
154	if err != nil {
155		// TODO: Handle error.
156	}
157	// TODO: Use resp.
158	_ = resp
159}
160
161func ExampleDeviceManagerClient_GetDevice() {
162	// import iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
163
164	ctx := context.Background()
165	c, err := iot.NewDeviceManagerClient(ctx)
166	if err != nil {
167		// TODO: Handle error.
168	}
169
170	req := &iotpb.GetDeviceRequest{
171		// TODO: Fill request struct fields.
172	}
173	resp, err := c.GetDevice(ctx, req)
174	if err != nil {
175		// TODO: Handle error.
176	}
177	// TODO: Use resp.
178	_ = resp
179}
180
181func ExampleDeviceManagerClient_UpdateDevice() {
182	// import iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
183
184	ctx := context.Background()
185	c, err := iot.NewDeviceManagerClient(ctx)
186	if err != nil {
187		// TODO: Handle error.
188	}
189
190	req := &iotpb.UpdateDeviceRequest{
191		// TODO: Fill request struct fields.
192	}
193	resp, err := c.UpdateDevice(ctx, req)
194	if err != nil {
195		// TODO: Handle error.
196	}
197	// TODO: Use resp.
198	_ = resp
199}
200
201func ExampleDeviceManagerClient_DeleteDevice() {
202	ctx := context.Background()
203	c, err := iot.NewDeviceManagerClient(ctx)
204	if err != nil {
205		// TODO: Handle error.
206	}
207
208	req := &iotpb.DeleteDeviceRequest{
209		// TODO: Fill request struct fields.
210	}
211	err = c.DeleteDevice(ctx, req)
212	if err != nil {
213		// TODO: Handle error.
214	}
215}
216
217func ExampleDeviceManagerClient_ListDevices() {
218	// import iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
219	// import "google.golang.org/api/iterator"
220
221	ctx := context.Background()
222	c, err := iot.NewDeviceManagerClient(ctx)
223	if err != nil {
224		// TODO: Handle error.
225	}
226
227	req := &iotpb.ListDevicesRequest{
228		// TODO: Fill request struct fields.
229	}
230	it := c.ListDevices(ctx, req)
231	for {
232		resp, err := it.Next()
233		if err == iterator.Done {
234			break
235		}
236		if err != nil {
237			// TODO: Handle error.
238		}
239		// TODO: Use resp.
240		_ = resp
241	}
242}
243
244func ExampleDeviceManagerClient_ModifyCloudToDeviceConfig() {
245	// import iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
246
247	ctx := context.Background()
248	c, err := iot.NewDeviceManagerClient(ctx)
249	if err != nil {
250		// TODO: Handle error.
251	}
252
253	req := &iotpb.ModifyCloudToDeviceConfigRequest{
254		// TODO: Fill request struct fields.
255	}
256	resp, err := c.ModifyCloudToDeviceConfig(ctx, req)
257	if err != nil {
258		// TODO: Handle error.
259	}
260	// TODO: Use resp.
261	_ = resp
262}
263
264func ExampleDeviceManagerClient_ListDeviceConfigVersions() {
265	// import iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
266
267	ctx := context.Background()
268	c, err := iot.NewDeviceManagerClient(ctx)
269	if err != nil {
270		// TODO: Handle error.
271	}
272
273	req := &iotpb.ListDeviceConfigVersionsRequest{
274		// TODO: Fill request struct fields.
275	}
276	resp, err := c.ListDeviceConfigVersions(ctx, req)
277	if err != nil {
278		// TODO: Handle error.
279	}
280	// TODO: Use resp.
281	_ = resp
282}
283
284func ExampleDeviceManagerClient_ListDeviceStates() {
285	// import iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
286
287	ctx := context.Background()
288	c, err := iot.NewDeviceManagerClient(ctx)
289	if err != nil {
290		// TODO: Handle error.
291	}
292
293	req := &iotpb.ListDeviceStatesRequest{
294		// TODO: Fill request struct fields.
295	}
296	resp, err := c.ListDeviceStates(ctx, req)
297	if err != nil {
298		// TODO: Handle error.
299	}
300	// TODO: Use resp.
301	_ = resp
302}
303
304func ExampleDeviceManagerClient_SetIamPolicy() {
305	// import iampb "google.golang.org/genproto/googleapis/iam/v1"
306
307	ctx := context.Background()
308	c, err := iot.NewDeviceManagerClient(ctx)
309	if err != nil {
310		// TODO: Handle error.
311	}
312
313	req := &iampb.SetIamPolicyRequest{
314		// TODO: Fill request struct fields.
315	}
316	resp, err := c.SetIamPolicy(ctx, req)
317	if err != nil {
318		// TODO: Handle error.
319	}
320	// TODO: Use resp.
321	_ = resp
322}
323
324func ExampleDeviceManagerClient_GetIamPolicy() {
325	// import iampb "google.golang.org/genproto/googleapis/iam/v1"
326
327	ctx := context.Background()
328	c, err := iot.NewDeviceManagerClient(ctx)
329	if err != nil {
330		// TODO: Handle error.
331	}
332
333	req := &iampb.GetIamPolicyRequest{
334		// TODO: Fill request struct fields.
335	}
336	resp, err := c.GetIamPolicy(ctx, req)
337	if err != nil {
338		// TODO: Handle error.
339	}
340	// TODO: Use resp.
341	_ = resp
342}
343
344func ExampleDeviceManagerClient_TestIamPermissions() {
345	// import iampb "google.golang.org/genproto/googleapis/iam/v1"
346
347	ctx := context.Background()
348	c, err := iot.NewDeviceManagerClient(ctx)
349	if err != nil {
350		// TODO: Handle error.
351	}
352
353	req := &iampb.TestIamPermissionsRequest{
354		// TODO: Fill request struct fields.
355	}
356	resp, err := c.TestIamPermissions(ctx, req)
357	if err != nil {
358		// TODO: Handle error.
359	}
360	// TODO: Use resp.
361	_ = resp
362}
363
364func ExampleDeviceManagerClient_SendCommandToDevice() {
365	// import iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
366
367	ctx := context.Background()
368	c, err := iot.NewDeviceManagerClient(ctx)
369	if err != nil {
370		// TODO: Handle error.
371	}
372
373	req := &iotpb.SendCommandToDeviceRequest{
374		// TODO: Fill request struct fields.
375	}
376	resp, err := c.SendCommandToDevice(ctx, req)
377	if err != nil {
378		// TODO: Handle error.
379	}
380	// TODO: Use resp.
381	_ = resp
382}
383
384func ExampleDeviceManagerClient_BindDeviceToGateway() {
385	// import iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
386
387	ctx := context.Background()
388	c, err := iot.NewDeviceManagerClient(ctx)
389	if err != nil {
390		// TODO: Handle error.
391	}
392
393	req := &iotpb.BindDeviceToGatewayRequest{
394		// TODO: Fill request struct fields.
395	}
396	resp, err := c.BindDeviceToGateway(ctx, req)
397	if err != nil {
398		// TODO: Handle error.
399	}
400	// TODO: Use resp.
401	_ = resp
402}
403
404func ExampleDeviceManagerClient_UnbindDeviceFromGateway() {
405	// import iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
406
407	ctx := context.Background()
408	c, err := iot.NewDeviceManagerClient(ctx)
409	if err != nil {
410		// TODO: Handle error.
411	}
412
413	req := &iotpb.UnbindDeviceFromGatewayRequest{
414		// TODO: Fill request struct fields.
415	}
416	resp, err := c.UnbindDeviceFromGateway(ctx, req)
417	if err != nil {
418		// TODO: Handle error.
419	}
420	// TODO: Use resp.
421	_ = resp
422}
423