Debian Codegraph @

alloydb/apiv1/alloydb_admin_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 alloydb_test
18
19 import (
20 "context"
21
22 alloydb "cloud.google.com/go/alloydb/apiv1"
23 alloydbpb "cloud.google.com/go/alloydb/apiv1/alloydbpb"
24 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
25 "google.golang.org/api/iterator"
26 locationpb "google.golang.org/genproto/googleapis/cloud/location"
27 )
28
29 func ExampleNewAlloyDBAdminClient() {
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 := alloydb.NewAlloyDBAdminClient(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 ExampleNewAlloyDBAdminRESTClient() {
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 := alloydb.NewAlloyDBAdminRESTClient(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 ExampleAlloyDBAdminClient_BatchCreateInstances() {
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 := alloydb.NewAlloyDBAdminClient(ctx)
71 if err != nil {
72 // TODO: Handle error.
73 }
74 defer c.Close()
75
76 req := &alloydbpb.BatchCreateInstancesRequest{
77 // TODO: Fill request struct fields.
78 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#BatchCreateInstancesRequest.
79 }
80 op, err := c.BatchCreateInstances(ctx, req)
81 if err != nil {
82 // TODO: Handle error.
83 }
84
85 resp, err := op.Wait(ctx)
86 if err != nil {
87 // TODO: Handle error.
88 }
89 // TODO: Use resp.
90 _ = resp
91 }
92
93 func ExampleAlloyDBAdminClient_CreateBackup() {
94 ctx := context.Background()
95 // This snippet has been automatically generated and should be regarded as a code template only.
96 // It will require modifications to work:
97 // - It may require correct/in-range values for request initialization.
98 // - It may require specifying regional endpoints when creating the service client as shown in:
99 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
100 c, err := alloydb.NewAlloyDBAdminClient(ctx)
101 if err != nil {
102 // TODO: Handle error.
103 }
104 defer c.Close()
105
106 req := &alloydbpb.CreateBackupRequest{
107 // TODO: Fill request struct fields.
108 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#CreateBackupRequest.
109 }
110 op, err := c.CreateBackup(ctx, req)
111 if err != nil {
112 // TODO: Handle error.
113 }
114
115 resp, err := op.Wait(ctx)
116 if err != nil {
117 // TODO: Handle error.
118 }
119 // TODO: Use resp.
120 _ = resp
121 }
122
123 func ExampleAlloyDBAdminClient_CreateCluster() {
124 ctx := context.Background()
125 // This snippet has been automatically generated and should be regarded as a code template only.
126 // It will require modifications to work:
127 // - It may require correct/in-range values for request initialization.
128 // - It may require specifying regional endpoints when creating the service client as shown in:
129 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
130 c, err := alloydb.NewAlloyDBAdminClient(ctx)
131 if err != nil {
132 // TODO: Handle error.
133 }
134 defer c.Close()
135
136 req := &alloydbpb.CreateClusterRequest{
137 // TODO: Fill request struct fields.
138 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#CreateClusterRequest.
139 }
140 op, err := c.CreateCluster(ctx, req)
141 if err != nil {
142 // TODO: Handle error.
143 }
144
145 resp, err := op.Wait(ctx)
146 if err != nil {
147 // TODO: Handle error.
148 }
149 // TODO: Use resp.
150 _ = resp
151 }
152
153 func ExampleAlloyDBAdminClient_CreateInstance() {
154 ctx := context.Background()
155 // This snippet has been automatically generated and should be regarded as a code template only.
156 // It will require modifications to work:
157 // - It may require correct/in-range values for request initialization.
158 // - It may require specifying regional endpoints when creating the service client as shown in:
159 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
160 c, err := alloydb.NewAlloyDBAdminClient(ctx)
161 if err != nil {
162 // TODO: Handle error.
163 }
164 defer c.Close()
165
166 req := &alloydbpb.CreateInstanceRequest{
167 // TODO: Fill request struct fields.
168 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#CreateInstanceRequest.
169 }
170 op, err := c.CreateInstance(ctx, req)
171 if err != nil {
172 // TODO: Handle error.
173 }
174
175 resp, err := op.Wait(ctx)
176 if err != nil {
177 // TODO: Handle error.
178 }
179 // TODO: Use resp.
180 _ = resp
181 }
182
183 func ExampleAlloyDBAdminClient_CreateSecondaryCluster() {
184 ctx := context.Background()
185 // This snippet has been automatically generated and should be regarded as a code template only.
186 // It will require modifications to work:
187 // - It may require correct/in-range values for request initialization.
188 // - It may require specifying regional endpoints when creating the service client as shown in:
189 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
190 c, err := alloydb.NewAlloyDBAdminClient(ctx)
191 if err != nil {
192 // TODO: Handle error.
193 }
194 defer c.Close()
195
196 req := &alloydbpb.CreateSecondaryClusterRequest{
197 // TODO: Fill request struct fields.
198 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#CreateSecondaryClusterRequest.
199 }
200 op, err := c.CreateSecondaryCluster(ctx, req)
201 if err != nil {
202 // TODO: Handle error.
203 }
204
205 resp, err := op.Wait(ctx)
206 if err != nil {
207 // TODO: Handle error.
208 }
209 // TODO: Use resp.
210 _ = resp
211 }
212
213 func ExampleAlloyDBAdminClient_CreateSecondaryInstance() {
214 ctx := context.Background()
215 // This snippet has been automatically generated and should be regarded as a code template only.
216 // It will require modifications to work:
217 // - It may require correct/in-range values for request initialization.
218 // - It may require specifying regional endpoints when creating the service client as shown in:
219 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
220 c, err := alloydb.NewAlloyDBAdminClient(ctx)
221 if err != nil {
222 // TODO: Handle error.
223 }
224 defer c.Close()
225
226 req := &alloydbpb.CreateSecondaryInstanceRequest{
227 // TODO: Fill request struct fields.
228 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#CreateSecondaryInstanceRequest.
229 }
230 op, err := c.CreateSecondaryInstance(ctx, req)
231 if err != nil {
232 // TODO: Handle error.
233 }
234
235 resp, err := op.Wait(ctx)
236 if err != nil {
237 // TODO: Handle error.
238 }
239 // TODO: Use resp.
240 _ = resp
241 }
242
243 func ExampleAlloyDBAdminClient_CreateUser() {
244 ctx := context.Background()
245 // This snippet has been automatically generated and should be regarded as a code template only.
246 // It will require modifications to work:
247 // - It may require correct/in-range values for request initialization.
248 // - It may require specifying regional endpoints when creating the service client as shown in:
249 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
250 c, err := alloydb.NewAlloyDBAdminClient(ctx)
251 if err != nil {
252 // TODO: Handle error.
253 }
254 defer c.Close()
255
256 req := &alloydbpb.CreateUserRequest{
257 // TODO: Fill request struct fields.
258 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#CreateUserRequest.
259 }
260 resp, err := c.CreateUser(ctx, req)
261 if err != nil {
262 // TODO: Handle error.
263 }
264 // TODO: Use resp.
265 _ = resp
266 }
267
268 func ExampleAlloyDBAdminClient_DeleteBackup() {
269 ctx := context.Background()
270 // This snippet has been automatically generated and should be regarded as a code template only.
271 // It will require modifications to work:
272 // - It may require correct/in-range values for request initialization.
273 // - It may require specifying regional endpoints when creating the service client as shown in:
274 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
275 c, err := alloydb.NewAlloyDBAdminClient(ctx)
276 if err != nil {
277 // TODO: Handle error.
278 }
279 defer c.Close()
280
281 req := &alloydbpb.DeleteBackupRequest{
282 // TODO: Fill request struct fields.
283 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#DeleteBackupRequest.
284 }
285 op, err := c.DeleteBackup(ctx, req)
286 if err != nil {
287 // TODO: Handle error.
288 }
289
290 err = op.Wait(ctx)
291 if err != nil {
292 // TODO: Handle error.
293 }
294 }
295
296 func ExampleAlloyDBAdminClient_DeleteCluster() {
297 ctx := context.Background()
298 // This snippet has been automatically generated and should be regarded as a code template only.
299 // It will require modifications to work:
300 // - It may require correct/in-range values for request initialization.
301 // - It may require specifying regional endpoints when creating the service client as shown in:
302 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
303 c, err := alloydb.NewAlloyDBAdminClient(ctx)
304 if err != nil {
305 // TODO: Handle error.
306 }
307 defer c.Close()
308
309 req := &alloydbpb.DeleteClusterRequest{
310 // TODO: Fill request struct fields.
311 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#DeleteClusterRequest.
312 }
313 op, err := c.DeleteCluster(ctx, req)
314 if err != nil {
315 // TODO: Handle error.
316 }
317
318 err = op.Wait(ctx)
319 if err != nil {
320 // TODO: Handle error.
321 }
322 }
323
324 func ExampleAlloyDBAdminClient_DeleteInstance() {
325 ctx := context.Background()
326 // This snippet has been automatically generated and should be regarded as a code template only.
327 // It will require modifications to work:
328 // - It may require correct/in-range values for request initialization.
329 // - It may require specifying regional endpoints when creating the service client as shown in:
330 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
331 c, err := alloydb.NewAlloyDBAdminClient(ctx)
332 if err != nil {
333 // TODO: Handle error.
334 }
335 defer c.Close()
336
337 req := &alloydbpb.DeleteInstanceRequest{
338 // TODO: Fill request struct fields.
339 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#DeleteInstanceRequest.
340 }
341 op, err := c.DeleteInstance(ctx, req)
342 if err != nil {
343 // TODO: Handle error.
344 }
345
346 err = op.Wait(ctx)
347 if err != nil {
348 // TODO: Handle error.
349 }
350 }
351
352 func ExampleAlloyDBAdminClient_DeleteUser() {
353 ctx := context.Background()
354 // This snippet has been automatically generated and should be regarded as a code template only.
355 // It will require modifications to work:
356 // - It may require correct/in-range values for request initialization.
357 // - It may require specifying regional endpoints when creating the service client as shown in:
358 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
359 c, err := alloydb.NewAlloyDBAdminClient(ctx)
360 if err != nil {
361 // TODO: Handle error.
362 }
363 defer c.Close()
364
365 req := &alloydbpb.DeleteUserRequest{
366 // TODO: Fill request struct fields.
367 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#DeleteUserRequest.
368 }
369 err = c.DeleteUser(ctx, req)
370 if err != nil {
371 // TODO: Handle error.
372 }
373 }
374
375 func ExampleAlloyDBAdminClient_ExecuteSql() {
376 ctx := context.Background()
377 // This snippet has been automatically generated and should be regarded as a code template only.
378 // It will require modifications to work:
379 // - It may require correct/in-range values for request initialization.
380 // - It may require specifying regional endpoints when creating the service client as shown in:
381 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
382 c, err := alloydb.NewAlloyDBAdminClient(ctx)
383 if err != nil {
384 // TODO: Handle error.
385 }
386 defer c.Close()
387
388 req := &alloydbpb.ExecuteSqlRequest{
389 // TODO: Fill request struct fields.
390 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#ExecuteSqlRequest.
391 }
392 resp, err := c.ExecuteSql(ctx, req)
393 if err != nil {
394 // TODO: Handle error.
395 }
396 // TODO: Use resp.
397 _ = resp
398 }
399
400 func ExampleAlloyDBAdminClient_ExportCluster() {
401 ctx := context.Background()
402 // This snippet has been automatically generated and should be regarded as a code template only.
403 // It will require modifications to work:
404 // - It may require correct/in-range values for request initialization.
405 // - It may require specifying regional endpoints when creating the service client as shown in:
406 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
407 c, err := alloydb.NewAlloyDBAdminClient(ctx)
408 if err != nil {
409 // TODO: Handle error.
410 }
411 defer c.Close()
412
413 req := &alloydbpb.ExportClusterRequest{
414 // TODO: Fill request struct fields.
415 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#ExportClusterRequest.
416 }
417 op, err := c.ExportCluster(ctx, req)
418 if err != nil {
419 // TODO: Handle error.
420 }
421
422 resp, err := op.Wait(ctx)
423 if err != nil {
424 // TODO: Handle error.
425 }
426 // TODO: Use resp.
427 _ = resp
428 }
429
430 func ExampleAlloyDBAdminClient_FailoverInstance() {
431 ctx := context.Background()
432 // This snippet has been automatically generated and should be regarded as a code template only.
433 // It will require modifications to work:
434 // - It may require correct/in-range values for request initialization.
435 // - It may require specifying regional endpoints when creating the service client as shown in:
436 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
437 c, err := alloydb.NewAlloyDBAdminClient(ctx)
438 if err != nil {
439 // TODO: Handle error.
440 }
441 defer c.Close()
442
443 req := &alloydbpb.FailoverInstanceRequest{
444 // TODO: Fill request struct fields.
445 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#FailoverInstanceRequest.
446 }
447 op, err := c.FailoverInstance(ctx, req)
448 if err != nil {
449 // TODO: Handle error.
450 }
451
452 resp, err := op.Wait(ctx)
453 if err != nil {
454 // TODO: Handle error.
455 }
456 // TODO: Use resp.
457 _ = resp
458 }
459
460 func ExampleAlloyDBAdminClient_GenerateClientCertificate() {
461 ctx := context.Background()
462 // This snippet has been automatically generated and should be regarded as a code template only.
463 // It will require modifications to work:
464 // - It may require correct/in-range values for request initialization.
465 // - It may require specifying regional endpoints when creating the service client as shown in:
466 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
467 c, err := alloydb.NewAlloyDBAdminClient(ctx)
468 if err != nil {
469 // TODO: Handle error.
470 }
471 defer c.Close()
472
473 req := &alloydbpb.GenerateClientCertificateRequest{
474 // TODO: Fill request struct fields.
475 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#GenerateClientCertificateRequest.
476 }
477 resp, err := c.GenerateClientCertificate(ctx, req)
478 if err != nil {
479 // TODO: Handle error.
480 }
481 // TODO: Use resp.
482 _ = resp
483 }
484
485 func ExampleAlloyDBAdminClient_GetBackup() {
486 ctx := context.Background()
487 // This snippet has been automatically generated and should be regarded as a code template only.
488 // It will require modifications to work:
489 // - It may require correct/in-range values for request initialization.
490 // - It may require specifying regional endpoints when creating the service client as shown in:
491 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
492 c, err := alloydb.NewAlloyDBAdminClient(ctx)
493 if err != nil {
494 // TODO: Handle error.
495 }
496 defer c.Close()
497
498 req := &alloydbpb.GetBackupRequest{
499 // TODO: Fill request struct fields.
500 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#GetBackupRequest.
501 }
502 resp, err := c.GetBackup(ctx, req)
503 if err != nil {
504 // TODO: Handle error.
505 }
506 // TODO: Use resp.
507 _ = resp
508 }
509
510 func ExampleAlloyDBAdminClient_GetCluster() {
511 ctx := context.Background()
512 // This snippet has been automatically generated and should be regarded as a code template only.
513 // It will require modifications to work:
514 // - It may require correct/in-range values for request initialization.
515 // - It may require specifying regional endpoints when creating the service client as shown in:
516 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
517 c, err := alloydb.NewAlloyDBAdminClient(ctx)
518 if err != nil {
519 // TODO: Handle error.
520 }
521 defer c.Close()
522
523 req := &alloydbpb.GetClusterRequest{
524 // TODO: Fill request struct fields.
525 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#GetClusterRequest.
526 }
527 resp, err := c.GetCluster(ctx, req)
528 if err != nil {
529 // TODO: Handle error.
530 }
531 // TODO: Use resp.
532 _ = resp
533 }
534
535 func ExampleAlloyDBAdminClient_GetConnectionInfo() {
536 ctx := context.Background()
537 // This snippet has been automatically generated and should be regarded as a code template only.
538 // It will require modifications to work:
539 // - It may require correct/in-range values for request initialization.
540 // - It may require specifying regional endpoints when creating the service client as shown in:
541 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
542 c, err := alloydb.NewAlloyDBAdminClient(ctx)
543 if err != nil {
544 // TODO: Handle error.
545 }
546 defer c.Close()
547
548 req := &alloydbpb.GetConnectionInfoRequest{
549 // TODO: Fill request struct fields.
550 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#GetConnectionInfoRequest.
551 }
552 resp, err := c.GetConnectionInfo(ctx, req)
553 if err != nil {
554 // TODO: Handle error.
555 }
556 // TODO: Use resp.
557 _ = resp
558 }
559
560 func ExampleAlloyDBAdminClient_GetInstance() {
561 ctx := context.Background()
562 // This snippet has been automatically generated and should be regarded as a code template only.
563 // It will require modifications to work:
564 // - It may require correct/in-range values for request initialization.
565 // - It may require specifying regional endpoints when creating the service client as shown in:
566 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
567 c, err := alloydb.NewAlloyDBAdminClient(ctx)
568 if err != nil {
569 // TODO: Handle error.
570 }
571 defer c.Close()
572
573 req := &alloydbpb.GetInstanceRequest{
574 // TODO: Fill request struct fields.
575 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#GetInstanceRequest.
576 }
577 resp, err := c.GetInstance(ctx, req)
578 if err != nil {
579 // TODO: Handle error.
580 }
581 // TODO: Use resp.
582 _ = resp
583 }
584
585 func ExampleAlloyDBAdminClient_GetUser() {
586 ctx := context.Background()
587 // This snippet has been automatically generated and should be regarded as a code template only.
588 // It will require modifications to work:
589 // - It may require correct/in-range values for request initialization.
590 // - It may require specifying regional endpoints when creating the service client as shown in:
591 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
592 c, err := alloydb.NewAlloyDBAdminClient(ctx)
593 if err != nil {
594 // TODO: Handle error.
595 }
596 defer c.Close()
597
598 req := &alloydbpb.GetUserRequest{
599 // TODO: Fill request struct fields.
600 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#GetUserRequest.
601 }
602 resp, err := c.GetUser(ctx, req)
603 if err != nil {
604 // TODO: Handle error.
605 }
606 // TODO: Use resp.
607 _ = resp
608 }
609
610 func ExampleAlloyDBAdminClient_ImportCluster() {
611 ctx := context.Background()
612 // This snippet has been automatically generated and should be regarded as a code template only.
613 // It will require modifications to work:
614 // - It may require correct/in-range values for request initialization.
615 // - It may require specifying regional endpoints when creating the service client as shown in:
616 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
617 c, err := alloydb.NewAlloyDBAdminClient(ctx)
618 if err != nil {
619 // TODO: Handle error.
620 }
621 defer c.Close()
622
623 req := &alloydbpb.ImportClusterRequest{
624 // TODO: Fill request struct fields.
625 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#ImportClusterRequest.
626 }
627 op, err := c.ImportCluster(ctx, req)
628 if err != nil {
629 // TODO: Handle error.
630 }
631
632 resp, err := op.Wait(ctx)
633 if err != nil {
634 // TODO: Handle error.
635 }
636 // TODO: Use resp.
637 _ = resp
638 }
639
640 func ExampleAlloyDBAdminClient_InjectFault() {
641 ctx := context.Background()
642 // This snippet has been automatically generated and should be regarded as a code template only.
643 // It will require modifications to work:
644 // - It may require correct/in-range values for request initialization.
645 // - It may require specifying regional endpoints when creating the service client as shown in:
646 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
647 c, err := alloydb.NewAlloyDBAdminClient(ctx)
648 if err != nil {
649 // TODO: Handle error.
650 }
651 defer c.Close()
652
653 req := &alloydbpb.InjectFaultRequest{
654 // TODO: Fill request struct fields.
655 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#InjectFaultRequest.
656 }
657 op, err := c.InjectFault(ctx, req)
658 if err != nil {
659 // TODO: Handle error.
660 }
661
662 resp, err := op.Wait(ctx)
663 if err != nil {
664 // TODO: Handle error.
665 }
666 // TODO: Use resp.
667 _ = resp
668 }
669
670 func ExampleAlloyDBAdminClient_ListBackups() {
671 ctx := context.Background()
672 // This snippet has been automatically generated and should be regarded as a code template only.
673 // It will require modifications to work:
674 // - It may require correct/in-range values for request initialization.
675 // - It may require specifying regional endpoints when creating the service client as shown in:
676 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
677 c, err := alloydb.NewAlloyDBAdminClient(ctx)
678 if err != nil {
679 // TODO: Handle error.
680 }
681 defer c.Close()
682
683 req := &alloydbpb.ListBackupsRequest{
684 // TODO: Fill request struct fields.
685 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#ListBackupsRequest.
686 }
687 it := c.ListBackups(ctx, req)
688 for {
689 resp, err := it.Next()
690 if err == iterator.Done {
691 break
692 }
693 if err != nil {
694 // TODO: Handle error.
695 }
696 // TODO: Use resp.
697 _ = resp
698
699 // If you need to access the underlying RPC response,
700 // you can do so by casting the `Response` as below.
701 // Otherwise, remove this line. Only populated after
702 // first call to Next(). Not safe for concurrent access.
703 _ = it.Response.(*alloydbpb.ListBackupsResponse)
704 }
705 }
706
707 func ExampleAlloyDBAdminClient_ListClusters() {
708 ctx := context.Background()
709 // This snippet has been automatically generated and should be regarded as a code template only.
710 // It will require modifications to work:
711 // - It may require correct/in-range values for request initialization.
712 // - It may require specifying regional endpoints when creating the service client as shown in:
713 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
714 c, err := alloydb.NewAlloyDBAdminClient(ctx)
715 if err != nil {
716 // TODO: Handle error.
717 }
718 defer c.Close()
719
720 req := &alloydbpb.ListClustersRequest{
721 // TODO: Fill request struct fields.
722 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#ListClustersRequest.
723 }
724 it := c.ListClusters(ctx, req)
725 for {
726 resp, err := it.Next()
727 if err == iterator.Done {
728 break
729 }
730 if err != nil {
731 // TODO: Handle error.
732 }
733 // TODO: Use resp.
734 _ = resp
735
736 // If you need to access the underlying RPC response,
737 // you can do so by casting the `Response` as below.
738 // Otherwise, remove this line. Only populated after
739 // first call to Next(). Not safe for concurrent access.
740 _ = it.Response.(*alloydbpb.ListClustersResponse)
741 }
742 }
743
744 func ExampleAlloyDBAdminClient_ListDatabases() {
745 ctx := context.Background()
746 // This snippet has been automatically generated and should be regarded as a code template only.
747 // It will require modifications to work:
748 // - It may require correct/in-range values for request initialization.
749 // - It may require specifying regional endpoints when creating the service client as shown in:
750 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
751 c, err := alloydb.NewAlloyDBAdminClient(ctx)
752 if err != nil {
753 // TODO: Handle error.
754 }
755 defer c.Close()
756
757 req := &alloydbpb.ListDatabasesRequest{
758 // TODO: Fill request struct fields.
759 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#ListDatabasesRequest.
760 }
761 it := c.ListDatabases(ctx, req)
762 for {
763 resp, err := it.Next()
764 if err == iterator.Done {
765 break
766 }
767 if err != nil {
768 // TODO: Handle error.
769 }
770 // TODO: Use resp.
771 _ = resp
772
773 // If you need to access the underlying RPC response,
774 // you can do so by casting the `Response` as below.
775 // Otherwise, remove this line. Only populated after
776 // first call to Next(). Not safe for concurrent access.
777 _ = it.Response.(*alloydbpb.ListDatabasesResponse)
778 }
779 }
780
781 func ExampleAlloyDBAdminClient_ListInstances() {
782 ctx := context.Background()
783 // This snippet has been automatically generated and should be regarded as a code template only.
784 // It will require modifications to work:
785 // - It may require correct/in-range values for request initialization.
786 // - It may require specifying regional endpoints when creating the service client as shown in:
787 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
788 c, err := alloydb.NewAlloyDBAdminClient(ctx)
789 if err != nil {
790 // TODO: Handle error.
791 }
792 defer c.Close()
793
794 req := &alloydbpb.ListInstancesRequest{
795 // TODO: Fill request struct fields.
796 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#ListInstancesRequest.
797 }
798 it := c.ListInstances(ctx, req)
799 for {
800 resp, err := it.Next()
801 if err == iterator.Done {
802 break
803 }
804 if err != nil {
805 // TODO: Handle error.
806 }
807 // TODO: Use resp.
808 _ = resp
809
810 // If you need to access the underlying RPC response,
811 // you can do so by casting the `Response` as below.
812 // Otherwise, remove this line. Only populated after
813 // first call to Next(). Not safe for concurrent access.
814 _ = it.Response.(*alloydbpb.ListInstancesResponse)
815 }
816 }
817
818 func ExampleAlloyDBAdminClient_ListSupportedDatabaseFlags() {
819 ctx := context.Background()
820 // This snippet has been automatically generated and should be regarded as a code template only.
821 // It will require modifications to work:
822 // - It may require correct/in-range values for request initialization.
823 // - It may require specifying regional endpoints when creating the service client as shown in:
824 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
825 c, err := alloydb.NewAlloyDBAdminClient(ctx)
826 if err != nil {
827 // TODO: Handle error.
828 }
829 defer c.Close()
830
831 req := &alloydbpb.ListSupportedDatabaseFlagsRequest{
832 // TODO: Fill request struct fields.
833 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#ListSupportedDatabaseFlagsRequest.
834 }
835 it := c.ListSupportedDatabaseFlags(ctx, req)
836 for {
837 resp, err := it.Next()
838 if err == iterator.Done {
839 break
840 }
841 if err != nil {
842 // TODO: Handle error.
843 }
844 // TODO: Use resp.
845 _ = resp
846
847 // If you need to access the underlying RPC response,
848 // you can do so by casting the `Response` as below.
849 // Otherwise, remove this line. Only populated after
850 // first call to Next(). Not safe for concurrent access.
851 _ = it.Response.(*alloydbpb.ListSupportedDatabaseFlagsResponse)
852 }
853 }
854
855 func ExampleAlloyDBAdminClient_ListUsers() {
856 ctx := context.Background()
857 // This snippet has been automatically generated and should be regarded as a code template only.
858 // It will require modifications to work:
859 // - It may require correct/in-range values for request initialization.
860 // - It may require specifying regional endpoints when creating the service client as shown in:
861 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
862 c, err := alloydb.NewAlloyDBAdminClient(ctx)
863 if err != nil {
864 // TODO: Handle error.
865 }
866 defer c.Close()
867
868 req := &alloydbpb.ListUsersRequest{
869 // TODO: Fill request struct fields.
870 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#ListUsersRequest.
871 }
872 it := c.ListUsers(ctx, req)
873 for {
874 resp, err := it.Next()
875 if err == iterator.Done {
876 break
877 }
878 if err != nil {
879 // TODO: Handle error.
880 }
881 // TODO: Use resp.
882 _ = resp
883
884 // If you need to access the underlying RPC response,
885 // you can do so by casting the `Response` as below.
886 // Otherwise, remove this line. Only populated after
887 // first call to Next(). Not safe for concurrent access.
888 _ = it.Response.(*alloydbpb.ListUsersResponse)
889 }
890 }
891
892 func ExampleAlloyDBAdminClient_PromoteCluster() {
893 ctx := context.Background()
894 // This snippet has been automatically generated and should be regarded as a code template only.
895 // It will require modifications to work:
896 // - It may require correct/in-range values for request initialization.
897 // - It may require specifying regional endpoints when creating the service client as shown in:
898 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
899 c, err := alloydb.NewAlloyDBAdminClient(ctx)
900 if err != nil {
901 // TODO: Handle error.
902 }
903 defer c.Close()
904
905 req := &alloydbpb.PromoteClusterRequest{
906 // TODO: Fill request struct fields.
907 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#PromoteClusterRequest.
908 }
909 op, err := c.PromoteCluster(ctx, req)
910 if err != nil {
911 // TODO: Handle error.
912 }
913
914 resp, err := op.Wait(ctx)
915 if err != nil {
916 // TODO: Handle error.
917 }
918 // TODO: Use resp.
919 _ = resp
920 }
921
922 func ExampleAlloyDBAdminClient_RestartInstance() {
923 ctx := context.Background()
924 // This snippet has been automatically generated and should be regarded as a code template only.
925 // It will require modifications to work:
926 // - It may require correct/in-range values for request initialization.
927 // - It may require specifying regional endpoints when creating the service client as shown in:
928 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
929 c, err := alloydb.NewAlloyDBAdminClient(ctx)
930 if err != nil {
931 // TODO: Handle error.
932 }
933 defer c.Close()
934
935 req := &alloydbpb.RestartInstanceRequest{
936 // TODO: Fill request struct fields.
937 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#RestartInstanceRequest.
938 }
939 op, err := c.RestartInstance(ctx, req)
940 if err != nil {
941 // TODO: Handle error.
942 }
943
944 resp, err := op.Wait(ctx)
945 if err != nil {
946 // TODO: Handle error.
947 }
948 // TODO: Use resp.
949 _ = resp
950 }
951
952 func ExampleAlloyDBAdminClient_RestoreCluster() {
953 ctx := context.Background()
954 // This snippet has been automatically generated and should be regarded as a code template only.
955 // It will require modifications to work:
956 // - It may require correct/in-range values for request initialization.
957 // - It may require specifying regional endpoints when creating the service client as shown in:
958 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
959 c, err := alloydb.NewAlloyDBAdminClient(ctx)
960 if err != nil {
961 // TODO: Handle error.
962 }
963 defer c.Close()
964
965 req := &alloydbpb.RestoreClusterRequest{
966 // TODO: Fill request struct fields.
967 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#RestoreClusterRequest.
968 }
969 op, err := c.RestoreCluster(ctx, req)
970 if err != nil {
971 // TODO: Handle error.
972 }
973
974 resp, err := op.Wait(ctx)
975 if err != nil {
976 // TODO: Handle error.
977 }
978 // TODO: Use resp.
979 _ = resp
980 }
981
982 func ExampleAlloyDBAdminClient_SwitchoverCluster() {
983 ctx := context.Background()
984 // This snippet has been automatically generated and should be regarded as a code template only.
985 // It will require modifications to work:
986 // - It may require correct/in-range values for request initialization.
987 // - It may require specifying regional endpoints when creating the service client as shown in:
988 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
989 c, err := alloydb.NewAlloyDBAdminClient(ctx)
990 if err != nil {
991 // TODO: Handle error.
992 }
993 defer c.Close()
994
995 req := &alloydbpb.SwitchoverClusterRequest{
996 // TODO: Fill request struct fields.
997 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#SwitchoverClusterRequest.
998 }
999 op, err := c.SwitchoverCluster(ctx, req)
1000 if err != nil {
1001 // TODO: Handle error.
1002 }
1003
1004 resp, err := op.Wait(ctx)
1005 if err != nil {
1006 // TODO: Handle error.
1007 }
1008 // TODO: Use resp.
1009 _ = resp
1010 }
1011
1012 func ExampleAlloyDBAdminClient_UpdateBackup() {
1013 ctx := context.Background()
1014 // This snippet has been automatically generated and should be regarded as a code template only.
1015 // It will require modifications to work:
1016 // - It may require correct/in-range values for request initialization.
1017 // - It may require specifying regional endpoints when creating the service client as shown in:
1018 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1019 c, err := alloydb.NewAlloyDBAdminClient(ctx)
1020 if err != nil {
1021 // TODO: Handle error.
1022 }
1023 defer c.Close()
1024
1025 req := &alloydbpb.UpdateBackupRequest{
1026 // TODO: Fill request struct fields.
1027 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#UpdateBackupRequest.
1028 }
1029 op, err := c.UpdateBackup(ctx, req)
1030 if err != nil {
1031 // TODO: Handle error.
1032 }
1033
1034 resp, err := op.Wait(ctx)
1035 if err != nil {
1036 // TODO: Handle error.
1037 }
1038 // TODO: Use resp.
1039 _ = resp
1040 }
1041
1042 func ExampleAlloyDBAdminClient_UpdateCluster() {
1043 ctx := context.Background()
1044 // This snippet has been automatically generated and should be regarded as a code template only.
1045 // It will require modifications to work:
1046 // - It may require correct/in-range values for request initialization.
1047 // - It may require specifying regional endpoints when creating the service client as shown in:
1048 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1049 c, err := alloydb.NewAlloyDBAdminClient(ctx)
1050 if err != nil {
1051 // TODO: Handle error.
1052 }
1053 defer c.Close()
1054
1055 req := &alloydbpb.UpdateClusterRequest{
1056 // TODO: Fill request struct fields.
1057 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#UpdateClusterRequest.
1058 }
1059 op, err := c.UpdateCluster(ctx, req)
1060 if err != nil {
1061 // TODO: Handle error.
1062 }
1063
1064 resp, err := op.Wait(ctx)
1065 if err != nil {
1066 // TODO: Handle error.
1067 }
1068 // TODO: Use resp.
1069 _ = resp
1070 }
1071
1072 func ExampleAlloyDBAdminClient_UpdateInstance() {
1073 ctx := context.Background()
1074 // This snippet has been automatically generated and should be regarded as a code template only.
1075 // It will require modifications to work:
1076 // - It may require correct/in-range values for request initialization.
1077 // - It may require specifying regional endpoints when creating the service client as shown in:
1078 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1079 c, err := alloydb.NewAlloyDBAdminClient(ctx)
1080 if err != nil {
1081 // TODO: Handle error.
1082 }
1083 defer c.Close()
1084
1085 req := &alloydbpb.UpdateInstanceRequest{
1086 // TODO: Fill request struct fields.
1087 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#UpdateInstanceRequest.
1088 }
1089 op, err := c.UpdateInstance(ctx, req)
1090 if err != nil {
1091 // TODO: Handle error.
1092 }
1093
1094 resp, err := op.Wait(ctx)
1095 if err != nil {
1096 // TODO: Handle error.
1097 }
1098 // TODO: Use resp.
1099 _ = resp
1100 }
1101
1102 func ExampleAlloyDBAdminClient_UpdateUser() {
1103 ctx := context.Background()
1104 // This snippet has been automatically generated and should be regarded as a code template only.
1105 // It will require modifications to work:
1106 // - It may require correct/in-range values for request initialization.
1107 // - It may require specifying regional endpoints when creating the service client as shown in:
1108 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1109 c, err := alloydb.NewAlloyDBAdminClient(ctx)
1110 if err != nil {
1111 // TODO: Handle error.
1112 }
1113 defer c.Close()
1114
1115 req := &alloydbpb.UpdateUserRequest{
1116 // TODO: Fill request struct fields.
1117 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#UpdateUserRequest.
1118 }
1119 resp, err := c.UpdateUser(ctx, req)
1120 if err != nil {
1121 // TODO: Handle error.
1122 }
1123 // TODO: Use resp.
1124 _ = resp
1125 }
1126
1127 func ExampleAlloyDBAdminClient_UpgradeCluster() {
1128 ctx := context.Background()
1129 // This snippet has been automatically generated and should be regarded as a code template only.
1130 // It will require modifications to work:
1131 // - It may require correct/in-range values for request initialization.
1132 // - It may require specifying regional endpoints when creating the service client as shown in:
1133 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1134 c, err := alloydb.NewAlloyDBAdminClient(ctx)
1135 if err != nil {
1136 // TODO: Handle error.
1137 }
1138 defer c.Close()
1139
1140 req := &alloydbpb.UpgradeClusterRequest{
1141 // TODO: Fill request struct fields.
1142 // See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1/alloydbpb#UpgradeClusterRequest.
1143 }
1144 op, err := c.UpgradeCluster(ctx, req)
1145 if err != nil {
1146 // TODO: Handle error.
1147 }
1148
1149 resp, err := op.Wait(ctx)
1150 if err != nil {
1151 // TODO: Handle error.
1152 }
1153 // TODO: Use resp.
1154 _ = resp
1155 }
1156
1157 func ExampleAlloyDBAdminClient_GetLocation() {
1158 ctx := context.Background()
1159 // This snippet has been automatically generated and should be regarded as a code template only.
1160 // It will require modifications to work:
1161 // - It may require correct/in-range values for request initialization.
1162 // - It may require specifying regional endpoints when creating the service client as shown in:
1163 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1164 c, err := alloydb.NewAlloyDBAdminClient(ctx)
1165 if err != nil {
1166 // TODO: Handle error.
1167 }
1168 defer c.Close()
1169
1170 req := &locationpb.GetLocationRequest{
1171 // TODO: Fill request struct fields.
1172 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
1173 }
1174 resp, err := c.GetLocation(ctx, req)
1175 if err != nil {
1176 // TODO: Handle error.
1177 }
1178 // TODO: Use resp.
1179 _ = resp
1180 }
1181
1182 func ExampleAlloyDBAdminClient_ListLocations() {
1183 ctx := context.Background()
1184 // This snippet has been automatically generated and should be regarded as a code template only.
1185 // It will require modifications to work:
1186 // - It may require correct/in-range values for request initialization.
1187 // - It may require specifying regional endpoints when creating the service client as shown in:
1188 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1189 c, err := alloydb.NewAlloyDBAdminClient(ctx)
1190 if err != nil {
1191 // TODO: Handle error.
1192 }
1193 defer c.Close()
1194
1195 req := &locationpb.ListLocationsRequest{
1196 // TODO: Fill request struct fields.
1197 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
1198 }
1199 it := c.ListLocations(ctx, req)
1200 for {
1201 resp, err := it.Next()
1202 if err == iterator.Done {
1203 break
1204 }
1205 if err != nil {
1206 // TODO: Handle error.
1207 }
1208 // TODO: Use resp.
1209 _ = resp
1210
1211 // If you need to access the underlying RPC response,
1212 // you can do so by casting the `Response` as below.
1213 // Otherwise, remove this line. Only populated after
1214 // first call to Next(). Not safe for concurrent access.
1215 _ = it.Response.(*locationpb.ListLocationsResponse)
1216 }
1217 }
1218
1219 func ExampleAlloyDBAdminClient_CancelOperation() {
1220 ctx := context.Background()
1221 // This snippet has been automatically generated and should be regarded as a code template only.
1222 // It will require modifications to work:
1223 // - It may require correct/in-range values for request initialization.
1224 // - It may require specifying regional endpoints when creating the service client as shown in:
1225 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1226 c, err := alloydb.NewAlloyDBAdminClient(ctx)
1227 if err != nil {
1228 // TODO: Handle error.
1229 }
1230 defer c.Close()
1231
1232 req := &longrunningpb.CancelOperationRequest{
1233 // TODO: Fill request struct fields.
1234 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
1235 }
1236 err = c.CancelOperation(ctx, req)
1237 if err != nil {
1238 // TODO: Handle error.
1239 }
1240 }
1241
1242 func ExampleAlloyDBAdminClient_DeleteOperation() {
1243 ctx := context.Background()
1244 // This snippet has been automatically generated and should be regarded as a code template only.
1245 // It will require modifications to work:
1246 // - It may require correct/in-range values for request initialization.
1247 // - It may require specifying regional endpoints when creating the service client as shown in:
1248 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1249 c, err := alloydb.NewAlloyDBAdminClient(ctx)
1250 if err != nil {
1251 // TODO: Handle error.
1252 }
1253 defer c.Close()
1254
1255 req := &longrunningpb.DeleteOperationRequest{
1256 // TODO: Fill request struct fields.
1257 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
1258 }
1259 err = c.DeleteOperation(ctx, req)
1260 if err != nil {
1261 // TODO: Handle error.
1262 }
1263 }
1264
1265 func ExampleAlloyDBAdminClient_GetOperation() {
1266 ctx := context.Background()
1267 // This snippet has been automatically generated and should be regarded as a code template only.
1268 // It will require modifications to work:
1269 // - It may require correct/in-range values for request initialization.
1270 // - It may require specifying regional endpoints when creating the service client as shown in:
1271 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1272 c, err := alloydb.NewAlloyDBAdminClient(ctx)
1273 if err != nil {
1274 // TODO: Handle error.
1275 }
1276 defer c.Close()
1277
1278 req := &longrunningpb.GetOperationRequest{
1279 // TODO: Fill request struct fields.
1280 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
1281 }
1282 resp, err := c.GetOperation(ctx, req)
1283 if err != nil {
1284 // TODO: Handle error.
1285 }
1286 // TODO: Use resp.
1287 _ = resp
1288 }
1289
1290 func ExampleAlloyDBAdminClient_ListOperations() {
1291 ctx := context.Background()
1292 // This snippet has been automatically generated and should be regarded as a code template only.
1293 // It will require modifications to work:
1294 // - It may require correct/in-range values for request initialization.
1295 // - It may require specifying regional endpoints when creating the service client as shown in:
1296 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1297 c, err := alloydb.NewAlloyDBAdminClient(ctx)
1298 if err != nil {
1299 // TODO: Handle error.
1300 }
1301 defer c.Close()
1302
1303 req := &longrunningpb.ListOperationsRequest{
1304 // TODO: Fill request struct fields.
1305 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
1306 }
1307 it := c.ListOperations(ctx, req)
1308 for {
1309 resp, err := it.Next()
1310 if err == iterator.Done {
1311 break
1312 }
1313 if err != nil {
1314 // TODO: Handle error.
1315 }
1316 // TODO: Use resp.
1317 _ = resp
1318
1319 // If you need to access the underlying RPC response,
1320 // you can do so by casting the `Response` as below.
1321 // Otherwise, remove this line. Only populated after
1322 // first call to Next(). Not safe for concurrent access.
1323 _ = it.Response.(*longrunningpb.ListOperationsResponse)
1324 }
1325 }