cloud.google.com/go/aiplatform@v1.106.0/apiv1beta1/feature_registry_client_example_test.go (about) 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 aiplatform_test 18 19 import ( 20 "context" 21 22 aiplatform "cloud.google.com/go/aiplatform/apiv1beta1" 23 aiplatformpb "cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb" 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 locationpb "google.golang.org/genproto/googleapis/cloud/location" 28 ) 29 30 func ExampleNewFeatureRegistryClient() { 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 := aiplatform.NewFeatureRegistryClient(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 ExampleNewFeatureRegistryRESTClient() { 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 := aiplatform.NewFeatureRegistryRESTClient(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 ExampleFeatureRegistryClient_BatchCreateFeatures() { 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 := aiplatform.NewFeatureRegistryClient(ctx) 72 if err != nil { 73 // TODO: Handle error. 74 } 75 defer c.Close() 76 77 req := &aiplatformpb.BatchCreateFeaturesRequest{ 78 // TODO: Fill request struct fields. 79 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#BatchCreateFeaturesRequest. 80 } 81 op, err := c.BatchCreateFeatures(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 ExampleFeatureRegistryClient_CreateFeature() { 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 := aiplatform.NewFeatureRegistryClient(ctx) 102 if err != nil { 103 // TODO: Handle error. 104 } 105 defer c.Close() 106 107 req := &aiplatformpb.CreateFeatureRequest{ 108 // TODO: Fill request struct fields. 109 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateFeatureRequest. 110 } 111 op, err := c.CreateFeature(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 ExampleFeatureRegistryClient_CreateFeatureGroup() { 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 := aiplatform.NewFeatureRegistryClient(ctx) 132 if err != nil { 133 // TODO: Handle error. 134 } 135 defer c.Close() 136 137 req := &aiplatformpb.CreateFeatureGroupRequest{ 138 // TODO: Fill request struct fields. 139 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateFeatureGroupRequest. 140 } 141 op, err := c.CreateFeatureGroup(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 ExampleFeatureRegistryClient_CreateFeatureMonitor() { 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 := aiplatform.NewFeatureRegistryClient(ctx) 162 if err != nil { 163 // TODO: Handle error. 164 } 165 defer c.Close() 166 167 req := &aiplatformpb.CreateFeatureMonitorRequest{ 168 // TODO: Fill request struct fields. 169 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateFeatureMonitorRequest. 170 } 171 op, err := c.CreateFeatureMonitor(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 ExampleFeatureRegistryClient_CreateFeatureMonitorJob() { 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 := aiplatform.NewFeatureRegistryClient(ctx) 192 if err != nil { 193 // TODO: Handle error. 194 } 195 defer c.Close() 196 197 req := &aiplatformpb.CreateFeatureMonitorJobRequest{ 198 // TODO: Fill request struct fields. 199 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateFeatureMonitorJobRequest. 200 } 201 resp, err := c.CreateFeatureMonitorJob(ctx, req) 202 if err != nil { 203 // TODO: Handle error. 204 } 205 // TODO: Use resp. 206 _ = resp 207 } 208 209 func ExampleFeatureRegistryClient_DeleteFeature() { 210 ctx := context.Background() 211 // This snippet has been automatically generated and should be regarded as a code template only. 212 // It will require modifications to work: 213 // - It may require correct/in-range values for request initialization. 214 // - It may require specifying regional endpoints when creating the service client as shown in: 215 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 216 c, err := aiplatform.NewFeatureRegistryClient(ctx) 217 if err != nil { 218 // TODO: Handle error. 219 } 220 defer c.Close() 221 222 req := &aiplatformpb.DeleteFeatureRequest{ 223 // TODO: Fill request struct fields. 224 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#DeleteFeatureRequest. 225 } 226 op, err := c.DeleteFeature(ctx, req) 227 if err != nil { 228 // TODO: Handle error. 229 } 230 231 err = op.Wait(ctx) 232 if err != nil { 233 // TODO: Handle error. 234 } 235 } 236 237 func ExampleFeatureRegistryClient_DeleteFeatureGroup() { 238 ctx := context.Background() 239 // This snippet has been automatically generated and should be regarded as a code template only. 240 // It will require modifications to work: 241 // - It may require correct/in-range values for request initialization. 242 // - It may require specifying regional endpoints when creating the service client as shown in: 243 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 244 c, err := aiplatform.NewFeatureRegistryClient(ctx) 245 if err != nil { 246 // TODO: Handle error. 247 } 248 defer c.Close() 249 250 req := &aiplatformpb.DeleteFeatureGroupRequest{ 251 // TODO: Fill request struct fields. 252 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#DeleteFeatureGroupRequest. 253 } 254 op, err := c.DeleteFeatureGroup(ctx, req) 255 if err != nil { 256 // TODO: Handle error. 257 } 258 259 err = op.Wait(ctx) 260 if err != nil { 261 // TODO: Handle error. 262 } 263 } 264 265 func ExampleFeatureRegistryClient_DeleteFeatureMonitor() { 266 ctx := context.Background() 267 // This snippet has been automatically generated and should be regarded as a code template only. 268 // It will require modifications to work: 269 // - It may require correct/in-range values for request initialization. 270 // - It may require specifying regional endpoints when creating the service client as shown in: 271 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 272 c, err := aiplatform.NewFeatureRegistryClient(ctx) 273 if err != nil { 274 // TODO: Handle error. 275 } 276 defer c.Close() 277 278 req := &aiplatformpb.DeleteFeatureMonitorRequest{ 279 // TODO: Fill request struct fields. 280 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#DeleteFeatureMonitorRequest. 281 } 282 op, err := c.DeleteFeatureMonitor(ctx, req) 283 if err != nil { 284 // TODO: Handle error. 285 } 286 287 err = op.Wait(ctx) 288 if err != nil { 289 // TODO: Handle error. 290 } 291 } 292 293 func ExampleFeatureRegistryClient_GetFeature() { 294 ctx := context.Background() 295 // This snippet has been automatically generated and should be regarded as a code template only. 296 // It will require modifications to work: 297 // - It may require correct/in-range values for request initialization. 298 // - It may require specifying regional endpoints when creating the service client as shown in: 299 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 300 c, err := aiplatform.NewFeatureRegistryClient(ctx) 301 if err != nil { 302 // TODO: Handle error. 303 } 304 defer c.Close() 305 306 req := &aiplatformpb.GetFeatureRequest{ 307 // TODO: Fill request struct fields. 308 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetFeatureRequest. 309 } 310 resp, err := c.GetFeature(ctx, req) 311 if err != nil { 312 // TODO: Handle error. 313 } 314 // TODO: Use resp. 315 _ = resp 316 } 317 318 func ExampleFeatureRegistryClient_GetFeatureGroup() { 319 ctx := context.Background() 320 // This snippet has been automatically generated and should be regarded as a code template only. 321 // It will require modifications to work: 322 // - It may require correct/in-range values for request initialization. 323 // - It may require specifying regional endpoints when creating the service client as shown in: 324 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 325 c, err := aiplatform.NewFeatureRegistryClient(ctx) 326 if err != nil { 327 // TODO: Handle error. 328 } 329 defer c.Close() 330 331 req := &aiplatformpb.GetFeatureGroupRequest{ 332 // TODO: Fill request struct fields. 333 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetFeatureGroupRequest. 334 } 335 resp, err := c.GetFeatureGroup(ctx, req) 336 if err != nil { 337 // TODO: Handle error. 338 } 339 // TODO: Use resp. 340 _ = resp 341 } 342 343 func ExampleFeatureRegistryClient_GetFeatureMonitor() { 344 ctx := context.Background() 345 // This snippet has been automatically generated and should be regarded as a code template only. 346 // It will require modifications to work: 347 // - It may require correct/in-range values for request initialization. 348 // - It may require specifying regional endpoints when creating the service client as shown in: 349 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 350 c, err := aiplatform.NewFeatureRegistryClient(ctx) 351 if err != nil { 352 // TODO: Handle error. 353 } 354 defer c.Close() 355 356 req := &aiplatformpb.GetFeatureMonitorRequest{ 357 // TODO: Fill request struct fields. 358 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetFeatureMonitorRequest. 359 } 360 resp, err := c.GetFeatureMonitor(ctx, req) 361 if err != nil { 362 // TODO: Handle error. 363 } 364 // TODO: Use resp. 365 _ = resp 366 } 367 368 func ExampleFeatureRegistryClient_GetFeatureMonitorJob() { 369 ctx := context.Background() 370 // This snippet has been automatically generated and should be regarded as a code template only. 371 // It will require modifications to work: 372 // - It may require correct/in-range values for request initialization. 373 // - It may require specifying regional endpoints when creating the service client as shown in: 374 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 375 c, err := aiplatform.NewFeatureRegistryClient(ctx) 376 if err != nil { 377 // TODO: Handle error. 378 } 379 defer c.Close() 380 381 req := &aiplatformpb.GetFeatureMonitorJobRequest{ 382 // TODO: Fill request struct fields. 383 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetFeatureMonitorJobRequest. 384 } 385 resp, err := c.GetFeatureMonitorJob(ctx, req) 386 if err != nil { 387 // TODO: Handle error. 388 } 389 // TODO: Use resp. 390 _ = resp 391 } 392 393 func ExampleFeatureRegistryClient_ListFeatureGroups() { 394 ctx := context.Background() 395 // This snippet has been automatically generated and should be regarded as a code template only. 396 // It will require modifications to work: 397 // - It may require correct/in-range values for request initialization. 398 // - It may require specifying regional endpoints when creating the service client as shown in: 399 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 400 c, err := aiplatform.NewFeatureRegistryClient(ctx) 401 if err != nil { 402 // TODO: Handle error. 403 } 404 defer c.Close() 405 406 req := &aiplatformpb.ListFeatureGroupsRequest{ 407 // TODO: Fill request struct fields. 408 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListFeatureGroupsRequest. 409 } 410 it := c.ListFeatureGroups(ctx, req) 411 for { 412 resp, err := it.Next() 413 if err == iterator.Done { 414 break 415 } 416 if err != nil { 417 // TODO: Handle error. 418 } 419 // TODO: Use resp. 420 _ = resp 421 422 // If you need to access the underlying RPC response, 423 // you can do so by casting the `Response` as below. 424 // Otherwise, remove this line. Only populated after 425 // first call to Next(). Not safe for concurrent access. 426 _ = it.Response.(*aiplatformpb.ListFeatureGroupsResponse) 427 } 428 } 429 430 func ExampleFeatureRegistryClient_ListFeatureMonitorJobs() { 431 ctx := context.Background() 432 // This snippet has been automatically generated and should be regarded as a code template only. 433 // It will require modifications to work: 434 // - It may require correct/in-range values for request initialization. 435 // - It may require specifying regional endpoints when creating the service client as shown in: 436 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 437 c, err := aiplatform.NewFeatureRegistryClient(ctx) 438 if err != nil { 439 // TODO: Handle error. 440 } 441 defer c.Close() 442 443 req := &aiplatformpb.ListFeatureMonitorJobsRequest{ 444 // TODO: Fill request struct fields. 445 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListFeatureMonitorJobsRequest. 446 } 447 it := c.ListFeatureMonitorJobs(ctx, req) 448 for { 449 resp, err := it.Next() 450 if err == iterator.Done { 451 break 452 } 453 if err != nil { 454 // TODO: Handle error. 455 } 456 // TODO: Use resp. 457 _ = resp 458 459 // If you need to access the underlying RPC response, 460 // you can do so by casting the `Response` as below. 461 // Otherwise, remove this line. Only populated after 462 // first call to Next(). Not safe for concurrent access. 463 _ = it.Response.(*aiplatformpb.ListFeatureMonitorJobsResponse) 464 } 465 } 466 467 func ExampleFeatureRegistryClient_ListFeatureMonitors() { 468 ctx := context.Background() 469 // This snippet has been automatically generated and should be regarded as a code template only. 470 // It will require modifications to work: 471 // - It may require correct/in-range values for request initialization. 472 // - It may require specifying regional endpoints when creating the service client as shown in: 473 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 474 c, err := aiplatform.NewFeatureRegistryClient(ctx) 475 if err != nil { 476 // TODO: Handle error. 477 } 478 defer c.Close() 479 480 req := &aiplatformpb.ListFeatureMonitorsRequest{ 481 // TODO: Fill request struct fields. 482 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListFeatureMonitorsRequest. 483 } 484 it := c.ListFeatureMonitors(ctx, req) 485 for { 486 resp, err := it.Next() 487 if err == iterator.Done { 488 break 489 } 490 if err != nil { 491 // TODO: Handle error. 492 } 493 // TODO: Use resp. 494 _ = resp 495 496 // If you need to access the underlying RPC response, 497 // you can do so by casting the `Response` as below. 498 // Otherwise, remove this line. Only populated after 499 // first call to Next(). Not safe for concurrent access. 500 _ = it.Response.(*aiplatformpb.ListFeatureMonitorsResponse) 501 } 502 } 503 504 func ExampleFeatureRegistryClient_ListFeatures() { 505 ctx := context.Background() 506 // This snippet has been automatically generated and should be regarded as a code template only. 507 // It will require modifications to work: 508 // - It may require correct/in-range values for request initialization. 509 // - It may require specifying regional endpoints when creating the service client as shown in: 510 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 511 c, err := aiplatform.NewFeatureRegistryClient(ctx) 512 if err != nil { 513 // TODO: Handle error. 514 } 515 defer c.Close() 516 517 req := &aiplatformpb.ListFeaturesRequest{ 518 // TODO: Fill request struct fields. 519 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListFeaturesRequest. 520 } 521 it := c.ListFeatures(ctx, req) 522 for { 523 resp, err := it.Next() 524 if err == iterator.Done { 525 break 526 } 527 if err != nil { 528 // TODO: Handle error. 529 } 530 // TODO: Use resp. 531 _ = resp 532 533 // If you need to access the underlying RPC response, 534 // you can do so by casting the `Response` as below. 535 // Otherwise, remove this line. Only populated after 536 // first call to Next(). Not safe for concurrent access. 537 _ = it.Response.(*aiplatformpb.ListFeaturesResponse) 538 } 539 } 540 541 func ExampleFeatureRegistryClient_UpdateFeature() { 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 := aiplatform.NewFeatureRegistryClient(ctx) 549 if err != nil { 550 // TODO: Handle error. 551 } 552 defer c.Close() 553 554 req := &aiplatformpb.UpdateFeatureRequest{ 555 // TODO: Fill request struct fields. 556 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#UpdateFeatureRequest. 557 } 558 op, err := c.UpdateFeature(ctx, req) 559 if err != nil { 560 // TODO: Handle error. 561 } 562 563 resp, err := op.Wait(ctx) 564 if err != nil { 565 // TODO: Handle error. 566 } 567 // TODO: Use resp. 568 _ = resp 569 } 570 571 func ExampleFeatureRegistryClient_UpdateFeatureGroup() { 572 ctx := context.Background() 573 // This snippet has been automatically generated and should be regarded as a code template only. 574 // It will require modifications to work: 575 // - It may require correct/in-range values for request initialization. 576 // - It may require specifying regional endpoints when creating the service client as shown in: 577 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 578 c, err := aiplatform.NewFeatureRegistryClient(ctx) 579 if err != nil { 580 // TODO: Handle error. 581 } 582 defer c.Close() 583 584 req := &aiplatformpb.UpdateFeatureGroupRequest{ 585 // TODO: Fill request struct fields. 586 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#UpdateFeatureGroupRequest. 587 } 588 op, err := c.UpdateFeatureGroup(ctx, req) 589 if err != nil { 590 // TODO: Handle error. 591 } 592 593 resp, err := op.Wait(ctx) 594 if err != nil { 595 // TODO: Handle error. 596 } 597 // TODO: Use resp. 598 _ = resp 599 } 600 601 func ExampleFeatureRegistryClient_UpdateFeatureMonitor() { 602 ctx := context.Background() 603 // This snippet has been automatically generated and should be regarded as a code template only. 604 // It will require modifications to work: 605 // - It may require correct/in-range values for request initialization. 606 // - It may require specifying regional endpoints when creating the service client as shown in: 607 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 608 c, err := aiplatform.NewFeatureRegistryClient(ctx) 609 if err != nil { 610 // TODO: Handle error. 611 } 612 defer c.Close() 613 614 req := &aiplatformpb.UpdateFeatureMonitorRequest{ 615 // TODO: Fill request struct fields. 616 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#UpdateFeatureMonitorRequest. 617 } 618 op, err := c.UpdateFeatureMonitor(ctx, req) 619 if err != nil { 620 // TODO: Handle error. 621 } 622 623 resp, err := op.Wait(ctx) 624 if err != nil { 625 // TODO: Handle error. 626 } 627 // TODO: Use resp. 628 _ = resp 629 } 630 631 func ExampleFeatureRegistryClient_GetLocation() { 632 ctx := context.Background() 633 // This snippet has been automatically generated and should be regarded as a code template only. 634 // It will require modifications to work: 635 // - It may require correct/in-range values for request initialization. 636 // - It may require specifying regional endpoints when creating the service client as shown in: 637 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 638 c, err := aiplatform.NewFeatureRegistryClient(ctx) 639 if err != nil { 640 // TODO: Handle error. 641 } 642 defer c.Close() 643 644 req := &locationpb.GetLocationRequest{ 645 // TODO: Fill request struct fields. 646 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest. 647 } 648 resp, err := c.GetLocation(ctx, req) 649 if err != nil { 650 // TODO: Handle error. 651 } 652 // TODO: Use resp. 653 _ = resp 654 } 655 656 func ExampleFeatureRegistryClient_ListLocations() { 657 ctx := context.Background() 658 // This snippet has been automatically generated and should be regarded as a code template only. 659 // It will require modifications to work: 660 // - It may require correct/in-range values for request initialization. 661 // - It may require specifying regional endpoints when creating the service client as shown in: 662 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 663 c, err := aiplatform.NewFeatureRegistryClient(ctx) 664 if err != nil { 665 // TODO: Handle error. 666 } 667 defer c.Close() 668 669 req := &locationpb.ListLocationsRequest{ 670 // TODO: Fill request struct fields. 671 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. 672 } 673 it := c.ListLocations(ctx, req) 674 for { 675 resp, err := it.Next() 676 if err == iterator.Done { 677 break 678 } 679 if err != nil { 680 // TODO: Handle error. 681 } 682 // TODO: Use resp. 683 _ = resp 684 685 // If you need to access the underlying RPC response, 686 // you can do so by casting the `Response` as below. 687 // Otherwise, remove this line. Only populated after 688 // first call to Next(). Not safe for concurrent access. 689 _ = it.Response.(*locationpb.ListLocationsResponse) 690 } 691 } 692 693 func ExampleFeatureRegistryClient_GetIamPolicy() { 694 ctx := context.Background() 695 // This snippet has been automatically generated and should be regarded as a code template only. 696 // It will require modifications to work: 697 // - It may require correct/in-range values for request initialization. 698 // - It may require specifying regional endpoints when creating the service client as shown in: 699 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 700 c, err := aiplatform.NewFeatureRegistryClient(ctx) 701 if err != nil { 702 // TODO: Handle error. 703 } 704 defer c.Close() 705 706 req := &iampb.GetIamPolicyRequest{ 707 // TODO: Fill request struct fields. 708 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest. 709 } 710 resp, err := c.GetIamPolicy(ctx, req) 711 if err != nil { 712 // TODO: Handle error. 713 } 714 // TODO: Use resp. 715 _ = resp 716 } 717 718 func ExampleFeatureRegistryClient_SetIamPolicy() { 719 ctx := context.Background() 720 // This snippet has been automatically generated and should be regarded as a code template only. 721 // It will require modifications to work: 722 // - It may require correct/in-range values for request initialization. 723 // - It may require specifying regional endpoints when creating the service client as shown in: 724 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 725 c, err := aiplatform.NewFeatureRegistryClient(ctx) 726 if err != nil { 727 // TODO: Handle error. 728 } 729 defer c.Close() 730 731 req := &iampb.SetIamPolicyRequest{ 732 // TODO: Fill request struct fields. 733 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest. 734 } 735 resp, err := c.SetIamPolicy(ctx, req) 736 if err != nil { 737 // TODO: Handle error. 738 } 739 // TODO: Use resp. 740 _ = resp 741 } 742 743 func ExampleFeatureRegistryClient_TestIamPermissions() { 744 ctx := context.Background() 745 // This snippet has been automatically generated and should be regarded as a code template only. 746 // It will require modifications to work: 747 // - It may require correct/in-range values for request initialization. 748 // - It may require specifying regional endpoints when creating the service client as shown in: 749 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 750 c, err := aiplatform.NewFeatureRegistryClient(ctx) 751 if err != nil { 752 // TODO: Handle error. 753 } 754 defer c.Close() 755 756 req := &iampb.TestIamPermissionsRequest{ 757 // TODO: Fill request struct fields. 758 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest. 759 } 760 resp, err := c.TestIamPermissions(ctx, req) 761 if err != nil { 762 // TODO: Handle error. 763 } 764 // TODO: Use resp. 765 _ = resp 766 } 767 768 func ExampleFeatureRegistryClient_CancelOperation() { 769 ctx := context.Background() 770 // This snippet has been automatically generated and should be regarded as a code template only. 771 // It will require modifications to work: 772 // - It may require correct/in-range values for request initialization. 773 // - It may require specifying regional endpoints when creating the service client as shown in: 774 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 775 c, err := aiplatform.NewFeatureRegistryClient(ctx) 776 if err != nil { 777 // TODO: Handle error. 778 } 779 defer c.Close() 780 781 req := &longrunningpb.CancelOperationRequest{ 782 // TODO: Fill request struct fields. 783 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. 784 } 785 err = c.CancelOperation(ctx, req) 786 if err != nil { 787 // TODO: Handle error. 788 } 789 } 790 791 func ExampleFeatureRegistryClient_DeleteOperation() { 792 ctx := context.Background() 793 // This snippet has been automatically generated and should be regarded as a code template only. 794 // It will require modifications to work: 795 // - It may require correct/in-range values for request initialization. 796 // - It may require specifying regional endpoints when creating the service client as shown in: 797 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 798 c, err := aiplatform.NewFeatureRegistryClient(ctx) 799 if err != nil { 800 // TODO: Handle error. 801 } 802 defer c.Close() 803 804 req := &longrunningpb.DeleteOperationRequest{ 805 // TODO: Fill request struct fields. 806 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest. 807 } 808 err = c.DeleteOperation(ctx, req) 809 if err != nil { 810 // TODO: Handle error. 811 } 812 } 813 814 func ExampleFeatureRegistryClient_GetOperation() { 815 ctx := context.Background() 816 // This snippet has been automatically generated and should be regarded as a code template only. 817 // It will require modifications to work: 818 // - It may require correct/in-range values for request initialization. 819 // - It may require specifying regional endpoints when creating the service client as shown in: 820 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 821 c, err := aiplatform.NewFeatureRegistryClient(ctx) 822 if err != nil { 823 // TODO: Handle error. 824 } 825 defer c.Close() 826 827 req := &longrunningpb.GetOperationRequest{ 828 // TODO: Fill request struct fields. 829 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. 830 } 831 resp, err := c.GetOperation(ctx, req) 832 if err != nil { 833 // TODO: Handle error. 834 } 835 // TODO: Use resp. 836 _ = resp 837 } 838 839 func ExampleFeatureRegistryClient_ListOperations() { 840 ctx := context.Background() 841 // This snippet has been automatically generated and should be regarded as a code template only. 842 // It will require modifications to work: 843 // - It may require correct/in-range values for request initialization. 844 // - It may require specifying regional endpoints when creating the service client as shown in: 845 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 846 c, err := aiplatform.NewFeatureRegistryClient(ctx) 847 if err != nil { 848 // TODO: Handle error. 849 } 850 defer c.Close() 851 852 req := &longrunningpb.ListOperationsRequest{ 853 // TODO: Fill request struct fields. 854 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. 855 } 856 it := c.ListOperations(ctx, req) 857 for { 858 resp, err := it.Next() 859 if err == iterator.Done { 860 break 861 } 862 if err != nil { 863 // TODO: Handle error. 864 } 865 // TODO: Use resp. 866 _ = resp 867 868 // If you need to access the underlying RPC response, 869 // you can do so by casting the `Response` as below. 870 // Otherwise, remove this line. Only populated after 871 // first call to Next(). Not safe for concurrent access. 872 _ = it.Response.(*longrunningpb.ListOperationsResponse) 873 } 874 } 875 876 func ExampleFeatureRegistryClient_WaitOperation() { 877 ctx := context.Background() 878 // This snippet has been automatically generated and should be regarded as a code template only. 879 // It will require modifications to work: 880 // - It may require correct/in-range values for request initialization. 881 // - It may require specifying regional endpoints when creating the service client as shown in: 882 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 883 c, err := aiplatform.NewFeatureRegistryClient(ctx) 884 if err != nil { 885 // TODO: Handle error. 886 } 887 defer c.Close() 888 889 req := &longrunningpb.WaitOperationRequest{ 890 // TODO: Fill request struct fields. 891 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest. 892 } 893 resp, err := c.WaitOperation(ctx, req) 894 if err != nil { 895 // TODO: Handle error. 896 } 897 // TODO: Use resp. 898 _ = resp 899 }