Debian Codegraph @

visionai/apiv1/live_video_analytics_client_example_test.go

raw
1 // Copyright 2025 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
17 package visionai_test
18
19 import (
20 "context"
21
22 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
23 visionai "cloud.google.com/go/visionai/apiv1"
24 visionaipb "cloud.google.com/go/visionai/apiv1/visionaipb"
25 "google.golang.org/api/iterator"
26 )
27
28 func ExampleNewLiveVideoAnalyticsClient() {
29 ctx := context.Background()
30 // This snippet has been automatically generated and should be regarded as a code template only.
31 // It will require modifications to work:
32 // - It may require correct/in-range values for request initialization.
33 // - It may require specifying regional endpoints when creating the service client as shown in:
34 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
35 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
36 if err != nil {
37 // TODO: Handle error.
38 }
39 defer c.Close()
40
41 // TODO: Use client.
42 _ = c
43 }
44
45 func ExampleNewLiveVideoAnalyticsRESTClient() {
46 ctx := context.Background()
47 // This snippet has been automatically generated and should be regarded as a code template only.
48 // It will require modifications to work:
49 // - It may require correct/in-range values for request initialization.
50 // - It may require specifying regional endpoints when creating the service client as shown in:
51 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
52 c, err := visionai.NewLiveVideoAnalyticsRESTClient(ctx)
53 if err != nil {
54 // TODO: Handle error.
55 }
56 defer c.Close()
57
58 // TODO: Use client.
59 _ = c
60 }
61
62 func ExampleLiveVideoAnalyticsClient_BatchRunProcess() {
63 ctx := context.Background()
64 // This snippet has been automatically generated and should be regarded as a code template only.
65 // It will require modifications to work:
66 // - It may require correct/in-range values for request initialization.
67 // - It may require specifying regional endpoints when creating the service client as shown in:
68 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
69 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
70 if err != nil {
71 // TODO: Handle error.
72 }
73 defer c.Close()
74
75 req := &visionaipb.BatchRunProcessRequest{
76 // TODO: Fill request struct fields.
77 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#BatchRunProcessRequest.
78 }
79 op, err := c.BatchRunProcess(ctx, req)
80 if err != nil {
81 // TODO: Handle error.
82 }
83
84 resp, err := op.Wait(ctx)
85 if err != nil {
86 // TODO: Handle error.
87 }
88 // TODO: Use resp.
89 _ = resp
90 }
91
92 func ExampleLiveVideoAnalyticsClient_CreateAnalysis() {
93 ctx := context.Background()
94 // This snippet has been automatically generated and should be regarded as a code template only.
95 // It will require modifications to work:
96 // - It may require correct/in-range values for request initialization.
97 // - It may require specifying regional endpoints when creating the service client as shown in:
98 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
99 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
100 if err != nil {
101 // TODO: Handle error.
102 }
103 defer c.Close()
104
105 req := &visionaipb.CreateAnalysisRequest{
106 // TODO: Fill request struct fields.
107 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#CreateAnalysisRequest.
108 }
109 op, err := c.CreateAnalysis(ctx, req)
110 if err != nil {
111 // TODO: Handle error.
112 }
113
114 resp, err := op.Wait(ctx)
115 if err != nil {
116 // TODO: Handle error.
117 }
118 // TODO: Use resp.
119 _ = resp
120 }
121
122 func ExampleLiveVideoAnalyticsClient_CreateOperator() {
123 ctx := context.Background()
124 // This snippet has been automatically generated and should be regarded as a code template only.
125 // It will require modifications to work:
126 // - It may require correct/in-range values for request initialization.
127 // - It may require specifying regional endpoints when creating the service client as shown in:
128 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
129 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
130 if err != nil {
131 // TODO: Handle error.
132 }
133 defer c.Close()
134
135 req := &visionaipb.CreateOperatorRequest{
136 // TODO: Fill request struct fields.
137 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#CreateOperatorRequest.
138 }
139 op, err := c.CreateOperator(ctx, req)
140 if err != nil {
141 // TODO: Handle error.
142 }
143
144 resp, err := op.Wait(ctx)
145 if err != nil {
146 // TODO: Handle error.
147 }
148 // TODO: Use resp.
149 _ = resp
150 }
151
152 func ExampleLiveVideoAnalyticsClient_CreateProcess() {
153 ctx := context.Background()
154 // This snippet has been automatically generated and should be regarded as a code template only.
155 // It will require modifications to work:
156 // - It may require correct/in-range values for request initialization.
157 // - It may require specifying regional endpoints when creating the service client as shown in:
158 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
159 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
160 if err != nil {
161 // TODO: Handle error.
162 }
163 defer c.Close()
164
165 req := &visionaipb.CreateProcessRequest{
166 // TODO: Fill request struct fields.
167 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#CreateProcessRequest.
168 }
169 op, err := c.CreateProcess(ctx, req)
170 if err != nil {
171 // TODO: Handle error.
172 }
173
174 resp, err := op.Wait(ctx)
175 if err != nil {
176 // TODO: Handle error.
177 }
178 // TODO: Use resp.
179 _ = resp
180 }
181
182 func ExampleLiveVideoAnalyticsClient_DeleteAnalysis() {
183 ctx := context.Background()
184 // This snippet has been automatically generated and should be regarded as a code template only.
185 // It will require modifications to work:
186 // - It may require correct/in-range values for request initialization.
187 // - It may require specifying regional endpoints when creating the service client as shown in:
188 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
189 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
190 if err != nil {
191 // TODO: Handle error.
192 }
193 defer c.Close()
194
195 req := &visionaipb.DeleteAnalysisRequest{
196 // TODO: Fill request struct fields.
197 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#DeleteAnalysisRequest.
198 }
199 op, err := c.DeleteAnalysis(ctx, req)
200 if err != nil {
201 // TODO: Handle error.
202 }
203
204 err = op.Wait(ctx)
205 if err != nil {
206 // TODO: Handle error.
207 }
208 }
209
210 func ExampleLiveVideoAnalyticsClient_DeleteOperator() {
211 ctx := context.Background()
212 // This snippet has been automatically generated and should be regarded as a code template only.
213 // It will require modifications to work:
214 // - It may require correct/in-range values for request initialization.
215 // - It may require specifying regional endpoints when creating the service client as shown in:
216 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
217 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
218 if err != nil {
219 // TODO: Handle error.
220 }
221 defer c.Close()
222
223 req := &visionaipb.DeleteOperatorRequest{
224 // TODO: Fill request struct fields.
225 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#DeleteOperatorRequest.
226 }
227 op, err := c.DeleteOperator(ctx, req)
228 if err != nil {
229 // TODO: Handle error.
230 }
231
232 err = op.Wait(ctx)
233 if err != nil {
234 // TODO: Handle error.
235 }
236 }
237
238 func ExampleLiveVideoAnalyticsClient_DeleteProcess() {
239 ctx := context.Background()
240 // This snippet has been automatically generated and should be regarded as a code template only.
241 // It will require modifications to work:
242 // - It may require correct/in-range values for request initialization.
243 // - It may require specifying regional endpoints when creating the service client as shown in:
244 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
245 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
246 if err != nil {
247 // TODO: Handle error.
248 }
249 defer c.Close()
250
251 req := &visionaipb.DeleteProcessRequest{
252 // TODO: Fill request struct fields.
253 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#DeleteProcessRequest.
254 }
255 op, err := c.DeleteProcess(ctx, req)
256 if err != nil {
257 // TODO: Handle error.
258 }
259
260 err = op.Wait(ctx)
261 if err != nil {
262 // TODO: Handle error.
263 }
264 }
265
266 func ExampleLiveVideoAnalyticsClient_GetAnalysis() {
267 ctx := context.Background()
268 // This snippet has been automatically generated and should be regarded as a code template only.
269 // It will require modifications to work:
270 // - It may require correct/in-range values for request initialization.
271 // - It may require specifying regional endpoints when creating the service client as shown in:
272 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
273 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
274 if err != nil {
275 // TODO: Handle error.
276 }
277 defer c.Close()
278
279 req := &visionaipb.GetAnalysisRequest{
280 // TODO: Fill request struct fields.
281 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#GetAnalysisRequest.
282 }
283 resp, err := c.GetAnalysis(ctx, req)
284 if err != nil {
285 // TODO: Handle error.
286 }
287 // TODO: Use resp.
288 _ = resp
289 }
290
291 func ExampleLiveVideoAnalyticsClient_GetOperator() {
292 ctx := context.Background()
293 // This snippet has been automatically generated and should be regarded as a code template only.
294 // It will require modifications to work:
295 // - It may require correct/in-range values for request initialization.
296 // - It may require specifying regional endpoints when creating the service client as shown in:
297 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
298 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
299 if err != nil {
300 // TODO: Handle error.
301 }
302 defer c.Close()
303
304 req := &visionaipb.GetOperatorRequest{
305 // TODO: Fill request struct fields.
306 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#GetOperatorRequest.
307 }
308 resp, err := c.GetOperator(ctx, req)
309 if err != nil {
310 // TODO: Handle error.
311 }
312 // TODO: Use resp.
313 _ = resp
314 }
315
316 func ExampleLiveVideoAnalyticsClient_GetProcess() {
317 ctx := context.Background()
318 // This snippet has been automatically generated and should be regarded as a code template only.
319 // It will require modifications to work:
320 // - It may require correct/in-range values for request initialization.
321 // - It may require specifying regional endpoints when creating the service client as shown in:
322 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
323 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
324 if err != nil {
325 // TODO: Handle error.
326 }
327 defer c.Close()
328
329 req := &visionaipb.GetProcessRequest{
330 // TODO: Fill request struct fields.
331 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#GetProcessRequest.
332 }
333 resp, err := c.GetProcess(ctx, req)
334 if err != nil {
335 // TODO: Handle error.
336 }
337 // TODO: Use resp.
338 _ = resp
339 }
340
341 func ExampleLiveVideoAnalyticsClient_ListAnalyses() {
342 ctx := context.Background()
343 // This snippet has been automatically generated and should be regarded as a code template only.
344 // It will require modifications to work:
345 // - It may require correct/in-range values for request initialization.
346 // - It may require specifying regional endpoints when creating the service client as shown in:
347 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
348 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
349 if err != nil {
350 // TODO: Handle error.
351 }
352 defer c.Close()
353
354 req := &visionaipb.ListAnalysesRequest{
355 // TODO: Fill request struct fields.
356 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListAnalysesRequest.
357 }
358 it := c.ListAnalyses(ctx, req)
359 for {
360 resp, err := it.Next()
361 if err == iterator.Done {
362 break
363 }
364 if err != nil {
365 // TODO: Handle error.
366 }
367 // TODO: Use resp.
368 _ = resp
369
370 // If you need to access the underlying RPC response,
371 // you can do so by casting the `Response` as below.
372 // Otherwise, remove this line. Only populated after
373 // first call to Next(). Not safe for concurrent access.
374 _ = it.Response.(*visionaipb.ListAnalysesResponse)
375 }
376 }
377
378 func ExampleLiveVideoAnalyticsClient_ListOperators() {
379 ctx := context.Background()
380 // This snippet has been automatically generated and should be regarded as a code template only.
381 // It will require modifications to work:
382 // - It may require correct/in-range values for request initialization.
383 // - It may require specifying regional endpoints when creating the service client as shown in:
384 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
385 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
386 if err != nil {
387 // TODO: Handle error.
388 }
389 defer c.Close()
390
391 req := &visionaipb.ListOperatorsRequest{
392 // TODO: Fill request struct fields.
393 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListOperatorsRequest.
394 }
395 it := c.ListOperators(ctx, req)
396 for {
397 resp, err := it.Next()
398 if err == iterator.Done {
399 break
400 }
401 if err != nil {
402 // TODO: Handle error.
403 }
404 // TODO: Use resp.
405 _ = resp
406
407 // If you need to access the underlying RPC response,
408 // you can do so by casting the `Response` as below.
409 // Otherwise, remove this line. Only populated after
410 // first call to Next(). Not safe for concurrent access.
411 _ = it.Response.(*visionaipb.ListOperatorsResponse)
412 }
413 }
414
415 func ExampleLiveVideoAnalyticsClient_ListProcesses() {
416 ctx := context.Background()
417 // This snippet has been automatically generated and should be regarded as a code template only.
418 // It will require modifications to work:
419 // - It may require correct/in-range values for request initialization.
420 // - It may require specifying regional endpoints when creating the service client as shown in:
421 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
422 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
423 if err != nil {
424 // TODO: Handle error.
425 }
426 defer c.Close()
427
428 req := &visionaipb.ListProcessesRequest{
429 // TODO: Fill request struct fields.
430 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListProcessesRequest.
431 }
432 it := c.ListProcesses(ctx, req)
433 for {
434 resp, err := it.Next()
435 if err == iterator.Done {
436 break
437 }
438 if err != nil {
439 // TODO: Handle error.
440 }
441 // TODO: Use resp.
442 _ = resp
443
444 // If you need to access the underlying RPC response,
445 // you can do so by casting the `Response` as below.
446 // Otherwise, remove this line. Only populated after
447 // first call to Next(). Not safe for concurrent access.
448 _ = it.Response.(*visionaipb.ListProcessesResponse)
449 }
450 }
451
452 func ExampleLiveVideoAnalyticsClient_ListPublicOperators() {
453 ctx := context.Background()
454 // This snippet has been automatically generated and should be regarded as a code template only.
455 // It will require modifications to work:
456 // - It may require correct/in-range values for request initialization.
457 // - It may require specifying regional endpoints when creating the service client as shown in:
458 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
459 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
460 if err != nil {
461 // TODO: Handle error.
462 }
463 defer c.Close()
464
465 req := &visionaipb.ListPublicOperatorsRequest{
466 // TODO: Fill request struct fields.
467 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListPublicOperatorsRequest.
468 }
469 it := c.ListPublicOperators(ctx, req)
470 for {
471 resp, err := it.Next()
472 if err == iterator.Done {
473 break
474 }
475 if err != nil {
476 // TODO: Handle error.
477 }
478 // TODO: Use resp.
479 _ = resp
480
481 // If you need to access the underlying RPC response,
482 // you can do so by casting the `Response` as below.
483 // Otherwise, remove this line. Only populated after
484 // first call to Next(). Not safe for concurrent access.
485 _ = it.Response.(*visionaipb.ListPublicOperatorsResponse)
486 }
487 }
488
489 func ExampleLiveVideoAnalyticsClient_ResolveOperatorInfo() {
490 ctx := context.Background()
491 // This snippet has been automatically generated and should be regarded as a code template only.
492 // It will require modifications to work:
493 // - It may require correct/in-range values for request initialization.
494 // - It may require specifying regional endpoints when creating the service client as shown in:
495 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
496 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
497 if err != nil {
498 // TODO: Handle error.
499 }
500 defer c.Close()
501
502 req := &visionaipb.ResolveOperatorInfoRequest{
503 // TODO: Fill request struct fields.
504 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ResolveOperatorInfoRequest.
505 }
506 resp, err := c.ResolveOperatorInfo(ctx, req)
507 if err != nil {
508 // TODO: Handle error.
509 }
510 // TODO: Use resp.
511 _ = resp
512 }
513
514 func ExampleLiveVideoAnalyticsClient_UpdateAnalysis() {
515 ctx := context.Background()
516 // This snippet has been automatically generated and should be regarded as a code template only.
517 // It will require modifications to work:
518 // - It may require correct/in-range values for request initialization.
519 // - It may require specifying regional endpoints when creating the service client as shown in:
520 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
521 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
522 if err != nil {
523 // TODO: Handle error.
524 }
525 defer c.Close()
526
527 req := &visionaipb.UpdateAnalysisRequest{
528 // TODO: Fill request struct fields.
529 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#UpdateAnalysisRequest.
530 }
531 op, err := c.UpdateAnalysis(ctx, req)
532 if err != nil {
533 // TODO: Handle error.
534 }
535
536 resp, err := op.Wait(ctx)
537 if err != nil {
538 // TODO: Handle error.
539 }
540 // TODO: Use resp.
541 _ = resp
542 }
543
544 func ExampleLiveVideoAnalyticsClient_UpdateOperator() {
545 ctx := context.Background()
546 // This snippet has been automatically generated and should be regarded as a code template only.
547 // It will require modifications to work:
548 // - It may require correct/in-range values for request initialization.
549 // - It may require specifying regional endpoints when creating the service client as shown in:
550 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
551 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
552 if err != nil {
553 // TODO: Handle error.
554 }
555 defer c.Close()
556
557 req := &visionaipb.UpdateOperatorRequest{
558 // TODO: Fill request struct fields.
559 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#UpdateOperatorRequest.
560 }
561 op, err := c.UpdateOperator(ctx, req)
562 if err != nil {
563 // TODO: Handle error.
564 }
565
566 resp, err := op.Wait(ctx)
567 if err != nil {
568 // TODO: Handle error.
569 }
570 // TODO: Use resp.
571 _ = resp
572 }
573
574 func ExampleLiveVideoAnalyticsClient_UpdateProcess() {
575 ctx := context.Background()
576 // This snippet has been automatically generated and should be regarded as a code template only.
577 // It will require modifications to work:
578 // - It may require correct/in-range values for request initialization.
579 // - It may require specifying regional endpoints when creating the service client as shown in:
580 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
581 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
582 if err != nil {
583 // TODO: Handle error.
584 }
585 defer c.Close()
586
587 req := &visionaipb.UpdateProcessRequest{
588 // TODO: Fill request struct fields.
589 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#UpdateProcessRequest.
590 }
591 op, err := c.UpdateProcess(ctx, req)
592 if err != nil {
593 // TODO: Handle error.
594 }
595
596 resp, err := op.Wait(ctx)
597 if err != nil {
598 // TODO: Handle error.
599 }
600 // TODO: Use resp.
601 _ = resp
602 }
603
604 func ExampleLiveVideoAnalyticsClient_CancelOperation() {
605 ctx := context.Background()
606 // This snippet has been automatically generated and should be regarded as a code template only.
607 // It will require modifications to work:
608 // - It may require correct/in-range values for request initialization.
609 // - It may require specifying regional endpoints when creating the service client as shown in:
610 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
611 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
612 if err != nil {
613 // TODO: Handle error.
614 }
615 defer c.Close()
616
617 req := &longrunningpb.CancelOperationRequest{
618 // TODO: Fill request struct fields.
619 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
620 }
621 err = c.CancelOperation(ctx, req)
622 if err != nil {
623 // TODO: Handle error.
624 }
625 }
626
627 func ExampleLiveVideoAnalyticsClient_DeleteOperation() {
628 ctx := context.Background()
629 // This snippet has been automatically generated and should be regarded as a code template only.
630 // It will require modifications to work:
631 // - It may require correct/in-range values for request initialization.
632 // - It may require specifying regional endpoints when creating the service client as shown in:
633 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
634 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
635 if err != nil {
636 // TODO: Handle error.
637 }
638 defer c.Close()
639
640 req := &longrunningpb.DeleteOperationRequest{
641 // TODO: Fill request struct fields.
642 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
643 }
644 err = c.DeleteOperation(ctx, req)
645 if err != nil {
646 // TODO: Handle error.
647 }
648 }
649
650 func ExampleLiveVideoAnalyticsClient_GetOperation() {
651 ctx := context.Background()
652 // This snippet has been automatically generated and should be regarded as a code template only.
653 // It will require modifications to work:
654 // - It may require correct/in-range values for request initialization.
655 // - It may require specifying regional endpoints when creating the service client as shown in:
656 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
657 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
658 if err != nil {
659 // TODO: Handle error.
660 }
661 defer c.Close()
662
663 req := &longrunningpb.GetOperationRequest{
664 // TODO: Fill request struct fields.
665 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
666 }
667 resp, err := c.GetOperation(ctx, req)
668 if err != nil {
669 // TODO: Handle error.
670 }
671 // TODO: Use resp.
672 _ = resp
673 }
674
675 func ExampleLiveVideoAnalyticsClient_ListOperations() {
676 ctx := context.Background()
677 // This snippet has been automatically generated and should be regarded as a code template only.
678 // It will require modifications to work:
679 // - It may require correct/in-range values for request initialization.
680 // - It may require specifying regional endpoints when creating the service client as shown in:
681 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
682 c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
683 if err != nil {
684 // TODO: Handle error.
685 }
686 defer c.Close()
687
688 req := &longrunningpb.ListOperationsRequest{
689 // TODO: Fill request struct fields.
690 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
691 }
692 it := c.ListOperations(ctx, req)
693 for {
694 resp, err := it.Next()
695 if err == iterator.Done {
696 break
697 }
698 if err != nil {
699 // TODO: Handle error.
700 }
701 // TODO: Use resp.
702 _ = resp
703
704 // If you need to access the underlying RPC response,
705 // you can do so by casting the `Response` as below.
706 // Otherwise, remove this line. Only populated after
707 // first call to Next(). Not safe for concurrent access.
708 _ = it.Response.(*longrunningpb.ListOperationsResponse)
709 }
710 }