Debian Codegraph @

datacatalog/apiv1/data_catalog_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 datacatalog_test
18
19 import (
20 "context"
21
22 datacatalog "cloud.google.com/go/datacatalog/apiv1"
23 datacatalogpb "cloud.google.com/go/datacatalog/apiv1/datacatalogpb"
24 iampb "cloud.google.com/go/iam/apiv1/iampb"
25 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
26 "google.golang.org/api/iterator"
27 )
28
29 func ExampleNewClient() {
30 ctx := context.Background()
31 // This snippet has been automatically generated and should be regarded as a code template only.
32 // It will require modifications to work:
33 // - It may require correct/in-range values for request initialization.
34 // - It may require specifying regional endpoints when creating the service client as shown in:
35 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
36 c, err := datacatalog.NewClient(ctx)
37 if err != nil {
38 // TODO: Handle error.
39 }
40 defer c.Close()
41
42 // TODO: Use client.
43 _ = c
44 }
45
46 func ExampleNewRESTClient() {
47 ctx := context.Background()
48 // This snippet has been automatically generated and should be regarded as a code template only.
49 // It will require modifications to work:
50 // - It may require correct/in-range values for request initialization.
51 // - It may require specifying regional endpoints when creating the service client as shown in:
52 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
53 c, err := datacatalog.NewRESTClient(ctx)
54 if err != nil {
55 // TODO: Handle error.
56 }
57 defer c.Close()
58
59 // TODO: Use client.
60 _ = c
61 }
62
63 func ExampleClient_CreateEntry() {
64 ctx := context.Background()
65 // This snippet has been automatically generated and should be regarded as a code template only.
66 // It will require modifications to work:
67 // - It may require correct/in-range values for request initialization.
68 // - It may require specifying regional endpoints when creating the service client as shown in:
69 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
70 c, err := datacatalog.NewClient(ctx)
71 if err != nil {
72 // TODO: Handle error.
73 }
74 defer c.Close()
75
76 req := &datacatalogpb.CreateEntryRequest{
77 // TODO: Fill request struct fields.
78 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#CreateEntryRequest.
79 }
80 resp, err := c.CreateEntry(ctx, req)
81 if err != nil {
82 // TODO: Handle error.
83 }
84 // TODO: Use resp.
85 _ = resp
86 }
87
88 func ExampleClient_CreateEntryGroup() {
89 ctx := context.Background()
90 // This snippet has been automatically generated and should be regarded as a code template only.
91 // It will require modifications to work:
92 // - It may require correct/in-range values for request initialization.
93 // - It may require specifying regional endpoints when creating the service client as shown in:
94 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
95 c, err := datacatalog.NewClient(ctx)
96 if err != nil {
97 // TODO: Handle error.
98 }
99 defer c.Close()
100
101 req := &datacatalogpb.CreateEntryGroupRequest{
102 // TODO: Fill request struct fields.
103 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#CreateEntryGroupRequest.
104 }
105 resp, err := c.CreateEntryGroup(ctx, req)
106 if err != nil {
107 // TODO: Handle error.
108 }
109 // TODO: Use resp.
110 _ = resp
111 }
112
113 func ExampleClient_CreateTag() {
114 ctx := context.Background()
115 // This snippet has been automatically generated and should be regarded as a code template only.
116 // It will require modifications to work:
117 // - It may require correct/in-range values for request initialization.
118 // - It may require specifying regional endpoints when creating the service client as shown in:
119 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
120 c, err := datacatalog.NewClient(ctx)
121 if err != nil {
122 // TODO: Handle error.
123 }
124 defer c.Close()
125
126 req := &datacatalogpb.CreateTagRequest{
127 // TODO: Fill request struct fields.
128 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#CreateTagRequest.
129 }
130 resp, err := c.CreateTag(ctx, req)
131 if err != nil {
132 // TODO: Handle error.
133 }
134 // TODO: Use resp.
135 _ = resp
136 }
137
138 func ExampleClient_CreateTagTemplate() {
139 ctx := context.Background()
140 // This snippet has been automatically generated and should be regarded as a code template only.
141 // It will require modifications to work:
142 // - It may require correct/in-range values for request initialization.
143 // - It may require specifying regional endpoints when creating the service client as shown in:
144 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
145 c, err := datacatalog.NewClient(ctx)
146 if err != nil {
147 // TODO: Handle error.
148 }
149 defer c.Close()
150
151 req := &datacatalogpb.CreateTagTemplateRequest{
152 // TODO: Fill request struct fields.
153 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#CreateTagTemplateRequest.
154 }
155 resp, err := c.CreateTagTemplate(ctx, req)
156 if err != nil {
157 // TODO: Handle error.
158 }
159 // TODO: Use resp.
160 _ = resp
161 }
162
163 func ExampleClient_CreateTagTemplateField() {
164 ctx := context.Background()
165 // This snippet has been automatically generated and should be regarded as a code template only.
166 // It will require modifications to work:
167 // - It may require correct/in-range values for request initialization.
168 // - It may require specifying regional endpoints when creating the service client as shown in:
169 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
170 c, err := datacatalog.NewClient(ctx)
171 if err != nil {
172 // TODO: Handle error.
173 }
174 defer c.Close()
175
176 req := &datacatalogpb.CreateTagTemplateFieldRequest{
177 // TODO: Fill request struct fields.
178 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#CreateTagTemplateFieldRequest.
179 }
180 resp, err := c.CreateTagTemplateField(ctx, req)
181 if err != nil {
182 // TODO: Handle error.
183 }
184 // TODO: Use resp.
185 _ = resp
186 }
187
188 func ExampleClient_DeleteEntry() {
189 ctx := context.Background()
190 // This snippet has been automatically generated and should be regarded as a code template only.
191 // It will require modifications to work:
192 // - It may require correct/in-range values for request initialization.
193 // - It may require specifying regional endpoints when creating the service client as shown in:
194 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
195 c, err := datacatalog.NewClient(ctx)
196 if err != nil {
197 // TODO: Handle error.
198 }
199 defer c.Close()
200
201 req := &datacatalogpb.DeleteEntryRequest{
202 // TODO: Fill request struct fields.
203 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#DeleteEntryRequest.
204 }
205 err = c.DeleteEntry(ctx, req)
206 if err != nil {
207 // TODO: Handle error.
208 }
209 }
210
211 func ExampleClient_DeleteEntryGroup() {
212 ctx := context.Background()
213 // This snippet has been automatically generated and should be regarded as a code template only.
214 // It will require modifications to work:
215 // - It may require correct/in-range values for request initialization.
216 // - It may require specifying regional endpoints when creating the service client as shown in:
217 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
218 c, err := datacatalog.NewClient(ctx)
219 if err != nil {
220 // TODO: Handle error.
221 }
222 defer c.Close()
223
224 req := &datacatalogpb.DeleteEntryGroupRequest{
225 // TODO: Fill request struct fields.
226 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#DeleteEntryGroupRequest.
227 }
228 err = c.DeleteEntryGroup(ctx, req)
229 if err != nil {
230 // TODO: Handle error.
231 }
232 }
233
234 func ExampleClient_DeleteTag() {
235 ctx := context.Background()
236 // This snippet has been automatically generated and should be regarded as a code template only.
237 // It will require modifications to work:
238 // - It may require correct/in-range values for request initialization.
239 // - It may require specifying regional endpoints when creating the service client as shown in:
240 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
241 c, err := datacatalog.NewClient(ctx)
242 if err != nil {
243 // TODO: Handle error.
244 }
245 defer c.Close()
246
247 req := &datacatalogpb.DeleteTagRequest{
248 // TODO: Fill request struct fields.
249 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#DeleteTagRequest.
250 }
251 err = c.DeleteTag(ctx, req)
252 if err != nil {
253 // TODO: Handle error.
254 }
255 }
256
257 func ExampleClient_DeleteTagTemplate() {
258 ctx := context.Background()
259 // This snippet has been automatically generated and should be regarded as a code template only.
260 // It will require modifications to work:
261 // - It may require correct/in-range values for request initialization.
262 // - It may require specifying regional endpoints when creating the service client as shown in:
263 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
264 c, err := datacatalog.NewClient(ctx)
265 if err != nil {
266 // TODO: Handle error.
267 }
268 defer c.Close()
269
270 req := &datacatalogpb.DeleteTagTemplateRequest{
271 // TODO: Fill request struct fields.
272 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#DeleteTagTemplateRequest.
273 }
274 err = c.DeleteTagTemplate(ctx, req)
275 if err != nil {
276 // TODO: Handle error.
277 }
278 }
279
280 func ExampleClient_DeleteTagTemplateField() {
281 ctx := context.Background()
282 // This snippet has been automatically generated and should be regarded as a code template only.
283 // It will require modifications to work:
284 // - It may require correct/in-range values for request initialization.
285 // - It may require specifying regional endpoints when creating the service client as shown in:
286 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
287 c, err := datacatalog.NewClient(ctx)
288 if err != nil {
289 // TODO: Handle error.
290 }
291 defer c.Close()
292
293 req := &datacatalogpb.DeleteTagTemplateFieldRequest{
294 // TODO: Fill request struct fields.
295 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#DeleteTagTemplateFieldRequest.
296 }
297 err = c.DeleteTagTemplateField(ctx, req)
298 if err != nil {
299 // TODO: Handle error.
300 }
301 }
302
303 func ExampleClient_GetEntry() {
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 := datacatalog.NewClient(ctx)
311 if err != nil {
312 // TODO: Handle error.
313 }
314 defer c.Close()
315
316 req := &datacatalogpb.GetEntryRequest{
317 // TODO: Fill request struct fields.
318 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#GetEntryRequest.
319 }
320 resp, err := c.GetEntry(ctx, req)
321 if err != nil {
322 // TODO: Handle error.
323 }
324 // TODO: Use resp.
325 _ = resp
326 }
327
328 func ExampleClient_GetEntryGroup() {
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 := datacatalog.NewClient(ctx)
336 if err != nil {
337 // TODO: Handle error.
338 }
339 defer c.Close()
340
341 req := &datacatalogpb.GetEntryGroupRequest{
342 // TODO: Fill request struct fields.
343 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#GetEntryGroupRequest.
344 }
345 resp, err := c.GetEntryGroup(ctx, req)
346 if err != nil {
347 // TODO: Handle error.
348 }
349 // TODO: Use resp.
350 _ = resp
351 }
352
353 func ExampleClient_GetIamPolicy() {
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 := datacatalog.NewClient(ctx)
361 if err != nil {
362 // TODO: Handle error.
363 }
364 defer c.Close()
365
366 req := &iampb.GetIamPolicyRequest{
367 // TODO: Fill request struct fields.
368 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
369 }
370 resp, err := c.GetIamPolicy(ctx, req)
371 if err != nil {
372 // TODO: Handle error.
373 }
374 // TODO: Use resp.
375 _ = resp
376 }
377
378 func ExampleClient_GetTagTemplate() {
379 ctx := context.Background()
380 // This snippet has been automatically generated and should be regarded as a code template only.
381 // It will require modifications to work:
382 // - It may require correct/in-range values for request initialization.
383 // - It may require specifying regional endpoints when creating the service client as shown in:
384 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
385 c, err := datacatalog.NewClient(ctx)
386 if err != nil {
387 // TODO: Handle error.
388 }
389 defer c.Close()
390
391 req := &datacatalogpb.GetTagTemplateRequest{
392 // TODO: Fill request struct fields.
393 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#GetTagTemplateRequest.
394 }
395 resp, err := c.GetTagTemplate(ctx, req)
396 if err != nil {
397 // TODO: Handle error.
398 }
399 // TODO: Use resp.
400 _ = resp
401 }
402
403 func ExampleClient_ImportEntries() {
404 ctx := context.Background()
405 // This snippet has been automatically generated and should be regarded as a code template only.
406 // It will require modifications to work:
407 // - It may require correct/in-range values for request initialization.
408 // - It may require specifying regional endpoints when creating the service client as shown in:
409 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
410 c, err := datacatalog.NewClient(ctx)
411 if err != nil {
412 // TODO: Handle error.
413 }
414 defer c.Close()
415
416 req := &datacatalogpb.ImportEntriesRequest{
417 // TODO: Fill request struct fields.
418 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#ImportEntriesRequest.
419 }
420 op, err := c.ImportEntries(ctx, req)
421 if err != nil {
422 // TODO: Handle error.
423 }
424
425 resp, err := op.Wait(ctx)
426 if err != nil {
427 // TODO: Handle error.
428 }
429 // TODO: Use resp.
430 _ = resp
431 }
432
433 func ExampleClient_ListEntries() {
434 ctx := context.Background()
435 // This snippet has been automatically generated and should be regarded as a code template only.
436 // It will require modifications to work:
437 // - It may require correct/in-range values for request initialization.
438 // - It may require specifying regional endpoints when creating the service client as shown in:
439 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
440 c, err := datacatalog.NewClient(ctx)
441 if err != nil {
442 // TODO: Handle error.
443 }
444 defer c.Close()
445
446 req := &datacatalogpb.ListEntriesRequest{
447 // TODO: Fill request struct fields.
448 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#ListEntriesRequest.
449 }
450 it := c.ListEntries(ctx, req)
451 for {
452 resp, err := it.Next()
453 if err == iterator.Done {
454 break
455 }
456 if err != nil {
457 // TODO: Handle error.
458 }
459 // TODO: Use resp.
460 _ = resp
461
462 // If you need to access the underlying RPC response,
463 // you can do so by casting the `Response` as below.
464 // Otherwise, remove this line. Only populated after
465 // first call to Next(). Not safe for concurrent access.
466 _ = it.Response.(*datacatalogpb.ListEntriesResponse)
467 }
468 }
469
470 func ExampleClient_ListEntryGroups() {
471 ctx := context.Background()
472 // This snippet has been automatically generated and should be regarded as a code template only.
473 // It will require modifications to work:
474 // - It may require correct/in-range values for request initialization.
475 // - It may require specifying regional endpoints when creating the service client as shown in:
476 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
477 c, err := datacatalog.NewClient(ctx)
478 if err != nil {
479 // TODO: Handle error.
480 }
481 defer c.Close()
482
483 req := &datacatalogpb.ListEntryGroupsRequest{
484 // TODO: Fill request struct fields.
485 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#ListEntryGroupsRequest.
486 }
487 it := c.ListEntryGroups(ctx, req)
488 for {
489 resp, err := it.Next()
490 if err == iterator.Done {
491 break
492 }
493 if err != nil {
494 // TODO: Handle error.
495 }
496 // TODO: Use resp.
497 _ = resp
498
499 // If you need to access the underlying RPC response,
500 // you can do so by casting the `Response` as below.
501 // Otherwise, remove this line. Only populated after
502 // first call to Next(). Not safe for concurrent access.
503 _ = it.Response.(*datacatalogpb.ListEntryGroupsResponse)
504 }
505 }
506
507 func ExampleClient_ListTags() {
508 ctx := context.Background()
509 // This snippet has been automatically generated and should be regarded as a code template only.
510 // It will require modifications to work:
511 // - It may require correct/in-range values for request initialization.
512 // - It may require specifying regional endpoints when creating the service client as shown in:
513 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
514 c, err := datacatalog.NewClient(ctx)
515 if err != nil {
516 // TODO: Handle error.
517 }
518 defer c.Close()
519
520 req := &datacatalogpb.ListTagsRequest{
521 // TODO: Fill request struct fields.
522 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#ListTagsRequest.
523 }
524 it := c.ListTags(ctx, req)
525 for {
526 resp, err := it.Next()
527 if err == iterator.Done {
528 break
529 }
530 if err != nil {
531 // TODO: Handle error.
532 }
533 // TODO: Use resp.
534 _ = resp
535
536 // If you need to access the underlying RPC response,
537 // you can do so by casting the `Response` as below.
538 // Otherwise, remove this line. Only populated after
539 // first call to Next(). Not safe for concurrent access.
540 _ = it.Response.(*datacatalogpb.ListTagsResponse)
541 }
542 }
543
544 func ExampleClient_LookupEntry() {
545 ctx := context.Background()
546 // This snippet has been automatically generated and should be regarded as a code template only.
547 // It will require modifications to work:
548 // - It may require correct/in-range values for request initialization.
549 // - It may require specifying regional endpoints when creating the service client as shown in:
550 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
551 c, err := datacatalog.NewClient(ctx)
552 if err != nil {
553 // TODO: Handle error.
554 }
555 defer c.Close()
556
557 req := &datacatalogpb.LookupEntryRequest{
558 // TODO: Fill request struct fields.
559 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#LookupEntryRequest.
560 }
561 resp, err := c.LookupEntry(ctx, req)
562 if err != nil {
563 // TODO: Handle error.
564 }
565 // TODO: Use resp.
566 _ = resp
567 }
568
569 func ExampleClient_ModifyEntryContacts() {
570 ctx := context.Background()
571 // This snippet has been automatically generated and should be regarded as a code template only.
572 // It will require modifications to work:
573 // - It may require correct/in-range values for request initialization.
574 // - It may require specifying regional endpoints when creating the service client as shown in:
575 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
576 c, err := datacatalog.NewClient(ctx)
577 if err != nil {
578 // TODO: Handle error.
579 }
580 defer c.Close()
581
582 req := &datacatalogpb.ModifyEntryContactsRequest{
583 // TODO: Fill request struct fields.
584 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#ModifyEntryContactsRequest.
585 }
586 resp, err := c.ModifyEntryContacts(ctx, req)
587 if err != nil {
588 // TODO: Handle error.
589 }
590 // TODO: Use resp.
591 _ = resp
592 }
593
594 func ExampleClient_ModifyEntryOverview() {
595 ctx := context.Background()
596 // This snippet has been automatically generated and should be regarded as a code template only.
597 // It will require modifications to work:
598 // - It may require correct/in-range values for request initialization.
599 // - It may require specifying regional endpoints when creating the service client as shown in:
600 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
601 c, err := datacatalog.NewClient(ctx)
602 if err != nil {
603 // TODO: Handle error.
604 }
605 defer c.Close()
606
607 req := &datacatalogpb.ModifyEntryOverviewRequest{
608 // TODO: Fill request struct fields.
609 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#ModifyEntryOverviewRequest.
610 }
611 resp, err := c.ModifyEntryOverview(ctx, req)
612 if err != nil {
613 // TODO: Handle error.
614 }
615 // TODO: Use resp.
616 _ = resp
617 }
618
619 func ExampleClient_ReconcileTags() {
620 ctx := context.Background()
621 // This snippet has been automatically generated and should be regarded as a code template only.
622 // It will require modifications to work:
623 // - It may require correct/in-range values for request initialization.
624 // - It may require specifying regional endpoints when creating the service client as shown in:
625 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
626 c, err := datacatalog.NewClient(ctx)
627 if err != nil {
628 // TODO: Handle error.
629 }
630 defer c.Close()
631
632 req := &datacatalogpb.ReconcileTagsRequest{
633 // TODO: Fill request struct fields.
634 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#ReconcileTagsRequest.
635 }
636 op, err := c.ReconcileTags(ctx, req)
637 if err != nil {
638 // TODO: Handle error.
639 }
640
641 resp, err := op.Wait(ctx)
642 if err != nil {
643 // TODO: Handle error.
644 }
645 // TODO: Use resp.
646 _ = resp
647 }
648
649 func ExampleClient_RenameTagTemplateField() {
650 ctx := context.Background()
651 // This snippet has been automatically generated and should be regarded as a code template only.
652 // It will require modifications to work:
653 // - It may require correct/in-range values for request initialization.
654 // - It may require specifying regional endpoints when creating the service client as shown in:
655 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
656 c, err := datacatalog.NewClient(ctx)
657 if err != nil {
658 // TODO: Handle error.
659 }
660 defer c.Close()
661
662 req := &datacatalogpb.RenameTagTemplateFieldRequest{
663 // TODO: Fill request struct fields.
664 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#RenameTagTemplateFieldRequest.
665 }
666 resp, err := c.RenameTagTemplateField(ctx, req)
667 if err != nil {
668 // TODO: Handle error.
669 }
670 // TODO: Use resp.
671 _ = resp
672 }
673
674 func ExampleClient_RenameTagTemplateFieldEnumValue() {
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 := datacatalog.NewClient(ctx)
682 if err != nil {
683 // TODO: Handle error.
684 }
685 defer c.Close()
686
687 req := &datacatalogpb.RenameTagTemplateFieldEnumValueRequest{
688 // TODO: Fill request struct fields.
689 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#RenameTagTemplateFieldEnumValueRequest.
690 }
691 resp, err := c.RenameTagTemplateFieldEnumValue(ctx, req)
692 if err != nil {
693 // TODO: Handle error.
694 }
695 // TODO: Use resp.
696 _ = resp
697 }
698
699 func ExampleClient_RetrieveConfig() {
700 ctx := context.Background()
701 // This snippet has been automatically generated and should be regarded as a code template only.
702 // It will require modifications to work:
703 // - It may require correct/in-range values for request initialization.
704 // - It may require specifying regional endpoints when creating the service client as shown in:
705 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
706 c, err := datacatalog.NewClient(ctx)
707 if err != nil {
708 // TODO: Handle error.
709 }
710 defer c.Close()
711
712 req := &datacatalogpb.RetrieveConfigRequest{
713 // TODO: Fill request struct fields.
714 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#RetrieveConfigRequest.
715 }
716 resp, err := c.RetrieveConfig(ctx, req)
717 if err != nil {
718 // TODO: Handle error.
719 }
720 // TODO: Use resp.
721 _ = resp
722 }
723
724 func ExampleClient_RetrieveEffectiveConfig() {
725 ctx := context.Background()
726 // This snippet has been automatically generated and should be regarded as a code template only.
727 // It will require modifications to work:
728 // - It may require correct/in-range values for request initialization.
729 // - It may require specifying regional endpoints when creating the service client as shown in:
730 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
731 c, err := datacatalog.NewClient(ctx)
732 if err != nil {
733 // TODO: Handle error.
734 }
735 defer c.Close()
736
737 req := &datacatalogpb.RetrieveEffectiveConfigRequest{
738 // TODO: Fill request struct fields.
739 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#RetrieveEffectiveConfigRequest.
740 }
741 resp, err := c.RetrieveEffectiveConfig(ctx, req)
742 if err != nil {
743 // TODO: Handle error.
744 }
745 // TODO: Use resp.
746 _ = resp
747 }
748
749 func ExampleClient_SearchCatalog() {
750 ctx := context.Background()
751 // This snippet has been automatically generated and should be regarded as a code template only.
752 // It will require modifications to work:
753 // - It may require correct/in-range values for request initialization.
754 // - It may require specifying regional endpoints when creating the service client as shown in:
755 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
756 c, err := datacatalog.NewClient(ctx)
757 if err != nil {
758 // TODO: Handle error.
759 }
760 defer c.Close()
761
762 req := &datacatalogpb.SearchCatalogRequest{
763 // TODO: Fill request struct fields.
764 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#SearchCatalogRequest.
765 }
766 it := c.SearchCatalog(ctx, req)
767 for {
768 resp, err := it.Next()
769 if err == iterator.Done {
770 break
771 }
772 if err != nil {
773 // TODO: Handle error.
774 }
775 // TODO: Use resp.
776 _ = resp
777
778 // If you need to access the underlying RPC response,
779 // you can do so by casting the `Response` as below.
780 // Otherwise, remove this line. Only populated after
781 // first call to Next(). Not safe for concurrent access.
782 _ = it.Response.(*datacatalogpb.SearchCatalogResponse)
783 }
784 }
785
786 func ExampleClient_SetConfig() {
787 ctx := context.Background()
788 // This snippet has been automatically generated and should be regarded as a code template only.
789 // It will require modifications to work:
790 // - It may require correct/in-range values for request initialization.
791 // - It may require specifying regional endpoints when creating the service client as shown in:
792 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
793 c, err := datacatalog.NewClient(ctx)
794 if err != nil {
795 // TODO: Handle error.
796 }
797 defer c.Close()
798
799 req := &datacatalogpb.SetConfigRequest{
800 // TODO: Fill request struct fields.
801 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#SetConfigRequest.
802 }
803 resp, err := c.SetConfig(ctx, req)
804 if err != nil {
805 // TODO: Handle error.
806 }
807 // TODO: Use resp.
808 _ = resp
809 }
810
811 func ExampleClient_SetIamPolicy() {
812 ctx := context.Background()
813 // This snippet has been automatically generated and should be regarded as a code template only.
814 // It will require modifications to work:
815 // - It may require correct/in-range values for request initialization.
816 // - It may require specifying regional endpoints when creating the service client as shown in:
817 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
818 c, err := datacatalog.NewClient(ctx)
819 if err != nil {
820 // TODO: Handle error.
821 }
822 defer c.Close()
823
824 req := &iampb.SetIamPolicyRequest{
825 // TODO: Fill request struct fields.
826 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
827 }
828 resp, err := c.SetIamPolicy(ctx, req)
829 if err != nil {
830 // TODO: Handle error.
831 }
832 // TODO: Use resp.
833 _ = resp
834 }
835
836 func ExampleClient_StarEntry() {
837 ctx := context.Background()
838 // This snippet has been automatically generated and should be regarded as a code template only.
839 // It will require modifications to work:
840 // - It may require correct/in-range values for request initialization.
841 // - It may require specifying regional endpoints when creating the service client as shown in:
842 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
843 c, err := datacatalog.NewClient(ctx)
844 if err != nil {
845 // TODO: Handle error.
846 }
847 defer c.Close()
848
849 req := &datacatalogpb.StarEntryRequest{
850 // TODO: Fill request struct fields.
851 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#StarEntryRequest.
852 }
853 resp, err := c.StarEntry(ctx, req)
854 if err != nil {
855 // TODO: Handle error.
856 }
857 // TODO: Use resp.
858 _ = resp
859 }
860
861 func ExampleClient_TestIamPermissions() {
862 ctx := context.Background()
863 // This snippet has been automatically generated and should be regarded as a code template only.
864 // It will require modifications to work:
865 // - It may require correct/in-range values for request initialization.
866 // - It may require specifying regional endpoints when creating the service client as shown in:
867 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
868 c, err := datacatalog.NewClient(ctx)
869 if err != nil {
870 // TODO: Handle error.
871 }
872 defer c.Close()
873
874 req := &iampb.TestIamPermissionsRequest{
875 // TODO: Fill request struct fields.
876 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
877 }
878 resp, err := c.TestIamPermissions(ctx, req)
879 if err != nil {
880 // TODO: Handle error.
881 }
882 // TODO: Use resp.
883 _ = resp
884 }
885
886 func ExampleClient_UnstarEntry() {
887 ctx := context.Background()
888 // This snippet has been automatically generated and should be regarded as a code template only.
889 // It will require modifications to work:
890 // - It may require correct/in-range values for request initialization.
891 // - It may require specifying regional endpoints when creating the service client as shown in:
892 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
893 c, err := datacatalog.NewClient(ctx)
894 if err != nil {
895 // TODO: Handle error.
896 }
897 defer c.Close()
898
899 req := &datacatalogpb.UnstarEntryRequest{
900 // TODO: Fill request struct fields.
901 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#UnstarEntryRequest.
902 }
903 resp, err := c.UnstarEntry(ctx, req)
904 if err != nil {
905 // TODO: Handle error.
906 }
907 // TODO: Use resp.
908 _ = resp
909 }
910
911 func ExampleClient_UpdateEntry() {
912 ctx := context.Background()
913 // This snippet has been automatically generated and should be regarded as a code template only.
914 // It will require modifications to work:
915 // - It may require correct/in-range values for request initialization.
916 // - It may require specifying regional endpoints when creating the service client as shown in:
917 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
918 c, err := datacatalog.NewClient(ctx)
919 if err != nil {
920 // TODO: Handle error.
921 }
922 defer c.Close()
923
924 req := &datacatalogpb.UpdateEntryRequest{
925 // TODO: Fill request struct fields.
926 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#UpdateEntryRequest.
927 }
928 resp, err := c.UpdateEntry(ctx, req)
929 if err != nil {
930 // TODO: Handle error.
931 }
932 // TODO: Use resp.
933 _ = resp
934 }
935
936 func ExampleClient_UpdateEntryGroup() {
937 ctx := context.Background()
938 // This snippet has been automatically generated and should be regarded as a code template only.
939 // It will require modifications to work:
940 // - It may require correct/in-range values for request initialization.
941 // - It may require specifying regional endpoints when creating the service client as shown in:
942 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
943 c, err := datacatalog.NewClient(ctx)
944 if err != nil {
945 // TODO: Handle error.
946 }
947 defer c.Close()
948
949 req := &datacatalogpb.UpdateEntryGroupRequest{
950 // TODO: Fill request struct fields.
951 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#UpdateEntryGroupRequest.
952 }
953 resp, err := c.UpdateEntryGroup(ctx, req)
954 if err != nil {
955 // TODO: Handle error.
956 }
957 // TODO: Use resp.
958 _ = resp
959 }
960
961 func ExampleClient_UpdateTag() {
962 ctx := context.Background()
963 // This snippet has been automatically generated and should be regarded as a code template only.
964 // It will require modifications to work:
965 // - It may require correct/in-range values for request initialization.
966 // - It may require specifying regional endpoints when creating the service client as shown in:
967 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
968 c, err := datacatalog.NewClient(ctx)
969 if err != nil {
970 // TODO: Handle error.
971 }
972 defer c.Close()
973
974 req := &datacatalogpb.UpdateTagRequest{
975 // TODO: Fill request struct fields.
976 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#UpdateTagRequest.
977 }
978 resp, err := c.UpdateTag(ctx, req)
979 if err != nil {
980 // TODO: Handle error.
981 }
982 // TODO: Use resp.
983 _ = resp
984 }
985
986 func ExampleClient_UpdateTagTemplate() {
987 ctx := context.Background()
988 // This snippet has been automatically generated and should be regarded as a code template only.
989 // It will require modifications to work:
990 // - It may require correct/in-range values for request initialization.
991 // - It may require specifying regional endpoints when creating the service client as shown in:
992 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
993 c, err := datacatalog.NewClient(ctx)
994 if err != nil {
995 // TODO: Handle error.
996 }
997 defer c.Close()
998
999 req := &datacatalogpb.UpdateTagTemplateRequest{
1000 // TODO: Fill request struct fields.
1001 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#UpdateTagTemplateRequest.
1002 }
1003 resp, err := c.UpdateTagTemplate(ctx, req)
1004 if err != nil {
1005 // TODO: Handle error.
1006 }
1007 // TODO: Use resp.
1008 _ = resp
1009 }
1010
1011 func ExampleClient_UpdateTagTemplateField() {
1012 ctx := context.Background()
1013 // This snippet has been automatically generated and should be regarded as a code template only.
1014 // It will require modifications to work:
1015 // - It may require correct/in-range values for request initialization.
1016 // - It may require specifying regional endpoints when creating the service client as shown in:
1017 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1018 c, err := datacatalog.NewClient(ctx)
1019 if err != nil {
1020 // TODO: Handle error.
1021 }
1022 defer c.Close()
1023
1024 req := &datacatalogpb.UpdateTagTemplateFieldRequest{
1025 // TODO: Fill request struct fields.
1026 // See https://pkg.go.dev/cloud.google.com/go/datacatalog/apiv1/datacatalogpb#UpdateTagTemplateFieldRequest.
1027 }
1028 resp, err := c.UpdateTagTemplateField(ctx, req)
1029 if err != nil {
1030 // TODO: Handle error.
1031 }
1032 // TODO: Use resp.
1033 _ = resp
1034 }
1035
1036 func ExampleClient_CancelOperation() {
1037 ctx := context.Background()
1038 // This snippet has been automatically generated and should be regarded as a code template only.
1039 // It will require modifications to work:
1040 // - It may require correct/in-range values for request initialization.
1041 // - It may require specifying regional endpoints when creating the service client as shown in:
1042 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1043 c, err := datacatalog.NewClient(ctx)
1044 if err != nil {
1045 // TODO: Handle error.
1046 }
1047 defer c.Close()
1048
1049 req := &longrunningpb.CancelOperationRequest{
1050 // TODO: Fill request struct fields.
1051 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
1052 }
1053 err = c.CancelOperation(ctx, req)
1054 if err != nil {
1055 // TODO: Handle error.
1056 }
1057 }
1058
1059 func ExampleClient_DeleteOperation() {
1060 ctx := context.Background()
1061 // This snippet has been automatically generated and should be regarded as a code template only.
1062 // It will require modifications to work:
1063 // - It may require correct/in-range values for request initialization.
1064 // - It may require specifying regional endpoints when creating the service client as shown in:
1065 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1066 c, err := datacatalog.NewClient(ctx)
1067 if err != nil {
1068 // TODO: Handle error.
1069 }
1070 defer c.Close()
1071
1072 req := &longrunningpb.DeleteOperationRequest{
1073 // TODO: Fill request struct fields.
1074 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
1075 }
1076 err = c.DeleteOperation(ctx, req)
1077 if err != nil {
1078 // TODO: Handle error.
1079 }
1080 }
1081
1082 func ExampleClient_GetOperation() {
1083 ctx := context.Background()
1084 // This snippet has been automatically generated and should be regarded as a code template only.
1085 // It will require modifications to work:
1086 // - It may require correct/in-range values for request initialization.
1087 // - It may require specifying regional endpoints when creating the service client as shown in:
1088 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1089 c, err := datacatalog.NewClient(ctx)
1090 if err != nil {
1091 // TODO: Handle error.
1092 }
1093 defer c.Close()
1094
1095 req := &longrunningpb.GetOperationRequest{
1096 // TODO: Fill request struct fields.
1097 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
1098 }
1099 resp, err := c.GetOperation(ctx, req)
1100 if err != nil {
1101 // TODO: Handle error.
1102 }
1103 // TODO: Use resp.
1104 _ = resp
1105 }
1106
1107 func ExampleClient_ListOperations() {
1108 ctx := context.Background()
1109 // This snippet has been automatically generated and should be regarded as a code template only.
1110 // It will require modifications to work:
1111 // - It may require correct/in-range values for request initialization.
1112 // - It may require specifying regional endpoints when creating the service client as shown in:
1113 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1114 c, err := datacatalog.NewClient(ctx)
1115 if err != nil {
1116 // TODO: Handle error.
1117 }
1118 defer c.Close()
1119
1120 req := &longrunningpb.ListOperationsRequest{
1121 // TODO: Fill request struct fields.
1122 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
1123 }
1124 it := c.ListOperations(ctx, req)
1125 for {
1126 resp, err := it.Next()
1127 if err == iterator.Done {
1128 break
1129 }
1130 if err != nil {
1131 // TODO: Handle error.
1132 }
1133 // TODO: Use resp.
1134 _ = resp
1135
1136 // If you need to access the underlying RPC response,
1137 // you can do so by casting the `Response` as below.
1138 // Otherwise, remove this line. Only populated after
1139 // first call to Next(). Not safe for concurrent access.
1140 _ = it.Response.(*longrunningpb.ListOperationsResponse)
1141 }
1142 }