Debian Codegraph @

asset/apiv1/asset_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 asset_test
18
19 import (
20 "context"
21
22 asset "cloud.google.com/go/asset/apiv1"
23 assetpb "cloud.google.com/go/asset/apiv1/assetpb"
24 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
25 "google.golang.org/api/iterator"
26 )
27
28 func ExampleNewClient() {
29 ctx := context.Background()
30 // This snippet has been automatically generated and should be regarded as a code template only.
31 // It will require modifications to work:
32 // - It may require correct/in-range values for request initialization.
33 // - It may require specifying regional endpoints when creating the service client as shown in:
34 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
35 c, err := asset.NewClient(ctx)
36 if err != nil {
37 // TODO: Handle error.
38 }
39 defer c.Close()
40
41 // TODO: Use client.
42 _ = c
43 }
44
45 func ExampleNewRESTClient() {
46 ctx := context.Background()
47 // This snippet has been automatically generated and should be regarded as a code template only.
48 // It will require modifications to work:
49 // - It may require correct/in-range values for request initialization.
50 // - It may require specifying regional endpoints when creating the service client as shown in:
51 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
52 c, err := asset.NewRESTClient(ctx)
53 if err != nil {
54 // TODO: Handle error.
55 }
56 defer c.Close()
57
58 // TODO: Use client.
59 _ = c
60 }
61
62 func ExampleClient_AnalyzeIamPolicy() {
63 ctx := context.Background()
64 // This snippet has been automatically generated and should be regarded as a code template only.
65 // It will require modifications to work:
66 // - It may require correct/in-range values for request initialization.
67 // - It may require specifying regional endpoints when creating the service client as shown in:
68 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
69 c, err := asset.NewClient(ctx)
70 if err != nil {
71 // TODO: Handle error.
72 }
73 defer c.Close()
74
75 req := &assetpb.AnalyzeIamPolicyRequest{
76 // TODO: Fill request struct fields.
77 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#AnalyzeIamPolicyRequest.
78 }
79 resp, err := c.AnalyzeIamPolicy(ctx, req)
80 if err != nil {
81 // TODO: Handle error.
82 }
83 // TODO: Use resp.
84 _ = resp
85 }
86
87 func ExampleClient_AnalyzeIamPolicyLongrunning() {
88 ctx := context.Background()
89 // This snippet has been automatically generated and should be regarded as a code template only.
90 // It will require modifications to work:
91 // - It may require correct/in-range values for request initialization.
92 // - It may require specifying regional endpoints when creating the service client as shown in:
93 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
94 c, err := asset.NewClient(ctx)
95 if err != nil {
96 // TODO: Handle error.
97 }
98 defer c.Close()
99
100 req := &assetpb.AnalyzeIamPolicyLongrunningRequest{
101 // TODO: Fill request struct fields.
102 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#AnalyzeIamPolicyLongrunningRequest.
103 }
104 op, err := c.AnalyzeIamPolicyLongrunning(ctx, req)
105 if err != nil {
106 // TODO: Handle error.
107 }
108
109 resp, err := op.Wait(ctx)
110 if err != nil {
111 // TODO: Handle error.
112 }
113 // TODO: Use resp.
114 _ = resp
115 }
116
117 func ExampleClient_AnalyzeMove() {
118 ctx := context.Background()
119 // This snippet has been automatically generated and should be regarded as a code template only.
120 // It will require modifications to work:
121 // - It may require correct/in-range values for request initialization.
122 // - It may require specifying regional endpoints when creating the service client as shown in:
123 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
124 c, err := asset.NewClient(ctx)
125 if err != nil {
126 // TODO: Handle error.
127 }
128 defer c.Close()
129
130 req := &assetpb.AnalyzeMoveRequest{
131 // TODO: Fill request struct fields.
132 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#AnalyzeMoveRequest.
133 }
134 resp, err := c.AnalyzeMove(ctx, req)
135 if err != nil {
136 // TODO: Handle error.
137 }
138 // TODO: Use resp.
139 _ = resp
140 }
141
142 func ExampleClient_AnalyzeOrgPolicies() {
143 ctx := context.Background()
144 // This snippet has been automatically generated and should be regarded as a code template only.
145 // It will require modifications to work:
146 // - It may require correct/in-range values for request initialization.
147 // - It may require specifying regional endpoints when creating the service client as shown in:
148 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
149 c, err := asset.NewClient(ctx)
150 if err != nil {
151 // TODO: Handle error.
152 }
153 defer c.Close()
154
155 req := &assetpb.AnalyzeOrgPoliciesRequest{
156 // TODO: Fill request struct fields.
157 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#AnalyzeOrgPoliciesRequest.
158 }
159 it := c.AnalyzeOrgPolicies(ctx, req)
160 for {
161 resp, err := it.Next()
162 if err == iterator.Done {
163 break
164 }
165 if err != nil {
166 // TODO: Handle error.
167 }
168 // TODO: Use resp.
169 _ = resp
170
171 // If you need to access the underlying RPC response,
172 // you can do so by casting the `Response` as below.
173 // Otherwise, remove this line. Only populated after
174 // first call to Next(). Not safe for concurrent access.
175 _ = it.Response.(*assetpb.AnalyzeOrgPoliciesResponse)
176 }
177 }
178
179 func ExampleClient_AnalyzeOrgPolicyGovernedAssets() {
180 ctx := context.Background()
181 // This snippet has been automatically generated and should be regarded as a code template only.
182 // It will require modifications to work:
183 // - It may require correct/in-range values for request initialization.
184 // - It may require specifying regional endpoints when creating the service client as shown in:
185 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
186 c, err := asset.NewClient(ctx)
187 if err != nil {
188 // TODO: Handle error.
189 }
190 defer c.Close()
191
192 req := &assetpb.AnalyzeOrgPolicyGovernedAssetsRequest{
193 // TODO: Fill request struct fields.
194 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#AnalyzeOrgPolicyGovernedAssetsRequest.
195 }
196 it := c.AnalyzeOrgPolicyGovernedAssets(ctx, req)
197 for {
198 resp, err := it.Next()
199 if err == iterator.Done {
200 break
201 }
202 if err != nil {
203 // TODO: Handle error.
204 }
205 // TODO: Use resp.
206 _ = resp
207
208 // If you need to access the underlying RPC response,
209 // you can do so by casting the `Response` as below.
210 // Otherwise, remove this line. Only populated after
211 // first call to Next(). Not safe for concurrent access.
212 _ = it.Response.(*assetpb.AnalyzeOrgPolicyGovernedAssetsResponse)
213 }
214 }
215
216 func ExampleClient_AnalyzeOrgPolicyGovernedContainers() {
217 ctx := context.Background()
218 // This snippet has been automatically generated and should be regarded as a code template only.
219 // It will require modifications to work:
220 // - It may require correct/in-range values for request initialization.
221 // - It may require specifying regional endpoints when creating the service client as shown in:
222 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
223 c, err := asset.NewClient(ctx)
224 if err != nil {
225 // TODO: Handle error.
226 }
227 defer c.Close()
228
229 req := &assetpb.AnalyzeOrgPolicyGovernedContainersRequest{
230 // TODO: Fill request struct fields.
231 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#AnalyzeOrgPolicyGovernedContainersRequest.
232 }
233 it := c.AnalyzeOrgPolicyGovernedContainers(ctx, req)
234 for {
235 resp, err := it.Next()
236 if err == iterator.Done {
237 break
238 }
239 if err != nil {
240 // TODO: Handle error.
241 }
242 // TODO: Use resp.
243 _ = resp
244
245 // If you need to access the underlying RPC response,
246 // you can do so by casting the `Response` as below.
247 // Otherwise, remove this line. Only populated after
248 // first call to Next(). Not safe for concurrent access.
249 _ = it.Response.(*assetpb.AnalyzeOrgPolicyGovernedContainersResponse)
250 }
251 }
252
253 func ExampleClient_BatchGetAssetsHistory() {
254 ctx := context.Background()
255 // This snippet has been automatically generated and should be regarded as a code template only.
256 // It will require modifications to work:
257 // - It may require correct/in-range values for request initialization.
258 // - It may require specifying regional endpoints when creating the service client as shown in:
259 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
260 c, err := asset.NewClient(ctx)
261 if err != nil {
262 // TODO: Handle error.
263 }
264 defer c.Close()
265
266 req := &assetpb.BatchGetAssetsHistoryRequest{
267 // TODO: Fill request struct fields.
268 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#BatchGetAssetsHistoryRequest.
269 }
270 resp, err := c.BatchGetAssetsHistory(ctx, req)
271 if err != nil {
272 // TODO: Handle error.
273 }
274 // TODO: Use resp.
275 _ = resp
276 }
277
278 func ExampleClient_BatchGetEffectiveIamPolicies() {
279 ctx := context.Background()
280 // This snippet has been automatically generated and should be regarded as a code template only.
281 // It will require modifications to work:
282 // - It may require correct/in-range values for request initialization.
283 // - It may require specifying regional endpoints when creating the service client as shown in:
284 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
285 c, err := asset.NewClient(ctx)
286 if err != nil {
287 // TODO: Handle error.
288 }
289 defer c.Close()
290
291 req := &assetpb.BatchGetEffectiveIamPoliciesRequest{
292 // TODO: Fill request struct fields.
293 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#BatchGetEffectiveIamPoliciesRequest.
294 }
295 resp, err := c.BatchGetEffectiveIamPolicies(ctx, req)
296 if err != nil {
297 // TODO: Handle error.
298 }
299 // TODO: Use resp.
300 _ = resp
301 }
302
303 func ExampleClient_CreateFeed() {
304 ctx := context.Background()
305 // This snippet has been automatically generated and should be regarded as a code template only.
306 // It will require modifications to work:
307 // - It may require correct/in-range values for request initialization.
308 // - It may require specifying regional endpoints when creating the service client as shown in:
309 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
310 c, err := asset.NewClient(ctx)
311 if err != nil {
312 // TODO: Handle error.
313 }
314 defer c.Close()
315
316 req := &assetpb.CreateFeedRequest{
317 // TODO: Fill request struct fields.
318 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#CreateFeedRequest.
319 }
320 resp, err := c.CreateFeed(ctx, req)
321 if err != nil {
322 // TODO: Handle error.
323 }
324 // TODO: Use resp.
325 _ = resp
326 }
327
328 func ExampleClient_CreateSavedQuery() {
329 ctx := context.Background()
330 // This snippet has been automatically generated and should be regarded as a code template only.
331 // It will require modifications to work:
332 // - It may require correct/in-range values for request initialization.
333 // - It may require specifying regional endpoints when creating the service client as shown in:
334 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
335 c, err := asset.NewClient(ctx)
336 if err != nil {
337 // TODO: Handle error.
338 }
339 defer c.Close()
340
341 req := &assetpb.CreateSavedQueryRequest{
342 // TODO: Fill request struct fields.
343 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#CreateSavedQueryRequest.
344 }
345 resp, err := c.CreateSavedQuery(ctx, req)
346 if err != nil {
347 // TODO: Handle error.
348 }
349 // TODO: Use resp.
350 _ = resp
351 }
352
353 func ExampleClient_DeleteFeed() {
354 ctx := context.Background()
355 // This snippet has been automatically generated and should be regarded as a code template only.
356 // It will require modifications to work:
357 // - It may require correct/in-range values for request initialization.
358 // - It may require specifying regional endpoints when creating the service client as shown in:
359 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
360 c, err := asset.NewClient(ctx)
361 if err != nil {
362 // TODO: Handle error.
363 }
364 defer c.Close()
365
366 req := &assetpb.DeleteFeedRequest{
367 // TODO: Fill request struct fields.
368 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#DeleteFeedRequest.
369 }
370 err = c.DeleteFeed(ctx, req)
371 if err != nil {
372 // TODO: Handle error.
373 }
374 }
375
376 func ExampleClient_DeleteSavedQuery() {
377 ctx := context.Background()
378 // This snippet has been automatically generated and should be regarded as a code template only.
379 // It will require modifications to work:
380 // - It may require correct/in-range values for request initialization.
381 // - It may require specifying regional endpoints when creating the service client as shown in:
382 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
383 c, err := asset.NewClient(ctx)
384 if err != nil {
385 // TODO: Handle error.
386 }
387 defer c.Close()
388
389 req := &assetpb.DeleteSavedQueryRequest{
390 // TODO: Fill request struct fields.
391 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#DeleteSavedQueryRequest.
392 }
393 err = c.DeleteSavedQuery(ctx, req)
394 if err != nil {
395 // TODO: Handle error.
396 }
397 }
398
399 func ExampleClient_ExportAssets() {
400 ctx := context.Background()
401 // This snippet has been automatically generated and should be regarded as a code template only.
402 // It will require modifications to work:
403 // - It may require correct/in-range values for request initialization.
404 // - It may require specifying regional endpoints when creating the service client as shown in:
405 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
406 c, err := asset.NewClient(ctx)
407 if err != nil {
408 // TODO: Handle error.
409 }
410 defer c.Close()
411
412 req := &assetpb.ExportAssetsRequest{
413 // TODO: Fill request struct fields.
414 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#ExportAssetsRequest.
415 }
416 op, err := c.ExportAssets(ctx, req)
417 if err != nil {
418 // TODO: Handle error.
419 }
420
421 resp, err := op.Wait(ctx)
422 if err != nil {
423 // TODO: Handle error.
424 }
425 // TODO: Use resp.
426 _ = resp
427 }
428
429 func ExampleClient_GetFeed() {
430 ctx := context.Background()
431 // This snippet has been automatically generated and should be regarded as a code template only.
432 // It will require modifications to work:
433 // - It may require correct/in-range values for request initialization.
434 // - It may require specifying regional endpoints when creating the service client as shown in:
435 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
436 c, err := asset.NewClient(ctx)
437 if err != nil {
438 // TODO: Handle error.
439 }
440 defer c.Close()
441
442 req := &assetpb.GetFeedRequest{
443 // TODO: Fill request struct fields.
444 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#GetFeedRequest.
445 }
446 resp, err := c.GetFeed(ctx, req)
447 if err != nil {
448 // TODO: Handle error.
449 }
450 // TODO: Use resp.
451 _ = resp
452 }
453
454 func ExampleClient_GetSavedQuery() {
455 ctx := context.Background()
456 // This snippet has been automatically generated and should be regarded as a code template only.
457 // It will require modifications to work:
458 // - It may require correct/in-range values for request initialization.
459 // - It may require specifying regional endpoints when creating the service client as shown in:
460 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
461 c, err := asset.NewClient(ctx)
462 if err != nil {
463 // TODO: Handle error.
464 }
465 defer c.Close()
466
467 req := &assetpb.GetSavedQueryRequest{
468 // TODO: Fill request struct fields.
469 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#GetSavedQueryRequest.
470 }
471 resp, err := c.GetSavedQuery(ctx, req)
472 if err != nil {
473 // TODO: Handle error.
474 }
475 // TODO: Use resp.
476 _ = resp
477 }
478
479 func ExampleClient_ListAssets() {
480 ctx := context.Background()
481 // This snippet has been automatically generated and should be regarded as a code template only.
482 // It will require modifications to work:
483 // - It may require correct/in-range values for request initialization.
484 // - It may require specifying regional endpoints when creating the service client as shown in:
485 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
486 c, err := asset.NewClient(ctx)
487 if err != nil {
488 // TODO: Handle error.
489 }
490 defer c.Close()
491
492 req := &assetpb.ListAssetsRequest{
493 // TODO: Fill request struct fields.
494 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#ListAssetsRequest.
495 }
496 it := c.ListAssets(ctx, req)
497 for {
498 resp, err := it.Next()
499 if err == iterator.Done {
500 break
501 }
502 if err != nil {
503 // TODO: Handle error.
504 }
505 // TODO: Use resp.
506 _ = resp
507
508 // If you need to access the underlying RPC response,
509 // you can do so by casting the `Response` as below.
510 // Otherwise, remove this line. Only populated after
511 // first call to Next(). Not safe for concurrent access.
512 _ = it.Response.(*assetpb.ListAssetsResponse)
513 }
514 }
515
516 func ExampleClient_ListFeeds() {
517 ctx := context.Background()
518 // This snippet has been automatically generated and should be regarded as a code template only.
519 // It will require modifications to work:
520 // - It may require correct/in-range values for request initialization.
521 // - It may require specifying regional endpoints when creating the service client as shown in:
522 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
523 c, err := asset.NewClient(ctx)
524 if err != nil {
525 // TODO: Handle error.
526 }
527 defer c.Close()
528
529 req := &assetpb.ListFeedsRequest{
530 // TODO: Fill request struct fields.
531 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#ListFeedsRequest.
532 }
533 resp, err := c.ListFeeds(ctx, req)
534 if err != nil {
535 // TODO: Handle error.
536 }
537 // TODO: Use resp.
538 _ = resp
539 }
540
541 func ExampleClient_ListSavedQueries() {
542 ctx := context.Background()
543 // This snippet has been automatically generated and should be regarded as a code template only.
544 // It will require modifications to work:
545 // - It may require correct/in-range values for request initialization.
546 // - It may require specifying regional endpoints when creating the service client as shown in:
547 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
548 c, err := asset.NewClient(ctx)
549 if err != nil {
550 // TODO: Handle error.
551 }
552 defer c.Close()
553
554 req := &assetpb.ListSavedQueriesRequest{
555 // TODO: Fill request struct fields.
556 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#ListSavedQueriesRequest.
557 }
558 it := c.ListSavedQueries(ctx, req)
559 for {
560 resp, err := it.Next()
561 if err == iterator.Done {
562 break
563 }
564 if err != nil {
565 // TODO: Handle error.
566 }
567 // TODO: Use resp.
568 _ = resp
569
570 // If you need to access the underlying RPC response,
571 // you can do so by casting the `Response` as below.
572 // Otherwise, remove this line. Only populated after
573 // first call to Next(). Not safe for concurrent access.
574 _ = it.Response.(*assetpb.ListSavedQueriesResponse)
575 }
576 }
577
578 func ExampleClient_QueryAssets() {
579 ctx := context.Background()
580 // This snippet has been automatically generated and should be regarded as a code template only.
581 // It will require modifications to work:
582 // - It may require correct/in-range values for request initialization.
583 // - It may require specifying regional endpoints when creating the service client as shown in:
584 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
585 c, err := asset.NewClient(ctx)
586 if err != nil {
587 // TODO: Handle error.
588 }
589 defer c.Close()
590
591 req := &assetpb.QueryAssetsRequest{
592 // TODO: Fill request struct fields.
593 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#QueryAssetsRequest.
594 }
595 resp, err := c.QueryAssets(ctx, req)
596 if err != nil {
597 // TODO: Handle error.
598 }
599 // TODO: Use resp.
600 _ = resp
601 }
602
603 func ExampleClient_SearchAllIamPolicies() {
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 := asset.NewClient(ctx)
611 if err != nil {
612 // TODO: Handle error.
613 }
614 defer c.Close()
615
616 req := &assetpb.SearchAllIamPoliciesRequest{
617 // TODO: Fill request struct fields.
618 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#SearchAllIamPoliciesRequest.
619 }
620 it := c.SearchAllIamPolicies(ctx, req)
621 for {
622 resp, err := it.Next()
623 if err == iterator.Done {
624 break
625 }
626 if err != nil {
627 // TODO: Handle error.
628 }
629 // TODO: Use resp.
630 _ = resp
631
632 // If you need to access the underlying RPC response,
633 // you can do so by casting the `Response` as below.
634 // Otherwise, remove this line. Only populated after
635 // first call to Next(). Not safe for concurrent access.
636 _ = it.Response.(*assetpb.SearchAllIamPoliciesResponse)
637 }
638 }
639
640 func ExampleClient_SearchAllResources() {
641 ctx := context.Background()
642 // This snippet has been automatically generated and should be regarded as a code template only.
643 // It will require modifications to work:
644 // - It may require correct/in-range values for request initialization.
645 // - It may require specifying regional endpoints when creating the service client as shown in:
646 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
647 c, err := asset.NewClient(ctx)
648 if err != nil {
649 // TODO: Handle error.
650 }
651 defer c.Close()
652
653 req := &assetpb.SearchAllResourcesRequest{
654 // TODO: Fill request struct fields.
655 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#SearchAllResourcesRequest.
656 }
657 it := c.SearchAllResources(ctx, req)
658 for {
659 resp, err := it.Next()
660 if err == iterator.Done {
661 break
662 }
663 if err != nil {
664 // TODO: Handle error.
665 }
666 // TODO: Use resp.
667 _ = resp
668
669 // If you need to access the underlying RPC response,
670 // you can do so by casting the `Response` as below.
671 // Otherwise, remove this line. Only populated after
672 // first call to Next(). Not safe for concurrent access.
673 _ = it.Response.(*assetpb.SearchAllResourcesResponse)
674 }
675 }
676
677 func ExampleClient_UpdateFeed() {
678 ctx := context.Background()
679 // This snippet has been automatically generated and should be regarded as a code template only.
680 // It will require modifications to work:
681 // - It may require correct/in-range values for request initialization.
682 // - It may require specifying regional endpoints when creating the service client as shown in:
683 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
684 c, err := asset.NewClient(ctx)
685 if err != nil {
686 // TODO: Handle error.
687 }
688 defer c.Close()
689
690 req := &assetpb.UpdateFeedRequest{
691 // TODO: Fill request struct fields.
692 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#UpdateFeedRequest.
693 }
694 resp, err := c.UpdateFeed(ctx, req)
695 if err != nil {
696 // TODO: Handle error.
697 }
698 // TODO: Use resp.
699 _ = resp
700 }
701
702 func ExampleClient_UpdateSavedQuery() {
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 := asset.NewClient(ctx)
710 if err != nil {
711 // TODO: Handle error.
712 }
713 defer c.Close()
714
715 req := &assetpb.UpdateSavedQueryRequest{
716 // TODO: Fill request struct fields.
717 // See https://pkg.go.dev/cloud.google.com/go/asset/apiv1/assetpb#UpdateSavedQueryRequest.
718 }
719 resp, err := c.UpdateSavedQuery(ctx, req)
720 if err != nil {
721 // TODO: Handle error.
722 }
723 // TODO: Use resp.
724 _ = resp
725 }
726
727 func ExampleClient_GetOperation() {
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 := asset.NewClient(ctx)
735 if err != nil {
736 // TODO: Handle error.
737 }
738 defer c.Close()
739
740 req := &longrunningpb.GetOperationRequest{
741 // TODO: Fill request struct fields.
742 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
743 }
744 resp, err := c.GetOperation(ctx, req)
745 if err != nil {
746 // TODO: Handle error.
747 }
748 // TODO: Use resp.
749 _ = resp
750 }