Debian Codegraph @

cloudtasks/apiv2beta2/cloud_tasks_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 cloudtasks_test
18
19 import (
20 "context"
21
22 cloudtasks "cloud.google.com/go/cloudtasks/apiv2beta2"
23 cloudtaskspb "cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb"
24 iampb "cloud.google.com/go/iam/apiv1/iampb"
25 "google.golang.org/api/iterator"
26 locationpb "google.golang.org/genproto/googleapis/cloud/location"
27 )
28
29 func ExampleNewClient() {
30 ctx := context.Background()
31 // This snippet has been automatically generated and should be regarded as a code template only.
32 // It will require modifications to work:
33 // - It may require correct/in-range values for request initialization.
34 // - It may require specifying regional endpoints when creating the service client as shown in:
35 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
36 c, err := cloudtasks.NewClient(ctx)
37 if err != nil {
38 // TODO: Handle error.
39 }
40 defer c.Close()
41
42 // TODO: Use client.
43 _ = c
44 }
45
46 func ExampleNewRESTClient() {
47 ctx := context.Background()
48 // This snippet has been automatically generated and should be regarded as a code template only.
49 // It will require modifications to work:
50 // - It may require correct/in-range values for request initialization.
51 // - It may require specifying regional endpoints when creating the service client as shown in:
52 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
53 c, err := cloudtasks.NewRESTClient(ctx)
54 if err != nil {
55 // TODO: Handle error.
56 }
57 defer c.Close()
58
59 // TODO: Use client.
60 _ = c
61 }
62
63 func ExampleClient_AcknowledgeTask() {
64 ctx := context.Background()
65 // This snippet has been automatically generated and should be regarded as a code template only.
66 // It will require modifications to work:
67 // - It may require correct/in-range values for request initialization.
68 // - It may require specifying regional endpoints when creating the service client as shown in:
69 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
70 c, err := cloudtasks.NewClient(ctx)
71 if err != nil {
72 // TODO: Handle error.
73 }
74 defer c.Close()
75
76 req := &cloudtaskspb.AcknowledgeTaskRequest{
77 // TODO: Fill request struct fields.
78 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#AcknowledgeTaskRequest.
79 }
80 err = c.AcknowledgeTask(ctx, req)
81 if err != nil {
82 // TODO: Handle error.
83 }
84 }
85
86 func ExampleClient_CancelLease() {
87 ctx := context.Background()
88 // This snippet has been automatically generated and should be regarded as a code template only.
89 // It will require modifications to work:
90 // - It may require correct/in-range values for request initialization.
91 // - It may require specifying regional endpoints when creating the service client as shown in:
92 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
93 c, err := cloudtasks.NewClient(ctx)
94 if err != nil {
95 // TODO: Handle error.
96 }
97 defer c.Close()
98
99 req := &cloudtaskspb.CancelLeaseRequest{
100 // TODO: Fill request struct fields.
101 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#CancelLeaseRequest.
102 }
103 resp, err := c.CancelLease(ctx, req)
104 if err != nil {
105 // TODO: Handle error.
106 }
107 // TODO: Use resp.
108 _ = resp
109 }
110
111 func ExampleClient_CreateQueue() {
112 ctx := context.Background()
113 // This snippet has been automatically generated and should be regarded as a code template only.
114 // It will require modifications to work:
115 // - It may require correct/in-range values for request initialization.
116 // - It may require specifying regional endpoints when creating the service client as shown in:
117 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
118 c, err := cloudtasks.NewClient(ctx)
119 if err != nil {
120 // TODO: Handle error.
121 }
122 defer c.Close()
123
124 req := &cloudtaskspb.CreateQueueRequest{
125 // TODO: Fill request struct fields.
126 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#CreateQueueRequest.
127 }
128 resp, err := c.CreateQueue(ctx, req)
129 if err != nil {
130 // TODO: Handle error.
131 }
132 // TODO: Use resp.
133 _ = resp
134 }
135
136 func ExampleClient_CreateTask() {
137 ctx := context.Background()
138 // This snippet has been automatically generated and should be regarded as a code template only.
139 // It will require modifications to work:
140 // - It may require correct/in-range values for request initialization.
141 // - It may require specifying regional endpoints when creating the service client as shown in:
142 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
143 c, err := cloudtasks.NewClient(ctx)
144 if err != nil {
145 // TODO: Handle error.
146 }
147 defer c.Close()
148
149 req := &cloudtaskspb.CreateTaskRequest{
150 // TODO: Fill request struct fields.
151 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#CreateTaskRequest.
152 }
153 resp, err := c.CreateTask(ctx, req)
154 if err != nil {
155 // TODO: Handle error.
156 }
157 // TODO: Use resp.
158 _ = resp
159 }
160
161 func ExampleClient_DeleteQueue() {
162 ctx := context.Background()
163 // This snippet has been automatically generated and should be regarded as a code template only.
164 // It will require modifications to work:
165 // - It may require correct/in-range values for request initialization.
166 // - It may require specifying regional endpoints when creating the service client as shown in:
167 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
168 c, err := cloudtasks.NewClient(ctx)
169 if err != nil {
170 // TODO: Handle error.
171 }
172 defer c.Close()
173
174 req := &cloudtaskspb.DeleteQueueRequest{
175 // TODO: Fill request struct fields.
176 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#DeleteQueueRequest.
177 }
178 err = c.DeleteQueue(ctx, req)
179 if err != nil {
180 // TODO: Handle error.
181 }
182 }
183
184 func ExampleClient_DeleteTask() {
185 ctx := context.Background()
186 // This snippet has been automatically generated and should be regarded as a code template only.
187 // It will require modifications to work:
188 // - It may require correct/in-range values for request initialization.
189 // - It may require specifying regional endpoints when creating the service client as shown in:
190 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
191 c, err := cloudtasks.NewClient(ctx)
192 if err != nil {
193 // TODO: Handle error.
194 }
195 defer c.Close()
196
197 req := &cloudtaskspb.DeleteTaskRequest{
198 // TODO: Fill request struct fields.
199 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#DeleteTaskRequest.
200 }
201 err = c.DeleteTask(ctx, req)
202 if err != nil {
203 // TODO: Handle error.
204 }
205 }
206
207 func ExampleClient_GetIamPolicy() {
208 ctx := context.Background()
209 // This snippet has been automatically generated and should be regarded as a code template only.
210 // It will require modifications to work:
211 // - It may require correct/in-range values for request initialization.
212 // - It may require specifying regional endpoints when creating the service client as shown in:
213 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
214 c, err := cloudtasks.NewClient(ctx)
215 if err != nil {
216 // TODO: Handle error.
217 }
218 defer c.Close()
219
220 req := &iampb.GetIamPolicyRequest{
221 // TODO: Fill request struct fields.
222 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
223 }
224 resp, err := c.GetIamPolicy(ctx, req)
225 if err != nil {
226 // TODO: Handle error.
227 }
228 // TODO: Use resp.
229 _ = resp
230 }
231
232 func ExampleClient_GetQueue() {
233 ctx := context.Background()
234 // This snippet has been automatically generated and should be regarded as a code template only.
235 // It will require modifications to work:
236 // - It may require correct/in-range values for request initialization.
237 // - It may require specifying regional endpoints when creating the service client as shown in:
238 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
239 c, err := cloudtasks.NewClient(ctx)
240 if err != nil {
241 // TODO: Handle error.
242 }
243 defer c.Close()
244
245 req := &cloudtaskspb.GetQueueRequest{
246 // TODO: Fill request struct fields.
247 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#GetQueueRequest.
248 }
249 resp, err := c.GetQueue(ctx, req)
250 if err != nil {
251 // TODO: Handle error.
252 }
253 // TODO: Use resp.
254 _ = resp
255 }
256
257 func ExampleClient_GetTask() {
258 ctx := context.Background()
259 // This snippet has been automatically generated and should be regarded as a code template only.
260 // It will require modifications to work:
261 // - It may require correct/in-range values for request initialization.
262 // - It may require specifying regional endpoints when creating the service client as shown in:
263 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
264 c, err := cloudtasks.NewClient(ctx)
265 if err != nil {
266 // TODO: Handle error.
267 }
268 defer c.Close()
269
270 req := &cloudtaskspb.GetTaskRequest{
271 // TODO: Fill request struct fields.
272 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#GetTaskRequest.
273 }
274 resp, err := c.GetTask(ctx, req)
275 if err != nil {
276 // TODO: Handle error.
277 }
278 // TODO: Use resp.
279 _ = resp
280 }
281
282 func ExampleClient_LeaseTasks() {
283 ctx := context.Background()
284 // This snippet has been automatically generated and should be regarded as a code template only.
285 // It will require modifications to work:
286 // - It may require correct/in-range values for request initialization.
287 // - It may require specifying regional endpoints when creating the service client as shown in:
288 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
289 c, err := cloudtasks.NewClient(ctx)
290 if err != nil {
291 // TODO: Handle error.
292 }
293 defer c.Close()
294
295 req := &cloudtaskspb.LeaseTasksRequest{
296 // TODO: Fill request struct fields.
297 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#LeaseTasksRequest.
298 }
299 resp, err := c.LeaseTasks(ctx, req)
300 if err != nil {
301 // TODO: Handle error.
302 }
303 // TODO: Use resp.
304 _ = resp
305 }
306
307 func ExampleClient_ListQueues() {
308 ctx := context.Background()
309 // This snippet has been automatically generated and should be regarded as a code template only.
310 // It will require modifications to work:
311 // - It may require correct/in-range values for request initialization.
312 // - It may require specifying regional endpoints when creating the service client as shown in:
313 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
314 c, err := cloudtasks.NewClient(ctx)
315 if err != nil {
316 // TODO: Handle error.
317 }
318 defer c.Close()
319
320 req := &cloudtaskspb.ListQueuesRequest{
321 // TODO: Fill request struct fields.
322 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#ListQueuesRequest.
323 }
324 it := c.ListQueues(ctx, req)
325 for {
326 resp, err := it.Next()
327 if err == iterator.Done {
328 break
329 }
330 if err != nil {
331 // TODO: Handle error.
332 }
333 // TODO: Use resp.
334 _ = resp
335
336 // If you need to access the underlying RPC response,
337 // you can do so by casting the `Response` as below.
338 // Otherwise, remove this line. Only populated after
339 // first call to Next(). Not safe for concurrent access.
340 _ = it.Response.(*cloudtaskspb.ListQueuesResponse)
341 }
342 }
343
344 func ExampleClient_ListTasks() {
345 ctx := context.Background()
346 // This snippet has been automatically generated and should be regarded as a code template only.
347 // It will require modifications to work:
348 // - It may require correct/in-range values for request initialization.
349 // - It may require specifying regional endpoints when creating the service client as shown in:
350 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
351 c, err := cloudtasks.NewClient(ctx)
352 if err != nil {
353 // TODO: Handle error.
354 }
355 defer c.Close()
356
357 req := &cloudtaskspb.ListTasksRequest{
358 // TODO: Fill request struct fields.
359 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#ListTasksRequest.
360 }
361 it := c.ListTasks(ctx, req)
362 for {
363 resp, err := it.Next()
364 if err == iterator.Done {
365 break
366 }
367 if err != nil {
368 // TODO: Handle error.
369 }
370 // TODO: Use resp.
371 _ = resp
372
373 // If you need to access the underlying RPC response,
374 // you can do so by casting the `Response` as below.
375 // Otherwise, remove this line. Only populated after
376 // first call to Next(). Not safe for concurrent access.
377 _ = it.Response.(*cloudtaskspb.ListTasksResponse)
378 }
379 }
380
381 func ExampleClient_PauseQueue() {
382 ctx := context.Background()
383 // This snippet has been automatically generated and should be regarded as a code template only.
384 // It will require modifications to work:
385 // - It may require correct/in-range values for request initialization.
386 // - It may require specifying regional endpoints when creating the service client as shown in:
387 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
388 c, err := cloudtasks.NewClient(ctx)
389 if err != nil {
390 // TODO: Handle error.
391 }
392 defer c.Close()
393
394 req := &cloudtaskspb.PauseQueueRequest{
395 // TODO: Fill request struct fields.
396 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#PauseQueueRequest.
397 }
398 resp, err := c.PauseQueue(ctx, req)
399 if err != nil {
400 // TODO: Handle error.
401 }
402 // TODO: Use resp.
403 _ = resp
404 }
405
406 func ExampleClient_PurgeQueue() {
407 ctx := context.Background()
408 // This snippet has been automatically generated and should be regarded as a code template only.
409 // It will require modifications to work:
410 // - It may require correct/in-range values for request initialization.
411 // - It may require specifying regional endpoints when creating the service client as shown in:
412 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
413 c, err := cloudtasks.NewClient(ctx)
414 if err != nil {
415 // TODO: Handle error.
416 }
417 defer c.Close()
418
419 req := &cloudtaskspb.PurgeQueueRequest{
420 // TODO: Fill request struct fields.
421 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#PurgeQueueRequest.
422 }
423 resp, err := c.PurgeQueue(ctx, req)
424 if err != nil {
425 // TODO: Handle error.
426 }
427 // TODO: Use resp.
428 _ = resp
429 }
430
431 func ExampleClient_RenewLease() {
432 ctx := context.Background()
433 // This snippet has been automatically generated and should be regarded as a code template only.
434 // It will require modifications to work:
435 // - It may require correct/in-range values for request initialization.
436 // - It may require specifying regional endpoints when creating the service client as shown in:
437 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
438 c, err := cloudtasks.NewClient(ctx)
439 if err != nil {
440 // TODO: Handle error.
441 }
442 defer c.Close()
443
444 req := &cloudtaskspb.RenewLeaseRequest{
445 // TODO: Fill request struct fields.
446 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#RenewLeaseRequest.
447 }
448 resp, err := c.RenewLease(ctx, req)
449 if err != nil {
450 // TODO: Handle error.
451 }
452 // TODO: Use resp.
453 _ = resp
454 }
455
456 func ExampleClient_ResumeQueue() {
457 ctx := context.Background()
458 // This snippet has been automatically generated and should be regarded as a code template only.
459 // It will require modifications to work:
460 // - It may require correct/in-range values for request initialization.
461 // - It may require specifying regional endpoints when creating the service client as shown in:
462 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
463 c, err := cloudtasks.NewClient(ctx)
464 if err != nil {
465 // TODO: Handle error.
466 }
467 defer c.Close()
468
469 req := &cloudtaskspb.ResumeQueueRequest{
470 // TODO: Fill request struct fields.
471 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#ResumeQueueRequest.
472 }
473 resp, err := c.ResumeQueue(ctx, req)
474 if err != nil {
475 // TODO: Handle error.
476 }
477 // TODO: Use resp.
478 _ = resp
479 }
480
481 func ExampleClient_RunTask() {
482 ctx := context.Background()
483 // This snippet has been automatically generated and should be regarded as a code template only.
484 // It will require modifications to work:
485 // - It may require correct/in-range values for request initialization.
486 // - It may require specifying regional endpoints when creating the service client as shown in:
487 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
488 c, err := cloudtasks.NewClient(ctx)
489 if err != nil {
490 // TODO: Handle error.
491 }
492 defer c.Close()
493
494 req := &cloudtaskspb.RunTaskRequest{
495 // TODO: Fill request struct fields.
496 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#RunTaskRequest.
497 }
498 resp, err := c.RunTask(ctx, req)
499 if err != nil {
500 // TODO: Handle error.
501 }
502 // TODO: Use resp.
503 _ = resp
504 }
505
506 func ExampleClient_SetIamPolicy() {
507 ctx := context.Background()
508 // This snippet has been automatically generated and should be regarded as a code template only.
509 // It will require modifications to work:
510 // - It may require correct/in-range values for request initialization.
511 // - It may require specifying regional endpoints when creating the service client as shown in:
512 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
513 c, err := cloudtasks.NewClient(ctx)
514 if err != nil {
515 // TODO: Handle error.
516 }
517 defer c.Close()
518
519 req := &iampb.SetIamPolicyRequest{
520 // TODO: Fill request struct fields.
521 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
522 }
523 resp, err := c.SetIamPolicy(ctx, req)
524 if err != nil {
525 // TODO: Handle error.
526 }
527 // TODO: Use resp.
528 _ = resp
529 }
530
531 func ExampleClient_TestIamPermissions() {
532 ctx := context.Background()
533 // This snippet has been automatically generated and should be regarded as a code template only.
534 // It will require modifications to work:
535 // - It may require correct/in-range values for request initialization.
536 // - It may require specifying regional endpoints when creating the service client as shown in:
537 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
538 c, err := cloudtasks.NewClient(ctx)
539 if err != nil {
540 // TODO: Handle error.
541 }
542 defer c.Close()
543
544 req := &iampb.TestIamPermissionsRequest{
545 // TODO: Fill request struct fields.
546 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
547 }
548 resp, err := c.TestIamPermissions(ctx, req)
549 if err != nil {
550 // TODO: Handle error.
551 }
552 // TODO: Use resp.
553 _ = resp
554 }
555
556 func ExampleClient_UpdateQueue() {
557 ctx := context.Background()
558 // This snippet has been automatically generated and should be regarded as a code template only.
559 // It will require modifications to work:
560 // - It may require correct/in-range values for request initialization.
561 // - It may require specifying regional endpoints when creating the service client as shown in:
562 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
563 c, err := cloudtasks.NewClient(ctx)
564 if err != nil {
565 // TODO: Handle error.
566 }
567 defer c.Close()
568
569 req := &cloudtaskspb.UpdateQueueRequest{
570 // TODO: Fill request struct fields.
571 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#UpdateQueueRequest.
572 }
573 resp, err := c.UpdateQueue(ctx, req)
574 if err != nil {
575 // TODO: Handle error.
576 }
577 // TODO: Use resp.
578 _ = resp
579 }
580
581 func ExampleClient_UploadQueueYaml() {
582 ctx := context.Background()
583 // This snippet has been automatically generated and should be regarded as a code template only.
584 // It will require modifications to work:
585 // - It may require correct/in-range values for request initialization.
586 // - It may require specifying regional endpoints when creating the service client as shown in:
587 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
588 c, err := cloudtasks.NewClient(ctx)
589 if err != nil {
590 // TODO: Handle error.
591 }
592 defer c.Close()
593
594 req := &cloudtaskspb.UploadQueueYamlRequest{
595 // TODO: Fill request struct fields.
596 // See https://pkg.go.dev/cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb#UploadQueueYamlRequest.
597 }
598 err = c.UploadQueueYaml(ctx, req)
599 if err != nil {
600 // TODO: Handle error.
601 }
602 }
603
604 func ExampleClient_GetLocation() {
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 := cloudtasks.NewClient(ctx)
612 if err != nil {
613 // TODO: Handle error.
614 }
615 defer c.Close()
616
617 req := &locationpb.GetLocationRequest{
618 // TODO: Fill request struct fields.
619 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
620 }
621 resp, err := c.GetLocation(ctx, req)
622 if err != nil {
623 // TODO: Handle error.
624 }
625 // TODO: Use resp.
626 _ = resp
627 }
628
629 func ExampleClient_ListLocations() {
630 ctx := context.Background()
631 // This snippet has been automatically generated and should be regarded as a code template only.
632 // It will require modifications to work:
633 // - It may require correct/in-range values for request initialization.
634 // - It may require specifying regional endpoints when creating the service client as shown in:
635 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
636 c, err := cloudtasks.NewClient(ctx)
637 if err != nil {
638 // TODO: Handle error.
639 }
640 defer c.Close()
641
642 req := &locationpb.ListLocationsRequest{
643 // TODO: Fill request struct fields.
644 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
645 }
646 it := c.ListLocations(ctx, req)
647 for {
648 resp, err := it.Next()
649 if err == iterator.Done {
650 break
651 }
652 if err != nil {
653 // TODO: Handle error.
654 }
655 // TODO: Use resp.
656 _ = resp
657
658 // If you need to access the underlying RPC response,
659 // you can do so by casting the `Response` as below.
660 // Otherwise, remove this line. Only populated after
661 // first call to Next(). Not safe for concurrent access.
662 _ = it.Response.(*locationpb.ListLocationsResponse)
663 }
664 }