Debian Codegraph @

networkservices/apiv1/network_services_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 networkservices_test
18
19 import (
20 "context"
21
22 iampb "cloud.google.com/go/iam/apiv1/iampb"
23 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
24 networkservices "cloud.google.com/go/networkservices/apiv1"
25 networkservicespb "cloud.google.com/go/networkservices/apiv1/networkservicespb"
26 "google.golang.org/api/iterator"
27 locationpb "google.golang.org/genproto/googleapis/cloud/location"
28 )
29
30 func ExampleNewClient() {
31 ctx := context.Background()
32 // This snippet has been automatically generated and should be regarded as a code template only.
33 // It will require modifications to work:
34 // - It may require correct/in-range values for request initialization.
35 // - It may require specifying regional endpoints when creating the service client as shown in:
36 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
37 c, err := networkservices.NewClient(ctx)
38 if err != nil {
39 // TODO: Handle error.
40 }
41 defer c.Close()
42
43 // TODO: Use client.
44 _ = c
45 }
46
47 func ExampleNewRESTClient() {
48 ctx := context.Background()
49 // This snippet has been automatically generated and should be regarded as a code template only.
50 // It will require modifications to work:
51 // - It may require correct/in-range values for request initialization.
52 // - It may require specifying regional endpoints when creating the service client as shown in:
53 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
54 c, err := networkservices.NewRESTClient(ctx)
55 if err != nil {
56 // TODO: Handle error.
57 }
58 defer c.Close()
59
60 // TODO: Use client.
61 _ = c
62 }
63
64 func ExampleClient_CreateEndpointPolicy() {
65 ctx := context.Background()
66 // This snippet has been automatically generated and should be regarded as a code template only.
67 // It will require modifications to work:
68 // - It may require correct/in-range values for request initialization.
69 // - It may require specifying regional endpoints when creating the service client as shown in:
70 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
71 c, err := networkservices.NewClient(ctx)
72 if err != nil {
73 // TODO: Handle error.
74 }
75 defer c.Close()
76
77 req := &networkservicespb.CreateEndpointPolicyRequest{
78 // TODO: Fill request struct fields.
79 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#CreateEndpointPolicyRequest.
80 }
81 op, err := c.CreateEndpointPolicy(ctx, req)
82 if err != nil {
83 // TODO: Handle error.
84 }
85
86 resp, err := op.Wait(ctx)
87 if err != nil {
88 // TODO: Handle error.
89 }
90 // TODO: Use resp.
91 _ = resp
92 }
93
94 func ExampleClient_CreateGateway() {
95 ctx := context.Background()
96 // This snippet has been automatically generated and should be regarded as a code template only.
97 // It will require modifications to work:
98 // - It may require correct/in-range values for request initialization.
99 // - It may require specifying regional endpoints when creating the service client as shown in:
100 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
101 c, err := networkservices.NewClient(ctx)
102 if err != nil {
103 // TODO: Handle error.
104 }
105 defer c.Close()
106
107 req := &networkservicespb.CreateGatewayRequest{
108 // TODO: Fill request struct fields.
109 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#CreateGatewayRequest.
110 }
111 op, err := c.CreateGateway(ctx, req)
112 if err != nil {
113 // TODO: Handle error.
114 }
115
116 resp, err := op.Wait(ctx)
117 if err != nil {
118 // TODO: Handle error.
119 }
120 // TODO: Use resp.
121 _ = resp
122 }
123
124 func ExampleClient_CreateGrpcRoute() {
125 ctx := context.Background()
126 // This snippet has been automatically generated and should be regarded as a code template only.
127 // It will require modifications to work:
128 // - It may require correct/in-range values for request initialization.
129 // - It may require specifying regional endpoints when creating the service client as shown in:
130 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
131 c, err := networkservices.NewClient(ctx)
132 if err != nil {
133 // TODO: Handle error.
134 }
135 defer c.Close()
136
137 req := &networkservicespb.CreateGrpcRouteRequest{
138 // TODO: Fill request struct fields.
139 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#CreateGrpcRouteRequest.
140 }
141 op, err := c.CreateGrpcRoute(ctx, req)
142 if err != nil {
143 // TODO: Handle error.
144 }
145
146 resp, err := op.Wait(ctx)
147 if err != nil {
148 // TODO: Handle error.
149 }
150 // TODO: Use resp.
151 _ = resp
152 }
153
154 func ExampleClient_CreateHttpRoute() {
155 ctx := context.Background()
156 // This snippet has been automatically generated and should be regarded as a code template only.
157 // It will require modifications to work:
158 // - It may require correct/in-range values for request initialization.
159 // - It may require specifying regional endpoints when creating the service client as shown in:
160 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
161 c, err := networkservices.NewClient(ctx)
162 if err != nil {
163 // TODO: Handle error.
164 }
165 defer c.Close()
166
167 req := &networkservicespb.CreateHttpRouteRequest{
168 // TODO: Fill request struct fields.
169 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#CreateHttpRouteRequest.
170 }
171 op, err := c.CreateHttpRoute(ctx, req)
172 if err != nil {
173 // TODO: Handle error.
174 }
175
176 resp, err := op.Wait(ctx)
177 if err != nil {
178 // TODO: Handle error.
179 }
180 // TODO: Use resp.
181 _ = resp
182 }
183
184 func ExampleClient_CreateMesh() {
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 := networkservices.NewClient(ctx)
192 if err != nil {
193 // TODO: Handle error.
194 }
195 defer c.Close()
196
197 req := &networkservicespb.CreateMeshRequest{
198 // TODO: Fill request struct fields.
199 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#CreateMeshRequest.
200 }
201 op, err := c.CreateMesh(ctx, req)
202 if err != nil {
203 // TODO: Handle error.
204 }
205
206 resp, err := op.Wait(ctx)
207 if err != nil {
208 // TODO: Handle error.
209 }
210 // TODO: Use resp.
211 _ = resp
212 }
213
214 func ExampleClient_CreateServiceBinding() {
215 ctx := context.Background()
216 // This snippet has been automatically generated and should be regarded as a code template only.
217 // It will require modifications to work:
218 // - It may require correct/in-range values for request initialization.
219 // - It may require specifying regional endpoints when creating the service client as shown in:
220 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
221 c, err := networkservices.NewClient(ctx)
222 if err != nil {
223 // TODO: Handle error.
224 }
225 defer c.Close()
226
227 req := &networkservicespb.CreateServiceBindingRequest{
228 // TODO: Fill request struct fields.
229 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#CreateServiceBindingRequest.
230 }
231 op, err := c.CreateServiceBinding(ctx, req)
232 if err != nil {
233 // TODO: Handle error.
234 }
235
236 resp, err := op.Wait(ctx)
237 if err != nil {
238 // TODO: Handle error.
239 }
240 // TODO: Use resp.
241 _ = resp
242 }
243
244 func ExampleClient_CreateServiceLbPolicy() {
245 ctx := context.Background()
246 // This snippet has been automatically generated and should be regarded as a code template only.
247 // It will require modifications to work:
248 // - It may require correct/in-range values for request initialization.
249 // - It may require specifying regional endpoints when creating the service client as shown in:
250 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
251 c, err := networkservices.NewClient(ctx)
252 if err != nil {
253 // TODO: Handle error.
254 }
255 defer c.Close()
256
257 req := &networkservicespb.CreateServiceLbPolicyRequest{
258 // TODO: Fill request struct fields.
259 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#CreateServiceLbPolicyRequest.
260 }
261 op, err := c.CreateServiceLbPolicy(ctx, req)
262 if err != nil {
263 // TODO: Handle error.
264 }
265
266 resp, err := op.Wait(ctx)
267 if err != nil {
268 // TODO: Handle error.
269 }
270 // TODO: Use resp.
271 _ = resp
272 }
273
274 func ExampleClient_CreateTcpRoute() {
275 ctx := context.Background()
276 // This snippet has been automatically generated and should be regarded as a code template only.
277 // It will require modifications to work:
278 // - It may require correct/in-range values for request initialization.
279 // - It may require specifying regional endpoints when creating the service client as shown in:
280 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
281 c, err := networkservices.NewClient(ctx)
282 if err != nil {
283 // TODO: Handle error.
284 }
285 defer c.Close()
286
287 req := &networkservicespb.CreateTcpRouteRequest{
288 // TODO: Fill request struct fields.
289 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#CreateTcpRouteRequest.
290 }
291 op, err := c.CreateTcpRoute(ctx, req)
292 if err != nil {
293 // TODO: Handle error.
294 }
295
296 resp, err := op.Wait(ctx)
297 if err != nil {
298 // TODO: Handle error.
299 }
300 // TODO: Use resp.
301 _ = resp
302 }
303
304 func ExampleClient_CreateTlsRoute() {
305 ctx := context.Background()
306 // This snippet has been automatically generated and should be regarded as a code template only.
307 // It will require modifications to work:
308 // - It may require correct/in-range values for request initialization.
309 // - It may require specifying regional endpoints when creating the service client as shown in:
310 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
311 c, err := networkservices.NewClient(ctx)
312 if err != nil {
313 // TODO: Handle error.
314 }
315 defer c.Close()
316
317 req := &networkservicespb.CreateTlsRouteRequest{
318 // TODO: Fill request struct fields.
319 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#CreateTlsRouteRequest.
320 }
321 op, err := c.CreateTlsRoute(ctx, req)
322 if err != nil {
323 // TODO: Handle error.
324 }
325
326 resp, err := op.Wait(ctx)
327 if err != nil {
328 // TODO: Handle error.
329 }
330 // TODO: Use resp.
331 _ = resp
332 }
333
334 func ExampleClient_CreateWasmPlugin() {
335 ctx := context.Background()
336 // This snippet has been automatically generated and should be regarded as a code template only.
337 // It will require modifications to work:
338 // - It may require correct/in-range values for request initialization.
339 // - It may require specifying regional endpoints when creating the service client as shown in:
340 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
341 c, err := networkservices.NewClient(ctx)
342 if err != nil {
343 // TODO: Handle error.
344 }
345 defer c.Close()
346
347 req := &networkservicespb.CreateWasmPluginRequest{
348 // TODO: Fill request struct fields.
349 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#CreateWasmPluginRequest.
350 }
351 op, err := c.CreateWasmPlugin(ctx, req)
352 if err != nil {
353 // TODO: Handle error.
354 }
355
356 resp, err := op.Wait(ctx)
357 if err != nil {
358 // TODO: Handle error.
359 }
360 // TODO: Use resp.
361 _ = resp
362 }
363
364 func ExampleClient_CreateWasmPluginVersion() {
365 ctx := context.Background()
366 // This snippet has been automatically generated and should be regarded as a code template only.
367 // It will require modifications to work:
368 // - It may require correct/in-range values for request initialization.
369 // - It may require specifying regional endpoints when creating the service client as shown in:
370 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
371 c, err := networkservices.NewClient(ctx)
372 if err != nil {
373 // TODO: Handle error.
374 }
375 defer c.Close()
376
377 req := &networkservicespb.CreateWasmPluginVersionRequest{
378 // TODO: Fill request struct fields.
379 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#CreateWasmPluginVersionRequest.
380 }
381 op, err := c.CreateWasmPluginVersion(ctx, req)
382 if err != nil {
383 // TODO: Handle error.
384 }
385
386 resp, err := op.Wait(ctx)
387 if err != nil {
388 // TODO: Handle error.
389 }
390 // TODO: Use resp.
391 _ = resp
392 }
393
394 func ExampleClient_DeleteEndpointPolicy() {
395 ctx := context.Background()
396 // This snippet has been automatically generated and should be regarded as a code template only.
397 // It will require modifications to work:
398 // - It may require correct/in-range values for request initialization.
399 // - It may require specifying regional endpoints when creating the service client as shown in:
400 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
401 c, err := networkservices.NewClient(ctx)
402 if err != nil {
403 // TODO: Handle error.
404 }
405 defer c.Close()
406
407 req := &networkservicespb.DeleteEndpointPolicyRequest{
408 // TODO: Fill request struct fields.
409 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#DeleteEndpointPolicyRequest.
410 }
411 op, err := c.DeleteEndpointPolicy(ctx, req)
412 if err != nil {
413 // TODO: Handle error.
414 }
415
416 err = op.Wait(ctx)
417 if err != nil {
418 // TODO: Handle error.
419 }
420 }
421
422 func ExampleClient_DeleteGateway() {
423 ctx := context.Background()
424 // This snippet has been automatically generated and should be regarded as a code template only.
425 // It will require modifications to work:
426 // - It may require correct/in-range values for request initialization.
427 // - It may require specifying regional endpoints when creating the service client as shown in:
428 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
429 c, err := networkservices.NewClient(ctx)
430 if err != nil {
431 // TODO: Handle error.
432 }
433 defer c.Close()
434
435 req := &networkservicespb.DeleteGatewayRequest{
436 // TODO: Fill request struct fields.
437 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#DeleteGatewayRequest.
438 }
439 op, err := c.DeleteGateway(ctx, req)
440 if err != nil {
441 // TODO: Handle error.
442 }
443
444 err = op.Wait(ctx)
445 if err != nil {
446 // TODO: Handle error.
447 }
448 }
449
450 func ExampleClient_DeleteGrpcRoute() {
451 ctx := context.Background()
452 // This snippet has been automatically generated and should be regarded as a code template only.
453 // It will require modifications to work:
454 // - It may require correct/in-range values for request initialization.
455 // - It may require specifying regional endpoints when creating the service client as shown in:
456 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
457 c, err := networkservices.NewClient(ctx)
458 if err != nil {
459 // TODO: Handle error.
460 }
461 defer c.Close()
462
463 req := &networkservicespb.DeleteGrpcRouteRequest{
464 // TODO: Fill request struct fields.
465 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#DeleteGrpcRouteRequest.
466 }
467 op, err := c.DeleteGrpcRoute(ctx, req)
468 if err != nil {
469 // TODO: Handle error.
470 }
471
472 err = op.Wait(ctx)
473 if err != nil {
474 // TODO: Handle error.
475 }
476 }
477
478 func ExampleClient_DeleteHttpRoute() {
479 ctx := context.Background()
480 // This snippet has been automatically generated and should be regarded as a code template only.
481 // It will require modifications to work:
482 // - It may require correct/in-range values for request initialization.
483 // - It may require specifying regional endpoints when creating the service client as shown in:
484 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
485 c, err := networkservices.NewClient(ctx)
486 if err != nil {
487 // TODO: Handle error.
488 }
489 defer c.Close()
490
491 req := &networkservicespb.DeleteHttpRouteRequest{
492 // TODO: Fill request struct fields.
493 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#DeleteHttpRouteRequest.
494 }
495 op, err := c.DeleteHttpRoute(ctx, req)
496 if err != nil {
497 // TODO: Handle error.
498 }
499
500 err = op.Wait(ctx)
501 if err != nil {
502 // TODO: Handle error.
503 }
504 }
505
506 func ExampleClient_DeleteMesh() {
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 := networkservices.NewClient(ctx)
514 if err != nil {
515 // TODO: Handle error.
516 }
517 defer c.Close()
518
519 req := &networkservicespb.DeleteMeshRequest{
520 // TODO: Fill request struct fields.
521 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#DeleteMeshRequest.
522 }
523 op, err := c.DeleteMesh(ctx, req)
524 if err != nil {
525 // TODO: Handle error.
526 }
527
528 err = op.Wait(ctx)
529 if err != nil {
530 // TODO: Handle error.
531 }
532 }
533
534 func ExampleClient_DeleteServiceBinding() {
535 ctx := context.Background()
536 // This snippet has been automatically generated and should be regarded as a code template only.
537 // It will require modifications to work:
538 // - It may require correct/in-range values for request initialization.
539 // - It may require specifying regional endpoints when creating the service client as shown in:
540 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
541 c, err := networkservices.NewClient(ctx)
542 if err != nil {
543 // TODO: Handle error.
544 }
545 defer c.Close()
546
547 req := &networkservicespb.DeleteServiceBindingRequest{
548 // TODO: Fill request struct fields.
549 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#DeleteServiceBindingRequest.
550 }
551 op, err := c.DeleteServiceBinding(ctx, req)
552 if err != nil {
553 // TODO: Handle error.
554 }
555
556 err = op.Wait(ctx)
557 if err != nil {
558 // TODO: Handle error.
559 }
560 }
561
562 func ExampleClient_DeleteServiceLbPolicy() {
563 ctx := context.Background()
564 // This snippet has been automatically generated and should be regarded as a code template only.
565 // It will require modifications to work:
566 // - It may require correct/in-range values for request initialization.
567 // - It may require specifying regional endpoints when creating the service client as shown in:
568 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
569 c, err := networkservices.NewClient(ctx)
570 if err != nil {
571 // TODO: Handle error.
572 }
573 defer c.Close()
574
575 req := &networkservicespb.DeleteServiceLbPolicyRequest{
576 // TODO: Fill request struct fields.
577 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#DeleteServiceLbPolicyRequest.
578 }
579 op, err := c.DeleteServiceLbPolicy(ctx, req)
580 if err != nil {
581 // TODO: Handle error.
582 }
583
584 err = op.Wait(ctx)
585 if err != nil {
586 // TODO: Handle error.
587 }
588 }
589
590 func ExampleClient_DeleteTcpRoute() {
591 ctx := context.Background()
592 // This snippet has been automatically generated and should be regarded as a code template only.
593 // It will require modifications to work:
594 // - It may require correct/in-range values for request initialization.
595 // - It may require specifying regional endpoints when creating the service client as shown in:
596 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
597 c, err := networkservices.NewClient(ctx)
598 if err != nil {
599 // TODO: Handle error.
600 }
601 defer c.Close()
602
603 req := &networkservicespb.DeleteTcpRouteRequest{
604 // TODO: Fill request struct fields.
605 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#DeleteTcpRouteRequest.
606 }
607 op, err := c.DeleteTcpRoute(ctx, req)
608 if err != nil {
609 // TODO: Handle error.
610 }
611
612 err = op.Wait(ctx)
613 if err != nil {
614 // TODO: Handle error.
615 }
616 }
617
618 func ExampleClient_DeleteTlsRoute() {
619 ctx := context.Background()
620 // This snippet has been automatically generated and should be regarded as a code template only.
621 // It will require modifications to work:
622 // - It may require correct/in-range values for request initialization.
623 // - It may require specifying regional endpoints when creating the service client as shown in:
624 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
625 c, err := networkservices.NewClient(ctx)
626 if err != nil {
627 // TODO: Handle error.
628 }
629 defer c.Close()
630
631 req := &networkservicespb.DeleteTlsRouteRequest{
632 // TODO: Fill request struct fields.
633 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#DeleteTlsRouteRequest.
634 }
635 op, err := c.DeleteTlsRoute(ctx, req)
636 if err != nil {
637 // TODO: Handle error.
638 }
639
640 err = op.Wait(ctx)
641 if err != nil {
642 // TODO: Handle error.
643 }
644 }
645
646 func ExampleClient_DeleteWasmPlugin() {
647 ctx := context.Background()
648 // This snippet has been automatically generated and should be regarded as a code template only.
649 // It will require modifications to work:
650 // - It may require correct/in-range values for request initialization.
651 // - It may require specifying regional endpoints when creating the service client as shown in:
652 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
653 c, err := networkservices.NewClient(ctx)
654 if err != nil {
655 // TODO: Handle error.
656 }
657 defer c.Close()
658
659 req := &networkservicespb.DeleteWasmPluginRequest{
660 // TODO: Fill request struct fields.
661 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#DeleteWasmPluginRequest.
662 }
663 op, err := c.DeleteWasmPlugin(ctx, req)
664 if err != nil {
665 // TODO: Handle error.
666 }
667
668 err = op.Wait(ctx)
669 if err != nil {
670 // TODO: Handle error.
671 }
672 }
673
674 func ExampleClient_DeleteWasmPluginVersion() {
675 ctx := context.Background()
676 // This snippet has been automatically generated and should be regarded as a code template only.
677 // It will require modifications to work:
678 // - It may require correct/in-range values for request initialization.
679 // - It may require specifying regional endpoints when creating the service client as shown in:
680 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
681 c, err := networkservices.NewClient(ctx)
682 if err != nil {
683 // TODO: Handle error.
684 }
685 defer c.Close()
686
687 req := &networkservicespb.DeleteWasmPluginVersionRequest{
688 // TODO: Fill request struct fields.
689 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#DeleteWasmPluginVersionRequest.
690 }
691 op, err := c.DeleteWasmPluginVersion(ctx, req)
692 if err != nil {
693 // TODO: Handle error.
694 }
695
696 err = op.Wait(ctx)
697 if err != nil {
698 // TODO: Handle error.
699 }
700 }
701
702 func ExampleClient_GetEndpointPolicy() {
703 ctx := context.Background()
704 // This snippet has been automatically generated and should be regarded as a code template only.
705 // It will require modifications to work:
706 // - It may require correct/in-range values for request initialization.
707 // - It may require specifying regional endpoints when creating the service client as shown in:
708 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
709 c, err := networkservices.NewClient(ctx)
710 if err != nil {
711 // TODO: Handle error.
712 }
713 defer c.Close()
714
715 req := &networkservicespb.GetEndpointPolicyRequest{
716 // TODO: Fill request struct fields.
717 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#GetEndpointPolicyRequest.
718 }
719 resp, err := c.GetEndpointPolicy(ctx, req)
720 if err != nil {
721 // TODO: Handle error.
722 }
723 // TODO: Use resp.
724 _ = resp
725 }
726
727 func ExampleClient_GetGateway() {
728 ctx := context.Background()
729 // This snippet has been automatically generated and should be regarded as a code template only.
730 // It will require modifications to work:
731 // - It may require correct/in-range values for request initialization.
732 // - It may require specifying regional endpoints when creating the service client as shown in:
733 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
734 c, err := networkservices.NewClient(ctx)
735 if err != nil {
736 // TODO: Handle error.
737 }
738 defer c.Close()
739
740 req := &networkservicespb.GetGatewayRequest{
741 // TODO: Fill request struct fields.
742 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#GetGatewayRequest.
743 }
744 resp, err := c.GetGateway(ctx, req)
745 if err != nil {
746 // TODO: Handle error.
747 }
748 // TODO: Use resp.
749 _ = resp
750 }
751
752 func ExampleClient_GetGatewayRouteView() {
753 ctx := context.Background()
754 // This snippet has been automatically generated and should be regarded as a code template only.
755 // It will require modifications to work:
756 // - It may require correct/in-range values for request initialization.
757 // - It may require specifying regional endpoints when creating the service client as shown in:
758 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
759 c, err := networkservices.NewClient(ctx)
760 if err != nil {
761 // TODO: Handle error.
762 }
763 defer c.Close()
764
765 req := &networkservicespb.GetGatewayRouteViewRequest{
766 // TODO: Fill request struct fields.
767 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#GetGatewayRouteViewRequest.
768 }
769 resp, err := c.GetGatewayRouteView(ctx, req)
770 if err != nil {
771 // TODO: Handle error.
772 }
773 // TODO: Use resp.
774 _ = resp
775 }
776
777 func ExampleClient_GetGrpcRoute() {
778 ctx := context.Background()
779 // This snippet has been automatically generated and should be regarded as a code template only.
780 // It will require modifications to work:
781 // - It may require correct/in-range values for request initialization.
782 // - It may require specifying regional endpoints when creating the service client as shown in:
783 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
784 c, err := networkservices.NewClient(ctx)
785 if err != nil {
786 // TODO: Handle error.
787 }
788 defer c.Close()
789
790 req := &networkservicespb.GetGrpcRouteRequest{
791 // TODO: Fill request struct fields.
792 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#GetGrpcRouteRequest.
793 }
794 resp, err := c.GetGrpcRoute(ctx, req)
795 if err != nil {
796 // TODO: Handle error.
797 }
798 // TODO: Use resp.
799 _ = resp
800 }
801
802 func ExampleClient_GetHttpRoute() {
803 ctx := context.Background()
804 // This snippet has been automatically generated and should be regarded as a code template only.
805 // It will require modifications to work:
806 // - It may require correct/in-range values for request initialization.
807 // - It may require specifying regional endpoints when creating the service client as shown in:
808 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
809 c, err := networkservices.NewClient(ctx)
810 if err != nil {
811 // TODO: Handle error.
812 }
813 defer c.Close()
814
815 req := &networkservicespb.GetHttpRouteRequest{
816 // TODO: Fill request struct fields.
817 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#GetHttpRouteRequest.
818 }
819 resp, err := c.GetHttpRoute(ctx, req)
820 if err != nil {
821 // TODO: Handle error.
822 }
823 // TODO: Use resp.
824 _ = resp
825 }
826
827 func ExampleClient_GetMesh() {
828 ctx := context.Background()
829 // This snippet has been automatically generated and should be regarded as a code template only.
830 // It will require modifications to work:
831 // - It may require correct/in-range values for request initialization.
832 // - It may require specifying regional endpoints when creating the service client as shown in:
833 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
834 c, err := networkservices.NewClient(ctx)
835 if err != nil {
836 // TODO: Handle error.
837 }
838 defer c.Close()
839
840 req := &networkservicespb.GetMeshRequest{
841 // TODO: Fill request struct fields.
842 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#GetMeshRequest.
843 }
844 resp, err := c.GetMesh(ctx, req)
845 if err != nil {
846 // TODO: Handle error.
847 }
848 // TODO: Use resp.
849 _ = resp
850 }
851
852 func ExampleClient_GetMeshRouteView() {
853 ctx := context.Background()
854 // This snippet has been automatically generated and should be regarded as a code template only.
855 // It will require modifications to work:
856 // - It may require correct/in-range values for request initialization.
857 // - It may require specifying regional endpoints when creating the service client as shown in:
858 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
859 c, err := networkservices.NewClient(ctx)
860 if err != nil {
861 // TODO: Handle error.
862 }
863 defer c.Close()
864
865 req := &networkservicespb.GetMeshRouteViewRequest{
866 // TODO: Fill request struct fields.
867 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#GetMeshRouteViewRequest.
868 }
869 resp, err := c.GetMeshRouteView(ctx, req)
870 if err != nil {
871 // TODO: Handle error.
872 }
873 // TODO: Use resp.
874 _ = resp
875 }
876
877 func ExampleClient_GetServiceBinding() {
878 ctx := context.Background()
879 // This snippet has been automatically generated and should be regarded as a code template only.
880 // It will require modifications to work:
881 // - It may require correct/in-range values for request initialization.
882 // - It may require specifying regional endpoints when creating the service client as shown in:
883 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
884 c, err := networkservices.NewClient(ctx)
885 if err != nil {
886 // TODO: Handle error.
887 }
888 defer c.Close()
889
890 req := &networkservicespb.GetServiceBindingRequest{
891 // TODO: Fill request struct fields.
892 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#GetServiceBindingRequest.
893 }
894 resp, err := c.GetServiceBinding(ctx, req)
895 if err != nil {
896 // TODO: Handle error.
897 }
898 // TODO: Use resp.
899 _ = resp
900 }
901
902 func ExampleClient_GetServiceLbPolicy() {
903 ctx := context.Background()
904 // This snippet has been automatically generated and should be regarded as a code template only.
905 // It will require modifications to work:
906 // - It may require correct/in-range values for request initialization.
907 // - It may require specifying regional endpoints when creating the service client as shown in:
908 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
909 c, err := networkservices.NewClient(ctx)
910 if err != nil {
911 // TODO: Handle error.
912 }
913 defer c.Close()
914
915 req := &networkservicespb.GetServiceLbPolicyRequest{
916 // TODO: Fill request struct fields.
917 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#GetServiceLbPolicyRequest.
918 }
919 resp, err := c.GetServiceLbPolicy(ctx, req)
920 if err != nil {
921 // TODO: Handle error.
922 }
923 // TODO: Use resp.
924 _ = resp
925 }
926
927 func ExampleClient_GetTcpRoute() {
928 ctx := context.Background()
929 // This snippet has been automatically generated and should be regarded as a code template only.
930 // It will require modifications to work:
931 // - It may require correct/in-range values for request initialization.
932 // - It may require specifying regional endpoints when creating the service client as shown in:
933 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
934 c, err := networkservices.NewClient(ctx)
935 if err != nil {
936 // TODO: Handle error.
937 }
938 defer c.Close()
939
940 req := &networkservicespb.GetTcpRouteRequest{
941 // TODO: Fill request struct fields.
942 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#GetTcpRouteRequest.
943 }
944 resp, err := c.GetTcpRoute(ctx, req)
945 if err != nil {
946 // TODO: Handle error.
947 }
948 // TODO: Use resp.
949 _ = resp
950 }
951
952 func ExampleClient_GetTlsRoute() {
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 := networkservices.NewClient(ctx)
960 if err != nil {
961 // TODO: Handle error.
962 }
963 defer c.Close()
964
965 req := &networkservicespb.GetTlsRouteRequest{
966 // TODO: Fill request struct fields.
967 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#GetTlsRouteRequest.
968 }
969 resp, err := c.GetTlsRoute(ctx, req)
970 if err != nil {
971 // TODO: Handle error.
972 }
973 // TODO: Use resp.
974 _ = resp
975 }
976
977 func ExampleClient_GetWasmPlugin() {
978 ctx := context.Background()
979 // This snippet has been automatically generated and should be regarded as a code template only.
980 // It will require modifications to work:
981 // - It may require correct/in-range values for request initialization.
982 // - It may require specifying regional endpoints when creating the service client as shown in:
983 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
984 c, err := networkservices.NewClient(ctx)
985 if err != nil {
986 // TODO: Handle error.
987 }
988 defer c.Close()
989
990 req := &networkservicespb.GetWasmPluginRequest{
991 // TODO: Fill request struct fields.
992 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#GetWasmPluginRequest.
993 }
994 resp, err := c.GetWasmPlugin(ctx, req)
995 if err != nil {
996 // TODO: Handle error.
997 }
998 // TODO: Use resp.
999 _ = resp
1000 }
1001
1002 func ExampleClient_GetWasmPluginVersion() {
1003 ctx := context.Background()
1004 // This snippet has been automatically generated and should be regarded as a code template only.
1005 // It will require modifications to work:
1006 // - It may require correct/in-range values for request initialization.
1007 // - It may require specifying regional endpoints when creating the service client as shown in:
1008 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1009 c, err := networkservices.NewClient(ctx)
1010 if err != nil {
1011 // TODO: Handle error.
1012 }
1013 defer c.Close()
1014
1015 req := &networkservicespb.GetWasmPluginVersionRequest{
1016 // TODO: Fill request struct fields.
1017 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#GetWasmPluginVersionRequest.
1018 }
1019 resp, err := c.GetWasmPluginVersion(ctx, req)
1020 if err != nil {
1021 // TODO: Handle error.
1022 }
1023 // TODO: Use resp.
1024 _ = resp
1025 }
1026
1027 func ExampleClient_ListEndpointPolicies() {
1028 ctx := context.Background()
1029 // This snippet has been automatically generated and should be regarded as a code template only.
1030 // It will require modifications to work:
1031 // - It may require correct/in-range values for request initialization.
1032 // - It may require specifying regional endpoints when creating the service client as shown in:
1033 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1034 c, err := networkservices.NewClient(ctx)
1035 if err != nil {
1036 // TODO: Handle error.
1037 }
1038 defer c.Close()
1039
1040 req := &networkservicespb.ListEndpointPoliciesRequest{
1041 // TODO: Fill request struct fields.
1042 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#ListEndpointPoliciesRequest.
1043 }
1044 it := c.ListEndpointPolicies(ctx, req)
1045 for {
1046 resp, err := it.Next()
1047 if err == iterator.Done {
1048 break
1049 }
1050 if err != nil {
1051 // TODO: Handle error.
1052 }
1053 // TODO: Use resp.
1054 _ = resp
1055
1056 // If you need to access the underlying RPC response,
1057 // you can do so by casting the `Response` as below.
1058 // Otherwise, remove this line. Only populated after
1059 // first call to Next(). Not safe for concurrent access.
1060 _ = it.Response.(*networkservicespb.ListEndpointPoliciesResponse)
1061 }
1062 }
1063
1064 func ExampleClient_ListGatewayRouteViews() {
1065 ctx := context.Background()
1066 // This snippet has been automatically generated and should be regarded as a code template only.
1067 // It will require modifications to work:
1068 // - It may require correct/in-range values for request initialization.
1069 // - It may require specifying regional endpoints when creating the service client as shown in:
1070 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1071 c, err := networkservices.NewClient(ctx)
1072 if err != nil {
1073 // TODO: Handle error.
1074 }
1075 defer c.Close()
1076
1077 req := &networkservicespb.ListGatewayRouteViewsRequest{
1078 // TODO: Fill request struct fields.
1079 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#ListGatewayRouteViewsRequest.
1080 }
1081 it := c.ListGatewayRouteViews(ctx, req)
1082 for {
1083 resp, err := it.Next()
1084 if err == iterator.Done {
1085 break
1086 }
1087 if err != nil {
1088 // TODO: Handle error.
1089 }
1090 // TODO: Use resp.
1091 _ = resp
1092
1093 // If you need to access the underlying RPC response,
1094 // you can do so by casting the `Response` as below.
1095 // Otherwise, remove this line. Only populated after
1096 // first call to Next(). Not safe for concurrent access.
1097 _ = it.Response.(*networkservicespb.ListGatewayRouteViewsResponse)
1098 }
1099 }
1100
1101 func ExampleClient_ListGateways() {
1102 ctx := context.Background()
1103 // This snippet has been automatically generated and should be regarded as a code template only.
1104 // It will require modifications to work:
1105 // - It may require correct/in-range values for request initialization.
1106 // - It may require specifying regional endpoints when creating the service client as shown in:
1107 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1108 c, err := networkservices.NewClient(ctx)
1109 if err != nil {
1110 // TODO: Handle error.
1111 }
1112 defer c.Close()
1113
1114 req := &networkservicespb.ListGatewaysRequest{
1115 // TODO: Fill request struct fields.
1116 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#ListGatewaysRequest.
1117 }
1118 it := c.ListGateways(ctx, req)
1119 for {
1120 resp, err := it.Next()
1121 if err == iterator.Done {
1122 break
1123 }
1124 if err != nil {
1125 // TODO: Handle error.
1126 }
1127 // TODO: Use resp.
1128 _ = resp
1129
1130 // If you need to access the underlying RPC response,
1131 // you can do so by casting the `Response` as below.
1132 // Otherwise, remove this line. Only populated after
1133 // first call to Next(). Not safe for concurrent access.
1134 _ = it.Response.(*networkservicespb.ListGatewaysResponse)
1135 }
1136 }
1137
1138 func ExampleClient_ListGrpcRoutes() {
1139 ctx := context.Background()
1140 // This snippet has been automatically generated and should be regarded as a code template only.
1141 // It will require modifications to work:
1142 // - It may require correct/in-range values for request initialization.
1143 // - It may require specifying regional endpoints when creating the service client as shown in:
1144 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1145 c, err := networkservices.NewClient(ctx)
1146 if err != nil {
1147 // TODO: Handle error.
1148 }
1149 defer c.Close()
1150
1151 req := &networkservicespb.ListGrpcRoutesRequest{
1152 // TODO: Fill request struct fields.
1153 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#ListGrpcRoutesRequest.
1154 }
1155 it := c.ListGrpcRoutes(ctx, req)
1156 for {
1157 resp, err := it.Next()
1158 if err == iterator.Done {
1159 break
1160 }
1161 if err != nil {
1162 // TODO: Handle error.
1163 }
1164 // TODO: Use resp.
1165 _ = resp
1166
1167 // If you need to access the underlying RPC response,
1168 // you can do so by casting the `Response` as below.
1169 // Otherwise, remove this line. Only populated after
1170 // first call to Next(). Not safe for concurrent access.
1171 _ = it.Response.(*networkservicespb.ListGrpcRoutesResponse)
1172 }
1173 }
1174
1175 func ExampleClient_ListHttpRoutes() {
1176 ctx := context.Background()
1177 // This snippet has been automatically generated and should be regarded as a code template only.
1178 // It will require modifications to work:
1179 // - It may require correct/in-range values for request initialization.
1180 // - It may require specifying regional endpoints when creating the service client as shown in:
1181 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1182 c, err := networkservices.NewClient(ctx)
1183 if err != nil {
1184 // TODO: Handle error.
1185 }
1186 defer c.Close()
1187
1188 req := &networkservicespb.ListHttpRoutesRequest{
1189 // TODO: Fill request struct fields.
1190 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#ListHttpRoutesRequest.
1191 }
1192 it := c.ListHttpRoutes(ctx, req)
1193 for {
1194 resp, err := it.Next()
1195 if err == iterator.Done {
1196 break
1197 }
1198 if err != nil {
1199 // TODO: Handle error.
1200 }
1201 // TODO: Use resp.
1202 _ = resp
1203
1204 // If you need to access the underlying RPC response,
1205 // you can do so by casting the `Response` as below.
1206 // Otherwise, remove this line. Only populated after
1207 // first call to Next(). Not safe for concurrent access.
1208 _ = it.Response.(*networkservicespb.ListHttpRoutesResponse)
1209 }
1210 }
1211
1212 func ExampleClient_ListMeshRouteViews() {
1213 ctx := context.Background()
1214 // This snippet has been automatically generated and should be regarded as a code template only.
1215 // It will require modifications to work:
1216 // - It may require correct/in-range values for request initialization.
1217 // - It may require specifying regional endpoints when creating the service client as shown in:
1218 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1219 c, err := networkservices.NewClient(ctx)
1220 if err != nil {
1221 // TODO: Handle error.
1222 }
1223 defer c.Close()
1224
1225 req := &networkservicespb.ListMeshRouteViewsRequest{
1226 // TODO: Fill request struct fields.
1227 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#ListMeshRouteViewsRequest.
1228 }
1229 it := c.ListMeshRouteViews(ctx, req)
1230 for {
1231 resp, err := it.Next()
1232 if err == iterator.Done {
1233 break
1234 }
1235 if err != nil {
1236 // TODO: Handle error.
1237 }
1238 // TODO: Use resp.
1239 _ = resp
1240
1241 // If you need to access the underlying RPC response,
1242 // you can do so by casting the `Response` as below.
1243 // Otherwise, remove this line. Only populated after
1244 // first call to Next(). Not safe for concurrent access.
1245 _ = it.Response.(*networkservicespb.ListMeshRouteViewsResponse)
1246 }
1247 }
1248
1249 func ExampleClient_ListMeshes() {
1250 ctx := context.Background()
1251 // This snippet has been automatically generated and should be regarded as a code template only.
1252 // It will require modifications to work:
1253 // - It may require correct/in-range values for request initialization.
1254 // - It may require specifying regional endpoints when creating the service client as shown in:
1255 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1256 c, err := networkservices.NewClient(ctx)
1257 if err != nil {
1258 // TODO: Handle error.
1259 }
1260 defer c.Close()
1261
1262 req := &networkservicespb.ListMeshesRequest{
1263 // TODO: Fill request struct fields.
1264 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#ListMeshesRequest.
1265 }
1266 it := c.ListMeshes(ctx, req)
1267 for {
1268 resp, err := it.Next()
1269 if err == iterator.Done {
1270 break
1271 }
1272 if err != nil {
1273 // TODO: Handle error.
1274 }
1275 // TODO: Use resp.
1276 _ = resp
1277
1278 // If you need to access the underlying RPC response,
1279 // you can do so by casting the `Response` as below.
1280 // Otherwise, remove this line. Only populated after
1281 // first call to Next(). Not safe for concurrent access.
1282 _ = it.Response.(*networkservicespb.ListMeshesResponse)
1283 }
1284 }
1285
1286 func ExampleClient_ListServiceBindings() {
1287 ctx := context.Background()
1288 // This snippet has been automatically generated and should be regarded as a code template only.
1289 // It will require modifications to work:
1290 // - It may require correct/in-range values for request initialization.
1291 // - It may require specifying regional endpoints when creating the service client as shown in:
1292 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1293 c, err := networkservices.NewClient(ctx)
1294 if err != nil {
1295 // TODO: Handle error.
1296 }
1297 defer c.Close()
1298
1299 req := &networkservicespb.ListServiceBindingsRequest{
1300 // TODO: Fill request struct fields.
1301 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#ListServiceBindingsRequest.
1302 }
1303 it := c.ListServiceBindings(ctx, req)
1304 for {
1305 resp, err := it.Next()
1306 if err == iterator.Done {
1307 break
1308 }
1309 if err != nil {
1310 // TODO: Handle error.
1311 }
1312 // TODO: Use resp.
1313 _ = resp
1314
1315 // If you need to access the underlying RPC response,
1316 // you can do so by casting the `Response` as below.
1317 // Otherwise, remove this line. Only populated after
1318 // first call to Next(). Not safe for concurrent access.
1319 _ = it.Response.(*networkservicespb.ListServiceBindingsResponse)
1320 }
1321 }
1322
1323 func ExampleClient_ListServiceLbPolicies() {
1324 ctx := context.Background()
1325 // This snippet has been automatically generated and should be regarded as a code template only.
1326 // It will require modifications to work:
1327 // - It may require correct/in-range values for request initialization.
1328 // - It may require specifying regional endpoints when creating the service client as shown in:
1329 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1330 c, err := networkservices.NewClient(ctx)
1331 if err != nil {
1332 // TODO: Handle error.
1333 }
1334 defer c.Close()
1335
1336 req := &networkservicespb.ListServiceLbPoliciesRequest{
1337 // TODO: Fill request struct fields.
1338 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#ListServiceLbPoliciesRequest.
1339 }
1340 it := c.ListServiceLbPolicies(ctx, req)
1341 for {
1342 resp, err := it.Next()
1343 if err == iterator.Done {
1344 break
1345 }
1346 if err != nil {
1347 // TODO: Handle error.
1348 }
1349 // TODO: Use resp.
1350 _ = resp
1351
1352 // If you need to access the underlying RPC response,
1353 // you can do so by casting the `Response` as below.
1354 // Otherwise, remove this line. Only populated after
1355 // first call to Next(). Not safe for concurrent access.
1356 _ = it.Response.(*networkservicespb.ListServiceLbPoliciesResponse)
1357 }
1358 }
1359
1360 func ExampleClient_ListTcpRoutes() {
1361 ctx := context.Background()
1362 // This snippet has been automatically generated and should be regarded as a code template only.
1363 // It will require modifications to work:
1364 // - It may require correct/in-range values for request initialization.
1365 // - It may require specifying regional endpoints when creating the service client as shown in:
1366 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1367 c, err := networkservices.NewClient(ctx)
1368 if err != nil {
1369 // TODO: Handle error.
1370 }
1371 defer c.Close()
1372
1373 req := &networkservicespb.ListTcpRoutesRequest{
1374 // TODO: Fill request struct fields.
1375 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#ListTcpRoutesRequest.
1376 }
1377 it := c.ListTcpRoutes(ctx, req)
1378 for {
1379 resp, err := it.Next()
1380 if err == iterator.Done {
1381 break
1382 }
1383 if err != nil {
1384 // TODO: Handle error.
1385 }
1386 // TODO: Use resp.
1387 _ = resp
1388
1389 // If you need to access the underlying RPC response,
1390 // you can do so by casting the `Response` as below.
1391 // Otherwise, remove this line. Only populated after
1392 // first call to Next(). Not safe for concurrent access.
1393 _ = it.Response.(*networkservicespb.ListTcpRoutesResponse)
1394 }
1395 }
1396
1397 func ExampleClient_ListTlsRoutes() {
1398 ctx := context.Background()
1399 // This snippet has been automatically generated and should be regarded as a code template only.
1400 // It will require modifications to work:
1401 // - It may require correct/in-range values for request initialization.
1402 // - It may require specifying regional endpoints when creating the service client as shown in:
1403 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1404 c, err := networkservices.NewClient(ctx)
1405 if err != nil {
1406 // TODO: Handle error.
1407 }
1408 defer c.Close()
1409
1410 req := &networkservicespb.ListTlsRoutesRequest{
1411 // TODO: Fill request struct fields.
1412 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#ListTlsRoutesRequest.
1413 }
1414 it := c.ListTlsRoutes(ctx, req)
1415 for {
1416 resp, err := it.Next()
1417 if err == iterator.Done {
1418 break
1419 }
1420 if err != nil {
1421 // TODO: Handle error.
1422 }
1423 // TODO: Use resp.
1424 _ = resp
1425
1426 // If you need to access the underlying RPC response,
1427 // you can do so by casting the `Response` as below.
1428 // Otherwise, remove this line. Only populated after
1429 // first call to Next(). Not safe for concurrent access.
1430 _ = it.Response.(*networkservicespb.ListTlsRoutesResponse)
1431 }
1432 }
1433
1434 func ExampleClient_ListWasmPluginVersions() {
1435 ctx := context.Background()
1436 // This snippet has been automatically generated and should be regarded as a code template only.
1437 // It will require modifications to work:
1438 // - It may require correct/in-range values for request initialization.
1439 // - It may require specifying regional endpoints when creating the service client as shown in:
1440 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1441 c, err := networkservices.NewClient(ctx)
1442 if err != nil {
1443 // TODO: Handle error.
1444 }
1445 defer c.Close()
1446
1447 req := &networkservicespb.ListWasmPluginVersionsRequest{
1448 // TODO: Fill request struct fields.
1449 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#ListWasmPluginVersionsRequest.
1450 }
1451 it := c.ListWasmPluginVersions(ctx, req)
1452 for {
1453 resp, err := it.Next()
1454 if err == iterator.Done {
1455 break
1456 }
1457 if err != nil {
1458 // TODO: Handle error.
1459 }
1460 // TODO: Use resp.
1461 _ = resp
1462
1463 // If you need to access the underlying RPC response,
1464 // you can do so by casting the `Response` as below.
1465 // Otherwise, remove this line. Only populated after
1466 // first call to Next(). Not safe for concurrent access.
1467 _ = it.Response.(*networkservicespb.ListWasmPluginVersionsResponse)
1468 }
1469 }
1470
1471 func ExampleClient_ListWasmPlugins() {
1472 ctx := context.Background()
1473 // This snippet has been automatically generated and should be regarded as a code template only.
1474 // It will require modifications to work:
1475 // - It may require correct/in-range values for request initialization.
1476 // - It may require specifying regional endpoints when creating the service client as shown in:
1477 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1478 c, err := networkservices.NewClient(ctx)
1479 if err != nil {
1480 // TODO: Handle error.
1481 }
1482 defer c.Close()
1483
1484 req := &networkservicespb.ListWasmPluginsRequest{
1485 // TODO: Fill request struct fields.
1486 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#ListWasmPluginsRequest.
1487 }
1488 it := c.ListWasmPlugins(ctx, req)
1489 for {
1490 resp, err := it.Next()
1491 if err == iterator.Done {
1492 break
1493 }
1494 if err != nil {
1495 // TODO: Handle error.
1496 }
1497 // TODO: Use resp.
1498 _ = resp
1499
1500 // If you need to access the underlying RPC response,
1501 // you can do so by casting the `Response` as below.
1502 // Otherwise, remove this line. Only populated after
1503 // first call to Next(). Not safe for concurrent access.
1504 _ = it.Response.(*networkservicespb.ListWasmPluginsResponse)
1505 }
1506 }
1507
1508 func ExampleClient_UpdateEndpointPolicy() {
1509 ctx := context.Background()
1510 // This snippet has been automatically generated and should be regarded as a code template only.
1511 // It will require modifications to work:
1512 // - It may require correct/in-range values for request initialization.
1513 // - It may require specifying regional endpoints when creating the service client as shown in:
1514 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1515 c, err := networkservices.NewClient(ctx)
1516 if err != nil {
1517 // TODO: Handle error.
1518 }
1519 defer c.Close()
1520
1521 req := &networkservicespb.UpdateEndpointPolicyRequest{
1522 // TODO: Fill request struct fields.
1523 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#UpdateEndpointPolicyRequest.
1524 }
1525 op, err := c.UpdateEndpointPolicy(ctx, req)
1526 if err != nil {
1527 // TODO: Handle error.
1528 }
1529
1530 resp, err := op.Wait(ctx)
1531 if err != nil {
1532 // TODO: Handle error.
1533 }
1534 // TODO: Use resp.
1535 _ = resp
1536 }
1537
1538 func ExampleClient_UpdateGateway() {
1539 ctx := context.Background()
1540 // This snippet has been automatically generated and should be regarded as a code template only.
1541 // It will require modifications to work:
1542 // - It may require correct/in-range values for request initialization.
1543 // - It may require specifying regional endpoints when creating the service client as shown in:
1544 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1545 c, err := networkservices.NewClient(ctx)
1546 if err != nil {
1547 // TODO: Handle error.
1548 }
1549 defer c.Close()
1550
1551 req := &networkservicespb.UpdateGatewayRequest{
1552 // TODO: Fill request struct fields.
1553 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#UpdateGatewayRequest.
1554 }
1555 op, err := c.UpdateGateway(ctx, req)
1556 if err != nil {
1557 // TODO: Handle error.
1558 }
1559
1560 resp, err := op.Wait(ctx)
1561 if err != nil {
1562 // TODO: Handle error.
1563 }
1564 // TODO: Use resp.
1565 _ = resp
1566 }
1567
1568 func ExampleClient_UpdateGrpcRoute() {
1569 ctx := context.Background()
1570 // This snippet has been automatically generated and should be regarded as a code template only.
1571 // It will require modifications to work:
1572 // - It may require correct/in-range values for request initialization.
1573 // - It may require specifying regional endpoints when creating the service client as shown in:
1574 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1575 c, err := networkservices.NewClient(ctx)
1576 if err != nil {
1577 // TODO: Handle error.
1578 }
1579 defer c.Close()
1580
1581 req := &networkservicespb.UpdateGrpcRouteRequest{
1582 // TODO: Fill request struct fields.
1583 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#UpdateGrpcRouteRequest.
1584 }
1585 op, err := c.UpdateGrpcRoute(ctx, req)
1586 if err != nil {
1587 // TODO: Handle error.
1588 }
1589
1590 resp, err := op.Wait(ctx)
1591 if err != nil {
1592 // TODO: Handle error.
1593 }
1594 // TODO: Use resp.
1595 _ = resp
1596 }
1597
1598 func ExampleClient_UpdateHttpRoute() {
1599 ctx := context.Background()
1600 // This snippet has been automatically generated and should be regarded as a code template only.
1601 // It will require modifications to work:
1602 // - It may require correct/in-range values for request initialization.
1603 // - It may require specifying regional endpoints when creating the service client as shown in:
1604 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1605 c, err := networkservices.NewClient(ctx)
1606 if err != nil {
1607 // TODO: Handle error.
1608 }
1609 defer c.Close()
1610
1611 req := &networkservicespb.UpdateHttpRouteRequest{
1612 // TODO: Fill request struct fields.
1613 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#UpdateHttpRouteRequest.
1614 }
1615 op, err := c.UpdateHttpRoute(ctx, req)
1616 if err != nil {
1617 // TODO: Handle error.
1618 }
1619
1620 resp, err := op.Wait(ctx)
1621 if err != nil {
1622 // TODO: Handle error.
1623 }
1624 // TODO: Use resp.
1625 _ = resp
1626 }
1627
1628 func ExampleClient_UpdateMesh() {
1629 ctx := context.Background()
1630 // This snippet has been automatically generated and should be regarded as a code template only.
1631 // It will require modifications to work:
1632 // - It may require correct/in-range values for request initialization.
1633 // - It may require specifying regional endpoints when creating the service client as shown in:
1634 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1635 c, err := networkservices.NewClient(ctx)
1636 if err != nil {
1637 // TODO: Handle error.
1638 }
1639 defer c.Close()
1640
1641 req := &networkservicespb.UpdateMeshRequest{
1642 // TODO: Fill request struct fields.
1643 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#UpdateMeshRequest.
1644 }
1645 op, err := c.UpdateMesh(ctx, req)
1646 if err != nil {
1647 // TODO: Handle error.
1648 }
1649
1650 resp, err := op.Wait(ctx)
1651 if err != nil {
1652 // TODO: Handle error.
1653 }
1654 // TODO: Use resp.
1655 _ = resp
1656 }
1657
1658 func ExampleClient_UpdateServiceBinding() {
1659 ctx := context.Background()
1660 // This snippet has been automatically generated and should be regarded as a code template only.
1661 // It will require modifications to work:
1662 // - It may require correct/in-range values for request initialization.
1663 // - It may require specifying regional endpoints when creating the service client as shown in:
1664 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1665 c, err := networkservices.NewClient(ctx)
1666 if err != nil {
1667 // TODO: Handle error.
1668 }
1669 defer c.Close()
1670
1671 req := &networkservicespb.UpdateServiceBindingRequest{
1672 // TODO: Fill request struct fields.
1673 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#UpdateServiceBindingRequest.
1674 }
1675 op, err := c.UpdateServiceBinding(ctx, req)
1676 if err != nil {
1677 // TODO: Handle error.
1678 }
1679
1680 resp, err := op.Wait(ctx)
1681 if err != nil {
1682 // TODO: Handle error.
1683 }
1684 // TODO: Use resp.
1685 _ = resp
1686 }
1687
1688 func ExampleClient_UpdateServiceLbPolicy() {
1689 ctx := context.Background()
1690 // This snippet has been automatically generated and should be regarded as a code template only.
1691 // It will require modifications to work:
1692 // - It may require correct/in-range values for request initialization.
1693 // - It may require specifying regional endpoints when creating the service client as shown in:
1694 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1695 c, err := networkservices.NewClient(ctx)
1696 if err != nil {
1697 // TODO: Handle error.
1698 }
1699 defer c.Close()
1700
1701 req := &networkservicespb.UpdateServiceLbPolicyRequest{
1702 // TODO: Fill request struct fields.
1703 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#UpdateServiceLbPolicyRequest.
1704 }
1705 op, err := c.UpdateServiceLbPolicy(ctx, req)
1706 if err != nil {
1707 // TODO: Handle error.
1708 }
1709
1710 resp, err := op.Wait(ctx)
1711 if err != nil {
1712 // TODO: Handle error.
1713 }
1714 // TODO: Use resp.
1715 _ = resp
1716 }
1717
1718 func ExampleClient_UpdateTcpRoute() {
1719 ctx := context.Background()
1720 // This snippet has been automatically generated and should be regarded as a code template only.
1721 // It will require modifications to work:
1722 // - It may require correct/in-range values for request initialization.
1723 // - It may require specifying regional endpoints when creating the service client as shown in:
1724 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1725 c, err := networkservices.NewClient(ctx)
1726 if err != nil {
1727 // TODO: Handle error.
1728 }
1729 defer c.Close()
1730
1731 req := &networkservicespb.UpdateTcpRouteRequest{
1732 // TODO: Fill request struct fields.
1733 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#UpdateTcpRouteRequest.
1734 }
1735 op, err := c.UpdateTcpRoute(ctx, req)
1736 if err != nil {
1737 // TODO: Handle error.
1738 }
1739
1740 resp, err := op.Wait(ctx)
1741 if err != nil {
1742 // TODO: Handle error.
1743 }
1744 // TODO: Use resp.
1745 _ = resp
1746 }
1747
1748 func ExampleClient_UpdateTlsRoute() {
1749 ctx := context.Background()
1750 // This snippet has been automatically generated and should be regarded as a code template only.
1751 // It will require modifications to work:
1752 // - It may require correct/in-range values for request initialization.
1753 // - It may require specifying regional endpoints when creating the service client as shown in:
1754 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1755 c, err := networkservices.NewClient(ctx)
1756 if err != nil {
1757 // TODO: Handle error.
1758 }
1759 defer c.Close()
1760
1761 req := &networkservicespb.UpdateTlsRouteRequest{
1762 // TODO: Fill request struct fields.
1763 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#UpdateTlsRouteRequest.
1764 }
1765 op, err := c.UpdateTlsRoute(ctx, req)
1766 if err != nil {
1767 // TODO: Handle error.
1768 }
1769
1770 resp, err := op.Wait(ctx)
1771 if err != nil {
1772 // TODO: Handle error.
1773 }
1774 // TODO: Use resp.
1775 _ = resp
1776 }
1777
1778 func ExampleClient_UpdateWasmPlugin() {
1779 ctx := context.Background()
1780 // This snippet has been automatically generated and should be regarded as a code template only.
1781 // It will require modifications to work:
1782 // - It may require correct/in-range values for request initialization.
1783 // - It may require specifying regional endpoints when creating the service client as shown in:
1784 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1785 c, err := networkservices.NewClient(ctx)
1786 if err != nil {
1787 // TODO: Handle error.
1788 }
1789 defer c.Close()
1790
1791 req := &networkservicespb.UpdateWasmPluginRequest{
1792 // TODO: Fill request struct fields.
1793 // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#UpdateWasmPluginRequest.
1794 }
1795 op, err := c.UpdateWasmPlugin(ctx, req)
1796 if err != nil {
1797 // TODO: Handle error.
1798 }
1799
1800 resp, err := op.Wait(ctx)
1801 if err != nil {
1802 // TODO: Handle error.
1803 }
1804 // TODO: Use resp.
1805 _ = resp
1806 }
1807
1808 func ExampleClient_GetLocation() {
1809 ctx := context.Background()
1810 // This snippet has been automatically generated and should be regarded as a code template only.
1811 // It will require modifications to work:
1812 // - It may require correct/in-range values for request initialization.
1813 // - It may require specifying regional endpoints when creating the service client as shown in:
1814 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1815 c, err := networkservices.NewClient(ctx)
1816 if err != nil {
1817 // TODO: Handle error.
1818 }
1819 defer c.Close()
1820
1821 req := &locationpb.GetLocationRequest{
1822 // TODO: Fill request struct fields.
1823 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
1824 }
1825 resp, err := c.GetLocation(ctx, req)
1826 if err != nil {
1827 // TODO: Handle error.
1828 }
1829 // TODO: Use resp.
1830 _ = resp
1831 }
1832
1833 func ExampleClient_ListLocations() {
1834 ctx := context.Background()
1835 // This snippet has been automatically generated and should be regarded as a code template only.
1836 // It will require modifications to work:
1837 // - It may require correct/in-range values for request initialization.
1838 // - It may require specifying regional endpoints when creating the service client as shown in:
1839 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1840 c, err := networkservices.NewClient(ctx)
1841 if err != nil {
1842 // TODO: Handle error.
1843 }
1844 defer c.Close()
1845
1846 req := &locationpb.ListLocationsRequest{
1847 // TODO: Fill request struct fields.
1848 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
1849 }
1850 it := c.ListLocations(ctx, req)
1851 for {
1852 resp, err := it.Next()
1853 if err == iterator.Done {
1854 break
1855 }
1856 if err != nil {
1857 // TODO: Handle error.
1858 }
1859 // TODO: Use resp.
1860 _ = resp
1861
1862 // If you need to access the underlying RPC response,
1863 // you can do so by casting the `Response` as below.
1864 // Otherwise, remove this line. Only populated after
1865 // first call to Next(). Not safe for concurrent access.
1866 _ = it.Response.(*locationpb.ListLocationsResponse)
1867 }
1868 }
1869
1870 func ExampleClient_GetIamPolicy() {
1871 ctx := context.Background()
1872 // This snippet has been automatically generated and should be regarded as a code template only.
1873 // It will require modifications to work:
1874 // - It may require correct/in-range values for request initialization.
1875 // - It may require specifying regional endpoints when creating the service client as shown in:
1876 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1877 c, err := networkservices.NewClient(ctx)
1878 if err != nil {
1879 // TODO: Handle error.
1880 }
1881 defer c.Close()
1882
1883 req := &iampb.GetIamPolicyRequest{
1884 // TODO: Fill request struct fields.
1885 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
1886 }
1887 resp, err := c.GetIamPolicy(ctx, req)
1888 if err != nil {
1889 // TODO: Handle error.
1890 }
1891 // TODO: Use resp.
1892 _ = resp
1893 }
1894
1895 func ExampleClient_SetIamPolicy() {
1896 ctx := context.Background()
1897 // This snippet has been automatically generated and should be regarded as a code template only.
1898 // It will require modifications to work:
1899 // - It may require correct/in-range values for request initialization.
1900 // - It may require specifying regional endpoints when creating the service client as shown in:
1901 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1902 c, err := networkservices.NewClient(ctx)
1903 if err != nil {
1904 // TODO: Handle error.
1905 }
1906 defer c.Close()
1907
1908 req := &iampb.SetIamPolicyRequest{
1909 // TODO: Fill request struct fields.
1910 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
1911 }
1912 resp, err := c.SetIamPolicy(ctx, req)
1913 if err != nil {
1914 // TODO: Handle error.
1915 }
1916 // TODO: Use resp.
1917 _ = resp
1918 }
1919
1920 func ExampleClient_TestIamPermissions() {
1921 ctx := context.Background()
1922 // This snippet has been automatically generated and should be regarded as a code template only.
1923 // It will require modifications to work:
1924 // - It may require correct/in-range values for request initialization.
1925 // - It may require specifying regional endpoints when creating the service client as shown in:
1926 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1927 c, err := networkservices.NewClient(ctx)
1928 if err != nil {
1929 // TODO: Handle error.
1930 }
1931 defer c.Close()
1932
1933 req := &iampb.TestIamPermissionsRequest{
1934 // TODO: Fill request struct fields.
1935 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
1936 }
1937 resp, err := c.TestIamPermissions(ctx, req)
1938 if err != nil {
1939 // TODO: Handle error.
1940 }
1941 // TODO: Use resp.
1942 _ = resp
1943 }
1944
1945 func ExampleClient_CancelOperation() {
1946 ctx := context.Background()
1947 // This snippet has been automatically generated and should be regarded as a code template only.
1948 // It will require modifications to work:
1949 // - It may require correct/in-range values for request initialization.
1950 // - It may require specifying regional endpoints when creating the service client as shown in:
1951 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1952 c, err := networkservices.NewClient(ctx)
1953 if err != nil {
1954 // TODO: Handle error.
1955 }
1956 defer c.Close()
1957
1958 req := &longrunningpb.CancelOperationRequest{
1959 // TODO: Fill request struct fields.
1960 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
1961 }
1962 err = c.CancelOperation(ctx, req)
1963 if err != nil {
1964 // TODO: Handle error.
1965 }
1966 }
1967
1968 func ExampleClient_DeleteOperation() {
1969 ctx := context.Background()
1970 // This snippet has been automatically generated and should be regarded as a code template only.
1971 // It will require modifications to work:
1972 // - It may require correct/in-range values for request initialization.
1973 // - It may require specifying regional endpoints when creating the service client as shown in:
1974 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1975 c, err := networkservices.NewClient(ctx)
1976 if err != nil {
1977 // TODO: Handle error.
1978 }
1979 defer c.Close()
1980
1981 req := &longrunningpb.DeleteOperationRequest{
1982 // TODO: Fill request struct fields.
1983 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
1984 }
1985 err = c.DeleteOperation(ctx, req)
1986 if err != nil {
1987 // TODO: Handle error.
1988 }
1989 }
1990
1991 func ExampleClient_GetOperation() {
1992 ctx := context.Background()
1993 // This snippet has been automatically generated and should be regarded as a code template only.
1994 // It will require modifications to work:
1995 // - It may require correct/in-range values for request initialization.
1996 // - It may require specifying regional endpoints when creating the service client as shown in:
1997 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1998 c, err := networkservices.NewClient(ctx)
1999 if err != nil {
2000 // TODO: Handle error.
2001 }
2002 defer c.Close()
2003
2004 req := &longrunningpb.GetOperationRequest{
2005 // TODO: Fill request struct fields.
2006 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
2007 }
2008 resp, err := c.GetOperation(ctx, req)
2009 if err != nil {
2010 // TODO: Handle error.
2011 }
2012 // TODO: Use resp.
2013 _ = resp
2014 }
2015
2016 func ExampleClient_ListOperations() {
2017 ctx := context.Background()
2018 // This snippet has been automatically generated and should be regarded as a code template only.
2019 // It will require modifications to work:
2020 // - It may require correct/in-range values for request initialization.
2021 // - It may require specifying regional endpoints when creating the service client as shown in:
2022 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
2023 c, err := networkservices.NewClient(ctx)
2024 if err != nil {
2025 // TODO: Handle error.
2026 }
2027 defer c.Close()
2028
2029 req := &longrunningpb.ListOperationsRequest{
2030 // TODO: Fill request struct fields.
2031 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
2032 }
2033 it := c.ListOperations(ctx, req)
2034 for {
2035 resp, err := it.Next()
2036 if err == iterator.Done {
2037 break
2038 }
2039 if err != nil {
2040 // TODO: Handle error.
2041 }
2042 // TODO: Use resp.
2043 _ = resp
2044
2045 // If you need to access the underlying RPC response,
2046 // you can do so by casting the `Response` as below.
2047 // Otherwise, remove this line. Only populated after
2048 // first call to Next(). Not safe for concurrent access.
2049 _ = it.Response.(*longrunningpb.ListOperationsResponse)
2050 }
2051 }