Debian Codegraph @

filestore/apiv1/cloud_filestore_manager_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 filestore_test
18
19 import (
20 "context"
21
22 filestore "cloud.google.com/go/filestore/apiv1"
23 filestorepb "cloud.google.com/go/filestore/apiv1/filestorepb"
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 ExampleNewCloudFilestoreManagerClient() {
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 := filestore.NewCloudFilestoreManagerClient(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 ExampleNewCloudFilestoreManagerRESTClient() {
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 := filestore.NewCloudFilestoreManagerRESTClient(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 ExampleCloudFilestoreManagerClient_CreateBackup() {
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 := filestore.NewCloudFilestoreManagerClient(ctx)
71 if err != nil {
72 // TODO: Handle error.
73 }
74 defer c.Close()
75
76 req := &filestorepb.CreateBackupRequest{
77 // TODO: Fill request struct fields.
78 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#CreateBackupRequest.
79 }
80 op, err := c.CreateBackup(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 ExampleCloudFilestoreManagerClient_CreateInstance() {
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 := filestore.NewCloudFilestoreManagerClient(ctx)
101 if err != nil {
102 // TODO: Handle error.
103 }
104 defer c.Close()
105
106 req := &filestorepb.CreateInstanceRequest{
107 // TODO: Fill request struct fields.
108 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#CreateInstanceRequest.
109 }
110 op, err := c.CreateInstance(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 ExampleCloudFilestoreManagerClient_CreateSnapshot() {
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 := filestore.NewCloudFilestoreManagerClient(ctx)
131 if err != nil {
132 // TODO: Handle error.
133 }
134 defer c.Close()
135
136 req := &filestorepb.CreateSnapshotRequest{
137 // TODO: Fill request struct fields.
138 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#CreateSnapshotRequest.
139 }
140 op, err := c.CreateSnapshot(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 ExampleCloudFilestoreManagerClient_DeleteBackup() {
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 := filestore.NewCloudFilestoreManagerClient(ctx)
161 if err != nil {
162 // TODO: Handle error.
163 }
164 defer c.Close()
165
166 req := &filestorepb.DeleteBackupRequest{
167 // TODO: Fill request struct fields.
168 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#DeleteBackupRequest.
169 }
170 op, err := c.DeleteBackup(ctx, req)
171 if err != nil {
172 // TODO: Handle error.
173 }
174
175 err = op.Wait(ctx)
176 if err != nil {
177 // TODO: Handle error.
178 }
179 }
180
181 func ExampleCloudFilestoreManagerClient_DeleteInstance() {
182 ctx := context.Background()
183 // This snippet has been automatically generated and should be regarded as a code template only.
184 // It will require modifications to work:
185 // - It may require correct/in-range values for request initialization.
186 // - It may require specifying regional endpoints when creating the service client as shown in:
187 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
188 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
189 if err != nil {
190 // TODO: Handle error.
191 }
192 defer c.Close()
193
194 req := &filestorepb.DeleteInstanceRequest{
195 // TODO: Fill request struct fields.
196 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#DeleteInstanceRequest.
197 }
198 op, err := c.DeleteInstance(ctx, req)
199 if err != nil {
200 // TODO: Handle error.
201 }
202
203 err = op.Wait(ctx)
204 if err != nil {
205 // TODO: Handle error.
206 }
207 }
208
209 func ExampleCloudFilestoreManagerClient_DeleteSnapshot() {
210 ctx := context.Background()
211 // This snippet has been automatically generated and should be regarded as a code template only.
212 // It will require modifications to work:
213 // - It may require correct/in-range values for request initialization.
214 // - It may require specifying regional endpoints when creating the service client as shown in:
215 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
216 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
217 if err != nil {
218 // TODO: Handle error.
219 }
220 defer c.Close()
221
222 req := &filestorepb.DeleteSnapshotRequest{
223 // TODO: Fill request struct fields.
224 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#DeleteSnapshotRequest.
225 }
226 op, err := c.DeleteSnapshot(ctx, req)
227 if err != nil {
228 // TODO: Handle error.
229 }
230
231 err = op.Wait(ctx)
232 if err != nil {
233 // TODO: Handle error.
234 }
235 }
236
237 func ExampleCloudFilestoreManagerClient_GetBackup() {
238 ctx := context.Background()
239 // This snippet has been automatically generated and should be regarded as a code template only.
240 // It will require modifications to work:
241 // - It may require correct/in-range values for request initialization.
242 // - It may require specifying regional endpoints when creating the service client as shown in:
243 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
244 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
245 if err != nil {
246 // TODO: Handle error.
247 }
248 defer c.Close()
249
250 req := &filestorepb.GetBackupRequest{
251 // TODO: Fill request struct fields.
252 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#GetBackupRequest.
253 }
254 resp, err := c.GetBackup(ctx, req)
255 if err != nil {
256 // TODO: Handle error.
257 }
258 // TODO: Use resp.
259 _ = resp
260 }
261
262 func ExampleCloudFilestoreManagerClient_GetInstance() {
263 ctx := context.Background()
264 // This snippet has been automatically generated and should be regarded as a code template only.
265 // It will require modifications to work:
266 // - It may require correct/in-range values for request initialization.
267 // - It may require specifying regional endpoints when creating the service client as shown in:
268 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
269 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
270 if err != nil {
271 // TODO: Handle error.
272 }
273 defer c.Close()
274
275 req := &filestorepb.GetInstanceRequest{
276 // TODO: Fill request struct fields.
277 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#GetInstanceRequest.
278 }
279 resp, err := c.GetInstance(ctx, req)
280 if err != nil {
281 // TODO: Handle error.
282 }
283 // TODO: Use resp.
284 _ = resp
285 }
286
287 func ExampleCloudFilestoreManagerClient_GetSnapshot() {
288 ctx := context.Background()
289 // This snippet has been automatically generated and should be regarded as a code template only.
290 // It will require modifications to work:
291 // - It may require correct/in-range values for request initialization.
292 // - It may require specifying regional endpoints when creating the service client as shown in:
293 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
294 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
295 if err != nil {
296 // TODO: Handle error.
297 }
298 defer c.Close()
299
300 req := &filestorepb.GetSnapshotRequest{
301 // TODO: Fill request struct fields.
302 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#GetSnapshotRequest.
303 }
304 resp, err := c.GetSnapshot(ctx, req)
305 if err != nil {
306 // TODO: Handle error.
307 }
308 // TODO: Use resp.
309 _ = resp
310 }
311
312 func ExampleCloudFilestoreManagerClient_ListBackups() {
313 ctx := context.Background()
314 // This snippet has been automatically generated and should be regarded as a code template only.
315 // It will require modifications to work:
316 // - It may require correct/in-range values for request initialization.
317 // - It may require specifying regional endpoints when creating the service client as shown in:
318 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
319 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
320 if err != nil {
321 // TODO: Handle error.
322 }
323 defer c.Close()
324
325 req := &filestorepb.ListBackupsRequest{
326 // TODO: Fill request struct fields.
327 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#ListBackupsRequest.
328 }
329 it := c.ListBackups(ctx, req)
330 for {
331 resp, err := it.Next()
332 if err == iterator.Done {
333 break
334 }
335 if err != nil {
336 // TODO: Handle error.
337 }
338 // TODO: Use resp.
339 _ = resp
340
341 // If you need to access the underlying RPC response,
342 // you can do so by casting the `Response` as below.
343 // Otherwise, remove this line. Only populated after
344 // first call to Next(). Not safe for concurrent access.
345 _ = it.Response.(*filestorepb.ListBackupsResponse)
346 }
347 }
348
349 func ExampleCloudFilestoreManagerClient_ListInstances() {
350 ctx := context.Background()
351 // This snippet has been automatically generated and should be regarded as a code template only.
352 // It will require modifications to work:
353 // - It may require correct/in-range values for request initialization.
354 // - It may require specifying regional endpoints when creating the service client as shown in:
355 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
356 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
357 if err != nil {
358 // TODO: Handle error.
359 }
360 defer c.Close()
361
362 req := &filestorepb.ListInstancesRequest{
363 // TODO: Fill request struct fields.
364 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#ListInstancesRequest.
365 }
366 it := c.ListInstances(ctx, req)
367 for {
368 resp, err := it.Next()
369 if err == iterator.Done {
370 break
371 }
372 if err != nil {
373 // TODO: Handle error.
374 }
375 // TODO: Use resp.
376 _ = resp
377
378 // If you need to access the underlying RPC response,
379 // you can do so by casting the `Response` as below.
380 // Otherwise, remove this line. Only populated after
381 // first call to Next(). Not safe for concurrent access.
382 _ = it.Response.(*filestorepb.ListInstancesResponse)
383 }
384 }
385
386 func ExampleCloudFilestoreManagerClient_ListSnapshots() {
387 ctx := context.Background()
388 // This snippet has been automatically generated and should be regarded as a code template only.
389 // It will require modifications to work:
390 // - It may require correct/in-range values for request initialization.
391 // - It may require specifying regional endpoints when creating the service client as shown in:
392 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
393 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
394 if err != nil {
395 // TODO: Handle error.
396 }
397 defer c.Close()
398
399 req := &filestorepb.ListSnapshotsRequest{
400 // TODO: Fill request struct fields.
401 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#ListSnapshotsRequest.
402 }
403 it := c.ListSnapshots(ctx, req)
404 for {
405 resp, err := it.Next()
406 if err == iterator.Done {
407 break
408 }
409 if err != nil {
410 // TODO: Handle error.
411 }
412 // TODO: Use resp.
413 _ = resp
414
415 // If you need to access the underlying RPC response,
416 // you can do so by casting the `Response` as below.
417 // Otherwise, remove this line. Only populated after
418 // first call to Next(). Not safe for concurrent access.
419 _ = it.Response.(*filestorepb.ListSnapshotsResponse)
420 }
421 }
422
423 func ExampleCloudFilestoreManagerClient_PromoteReplica() {
424 ctx := context.Background()
425 // This snippet has been automatically generated and should be regarded as a code template only.
426 // It will require modifications to work:
427 // - It may require correct/in-range values for request initialization.
428 // - It may require specifying regional endpoints when creating the service client as shown in:
429 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
430 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
431 if err != nil {
432 // TODO: Handle error.
433 }
434 defer c.Close()
435
436 req := &filestorepb.PromoteReplicaRequest{
437 // TODO: Fill request struct fields.
438 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#PromoteReplicaRequest.
439 }
440 op, err := c.PromoteReplica(ctx, req)
441 if err != nil {
442 // TODO: Handle error.
443 }
444
445 resp, err := op.Wait(ctx)
446 if err != nil {
447 // TODO: Handle error.
448 }
449 // TODO: Use resp.
450 _ = resp
451 }
452
453 func ExampleCloudFilestoreManagerClient_RestoreInstance() {
454 ctx := context.Background()
455 // This snippet has been automatically generated and should be regarded as a code template only.
456 // It will require modifications to work:
457 // - It may require correct/in-range values for request initialization.
458 // - It may require specifying regional endpoints when creating the service client as shown in:
459 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
460 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
461 if err != nil {
462 // TODO: Handle error.
463 }
464 defer c.Close()
465
466 req := &filestorepb.RestoreInstanceRequest{
467 // TODO: Fill request struct fields.
468 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#RestoreInstanceRequest.
469 }
470 op, err := c.RestoreInstance(ctx, req)
471 if err != nil {
472 // TODO: Handle error.
473 }
474
475 resp, err := op.Wait(ctx)
476 if err != nil {
477 // TODO: Handle error.
478 }
479 // TODO: Use resp.
480 _ = resp
481 }
482
483 func ExampleCloudFilestoreManagerClient_RevertInstance() {
484 ctx := context.Background()
485 // This snippet has been automatically generated and should be regarded as a code template only.
486 // It will require modifications to work:
487 // - It may require correct/in-range values for request initialization.
488 // - It may require specifying regional endpoints when creating the service client as shown in:
489 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
490 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
491 if err != nil {
492 // TODO: Handle error.
493 }
494 defer c.Close()
495
496 req := &filestorepb.RevertInstanceRequest{
497 // TODO: Fill request struct fields.
498 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#RevertInstanceRequest.
499 }
500 op, err := c.RevertInstance(ctx, req)
501 if err != nil {
502 // TODO: Handle error.
503 }
504
505 resp, err := op.Wait(ctx)
506 if err != nil {
507 // TODO: Handle error.
508 }
509 // TODO: Use resp.
510 _ = resp
511 }
512
513 func ExampleCloudFilestoreManagerClient_UpdateBackup() {
514 ctx := context.Background()
515 // This snippet has been automatically generated and should be regarded as a code template only.
516 // It will require modifications to work:
517 // - It may require correct/in-range values for request initialization.
518 // - It may require specifying regional endpoints when creating the service client as shown in:
519 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
520 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
521 if err != nil {
522 // TODO: Handle error.
523 }
524 defer c.Close()
525
526 req := &filestorepb.UpdateBackupRequest{
527 // TODO: Fill request struct fields.
528 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#UpdateBackupRequest.
529 }
530 op, err := c.UpdateBackup(ctx, req)
531 if err != nil {
532 // TODO: Handle error.
533 }
534
535 resp, err := op.Wait(ctx)
536 if err != nil {
537 // TODO: Handle error.
538 }
539 // TODO: Use resp.
540 _ = resp
541 }
542
543 func ExampleCloudFilestoreManagerClient_UpdateInstance() {
544 ctx := context.Background()
545 // This snippet has been automatically generated and should be regarded as a code template only.
546 // It will require modifications to work:
547 // - It may require correct/in-range values for request initialization.
548 // - It may require specifying regional endpoints when creating the service client as shown in:
549 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
550 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
551 if err != nil {
552 // TODO: Handle error.
553 }
554 defer c.Close()
555
556 req := &filestorepb.UpdateInstanceRequest{
557 // TODO: Fill request struct fields.
558 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#UpdateInstanceRequest.
559 }
560 op, err := c.UpdateInstance(ctx, req)
561 if err != nil {
562 // TODO: Handle error.
563 }
564
565 resp, err := op.Wait(ctx)
566 if err != nil {
567 // TODO: Handle error.
568 }
569 // TODO: Use resp.
570 _ = resp
571 }
572
573 func ExampleCloudFilestoreManagerClient_UpdateSnapshot() {
574 ctx := context.Background()
575 // This snippet has been automatically generated and should be regarded as a code template only.
576 // It will require modifications to work:
577 // - It may require correct/in-range values for request initialization.
578 // - It may require specifying regional endpoints when creating the service client as shown in:
579 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
580 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
581 if err != nil {
582 // TODO: Handle error.
583 }
584 defer c.Close()
585
586 req := &filestorepb.UpdateSnapshotRequest{
587 // TODO: Fill request struct fields.
588 // See https://pkg.go.dev/cloud.google.com/go/filestore/apiv1/filestorepb#UpdateSnapshotRequest.
589 }
590 op, err := c.UpdateSnapshot(ctx, req)
591 if err != nil {
592 // TODO: Handle error.
593 }
594
595 resp, err := op.Wait(ctx)
596 if err != nil {
597 // TODO: Handle error.
598 }
599 // TODO: Use resp.
600 _ = resp
601 }
602
603 func ExampleCloudFilestoreManagerClient_GetLocation() {
604 ctx := context.Background()
605 // This snippet has been automatically generated and should be regarded as a code template only.
606 // It will require modifications to work:
607 // - It may require correct/in-range values for request initialization.
608 // - It may require specifying regional endpoints when creating the service client as shown in:
609 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
610 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
611 if err != nil {
612 // TODO: Handle error.
613 }
614 defer c.Close()
615
616 req := &locationpb.GetLocationRequest{
617 // TODO: Fill request struct fields.
618 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
619 }
620 resp, err := c.GetLocation(ctx, req)
621 if err != nil {
622 // TODO: Handle error.
623 }
624 // TODO: Use resp.
625 _ = resp
626 }
627
628 func ExampleCloudFilestoreManagerClient_ListLocations() {
629 ctx := context.Background()
630 // This snippet has been automatically generated and should be regarded as a code template only.
631 // It will require modifications to work:
632 // - It may require correct/in-range values for request initialization.
633 // - It may require specifying regional endpoints when creating the service client as shown in:
634 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
635 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
636 if err != nil {
637 // TODO: Handle error.
638 }
639 defer c.Close()
640
641 req := &locationpb.ListLocationsRequest{
642 // TODO: Fill request struct fields.
643 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
644 }
645 it := c.ListLocations(ctx, req)
646 for {
647 resp, err := it.Next()
648 if err == iterator.Done {
649 break
650 }
651 if err != nil {
652 // TODO: Handle error.
653 }
654 // TODO: Use resp.
655 _ = resp
656
657 // If you need to access the underlying RPC response,
658 // you can do so by casting the `Response` as below.
659 // Otherwise, remove this line. Only populated after
660 // first call to Next(). Not safe for concurrent access.
661 _ = it.Response.(*locationpb.ListLocationsResponse)
662 }
663 }
664
665 func ExampleCloudFilestoreManagerClient_CancelOperation() {
666 ctx := context.Background()
667 // This snippet has been automatically generated and should be regarded as a code template only.
668 // It will require modifications to work:
669 // - It may require correct/in-range values for request initialization.
670 // - It may require specifying regional endpoints when creating the service client as shown in:
671 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
672 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
673 if err != nil {
674 // TODO: Handle error.
675 }
676 defer c.Close()
677
678 req := &longrunningpb.CancelOperationRequest{
679 // TODO: Fill request struct fields.
680 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
681 }
682 err = c.CancelOperation(ctx, req)
683 if err != nil {
684 // TODO: Handle error.
685 }
686 }
687
688 func ExampleCloudFilestoreManagerClient_DeleteOperation() {
689 ctx := context.Background()
690 // This snippet has been automatically generated and should be regarded as a code template only.
691 // It will require modifications to work:
692 // - It may require correct/in-range values for request initialization.
693 // - It may require specifying regional endpoints when creating the service client as shown in:
694 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
695 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
696 if err != nil {
697 // TODO: Handle error.
698 }
699 defer c.Close()
700
701 req := &longrunningpb.DeleteOperationRequest{
702 // TODO: Fill request struct fields.
703 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
704 }
705 err = c.DeleteOperation(ctx, req)
706 if err != nil {
707 // TODO: Handle error.
708 }
709 }
710
711 func ExampleCloudFilestoreManagerClient_GetOperation() {
712 ctx := context.Background()
713 // This snippet has been automatically generated and should be regarded as a code template only.
714 // It will require modifications to work:
715 // - It may require correct/in-range values for request initialization.
716 // - It may require specifying regional endpoints when creating the service client as shown in:
717 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
718 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
719 if err != nil {
720 // TODO: Handle error.
721 }
722 defer c.Close()
723
724 req := &longrunningpb.GetOperationRequest{
725 // TODO: Fill request struct fields.
726 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
727 }
728 resp, err := c.GetOperation(ctx, req)
729 if err != nil {
730 // TODO: Handle error.
731 }
732 // TODO: Use resp.
733 _ = resp
734 }
735
736 func ExampleCloudFilestoreManagerClient_ListOperations() {
737 ctx := context.Background()
738 // This snippet has been automatically generated and should be regarded as a code template only.
739 // It will require modifications to work:
740 // - It may require correct/in-range values for request initialization.
741 // - It may require specifying regional endpoints when creating the service client as shown in:
742 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
743 c, err := filestore.NewCloudFilestoreManagerClient(ctx)
744 if err != nil {
745 // TODO: Handle error.
746 }
747 defer c.Close()
748
749 req := &longrunningpb.ListOperationsRequest{
750 // TODO: Fill request struct fields.
751 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
752 }
753 it := c.ListOperations(ctx, req)
754 for {
755 resp, err := it.Next()
756 if err == iterator.Done {
757 break
758 }
759 if err != nil {
760 // TODO: Handle error.
761 }
762 // TODO: Use resp.
763 _ = resp
764
765 // If you need to access the underlying RPC response,
766 // you can do so by casting the `Response` as below.
767 // Otherwise, remove this line. Only populated after
768 // first call to Next(). Not safe for concurrent access.
769 _ = it.Response.(*longrunningpb.ListOperationsResponse)
770 }
771 }