cloud.google.com/go/aiplatform@v1.106.0/apiv1/featurestore_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/apiv1" 23 aiplatformpb "cloud.google.com/go/aiplatform/apiv1/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 ExampleNewFeaturestoreClient() { 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.NewFeaturestoreClient(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 ExampleFeaturestoreClient_BatchCreateFeatures() { 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.NewFeaturestoreClient(ctx) 55 if err != nil { 56 // TODO: Handle error. 57 } 58 defer c.Close() 59 60 req := &aiplatformpb.BatchCreateFeaturesRequest{ 61 // TODO: Fill request struct fields. 62 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#BatchCreateFeaturesRequest. 63 } 64 op, err := c.BatchCreateFeatures(ctx, req) 65 if err != nil { 66 // TODO: Handle error. 67 } 68 69 resp, err := op.Wait(ctx) 70 if err != nil { 71 // TODO: Handle error. 72 } 73 // TODO: Use resp. 74 _ = resp 75 } 76 77 func ExampleFeaturestoreClient_BatchReadFeatureValues() { 78 ctx := context.Background() 79 // This snippet has been automatically generated and should be regarded as a code template only. 80 // It will require modifications to work: 81 // - It may require correct/in-range values for request initialization. 82 // - It may require specifying regional endpoints when creating the service client as shown in: 83 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 84 c, err := aiplatform.NewFeaturestoreClient(ctx) 85 if err != nil { 86 // TODO: Handle error. 87 } 88 defer c.Close() 89 90 req := &aiplatformpb.BatchReadFeatureValuesRequest{ 91 // TODO: Fill request struct fields. 92 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#BatchReadFeatureValuesRequest. 93 } 94 op, err := c.BatchReadFeatureValues(ctx, req) 95 if err != nil { 96 // TODO: Handle error. 97 } 98 99 resp, err := op.Wait(ctx) 100 if err != nil { 101 // TODO: Handle error. 102 } 103 // TODO: Use resp. 104 _ = resp 105 } 106 107 func ExampleFeaturestoreClient_CreateEntityType() { 108 ctx := context.Background() 109 // This snippet has been automatically generated and should be regarded as a code template only. 110 // It will require modifications to work: 111 // - It may require correct/in-range values for request initialization. 112 // - It may require specifying regional endpoints when creating the service client as shown in: 113 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 114 c, err := aiplatform.NewFeaturestoreClient(ctx) 115 if err != nil { 116 // TODO: Handle error. 117 } 118 defer c.Close() 119 120 req := &aiplatformpb.CreateEntityTypeRequest{ 121 // TODO: Fill request struct fields. 122 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateEntityTypeRequest. 123 } 124 op, err := c.CreateEntityType(ctx, req) 125 if err != nil { 126 // TODO: Handle error. 127 } 128 129 resp, err := op.Wait(ctx) 130 if err != nil { 131 // TODO: Handle error. 132 } 133 // TODO: Use resp. 134 _ = resp 135 } 136 137 func ExampleFeaturestoreClient_CreateFeature() { 138 ctx := context.Background() 139 // This snippet has been automatically generated and should be regarded as a code template only. 140 // It will require modifications to work: 141 // - It may require correct/in-range values for request initialization. 142 // - It may require specifying regional endpoints when creating the service client as shown in: 143 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 144 c, err := aiplatform.NewFeaturestoreClient(ctx) 145 if err != nil { 146 // TODO: Handle error. 147 } 148 defer c.Close() 149 150 req := &aiplatformpb.CreateFeatureRequest{ 151 // TODO: Fill request struct fields. 152 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateFeatureRequest. 153 } 154 op, err := c.CreateFeature(ctx, req) 155 if err != nil { 156 // TODO: Handle error. 157 } 158 159 resp, err := op.Wait(ctx) 160 if err != nil { 161 // TODO: Handle error. 162 } 163 // TODO: Use resp. 164 _ = resp 165 } 166 167 func ExampleFeaturestoreClient_CreateFeaturestore() { 168 ctx := context.Background() 169 // This snippet has been automatically generated and should be regarded as a code template only. 170 // It will require modifications to work: 171 // - It may require correct/in-range values for request initialization. 172 // - It may require specifying regional endpoints when creating the service client as shown in: 173 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 174 c, err := aiplatform.NewFeaturestoreClient(ctx) 175 if err != nil { 176 // TODO: Handle error. 177 } 178 defer c.Close() 179 180 req := &aiplatformpb.CreateFeaturestoreRequest{ 181 // TODO: Fill request struct fields. 182 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateFeaturestoreRequest. 183 } 184 op, err := c.CreateFeaturestore(ctx, req) 185 if err != nil { 186 // TODO: Handle error. 187 } 188 189 resp, err := op.Wait(ctx) 190 if err != nil { 191 // TODO: Handle error. 192 } 193 // TODO: Use resp. 194 _ = resp 195 } 196 197 func ExampleFeaturestoreClient_DeleteEntityType() { 198 ctx := context.Background() 199 // This snippet has been automatically generated and should be regarded as a code template only. 200 // It will require modifications to work: 201 // - It may require correct/in-range values for request initialization. 202 // - It may require specifying regional endpoints when creating the service client as shown in: 203 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 204 c, err := aiplatform.NewFeaturestoreClient(ctx) 205 if err != nil { 206 // TODO: Handle error. 207 } 208 defer c.Close() 209 210 req := &aiplatformpb.DeleteEntityTypeRequest{ 211 // TODO: Fill request struct fields. 212 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteEntityTypeRequest. 213 } 214 op, err := c.DeleteEntityType(ctx, req) 215 if err != nil { 216 // TODO: Handle error. 217 } 218 219 err = op.Wait(ctx) 220 if err != nil { 221 // TODO: Handle error. 222 } 223 } 224 225 func ExampleFeaturestoreClient_DeleteFeature() { 226 ctx := context.Background() 227 // This snippet has been automatically generated and should be regarded as a code template only. 228 // It will require modifications to work: 229 // - It may require correct/in-range values for request initialization. 230 // - It may require specifying regional endpoints when creating the service client as shown in: 231 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 232 c, err := aiplatform.NewFeaturestoreClient(ctx) 233 if err != nil { 234 // TODO: Handle error. 235 } 236 defer c.Close() 237 238 req := &aiplatformpb.DeleteFeatureRequest{ 239 // TODO: Fill request struct fields. 240 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteFeatureRequest. 241 } 242 op, err := c.DeleteFeature(ctx, req) 243 if err != nil { 244 // TODO: Handle error. 245 } 246 247 err = op.Wait(ctx) 248 if err != nil { 249 // TODO: Handle error. 250 } 251 } 252 253 func ExampleFeaturestoreClient_DeleteFeatureValues() { 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 := aiplatform.NewFeaturestoreClient(ctx) 261 if err != nil { 262 // TODO: Handle error. 263 } 264 defer c.Close() 265 266 req := &aiplatformpb.DeleteFeatureValuesRequest{ 267 // TODO: Fill request struct fields. 268 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteFeatureValuesRequest. 269 } 270 op, err := c.DeleteFeatureValues(ctx, req) 271 if err != nil { 272 // TODO: Handle error. 273 } 274 275 resp, err := op.Wait(ctx) 276 if err != nil { 277 // TODO: Handle error. 278 } 279 // TODO: Use resp. 280 _ = resp 281 } 282 283 func ExampleFeaturestoreClient_DeleteFeaturestore() { 284 ctx := context.Background() 285 // This snippet has been automatically generated and should be regarded as a code template only. 286 // It will require modifications to work: 287 // - It may require correct/in-range values for request initialization. 288 // - It may require specifying regional endpoints when creating the service client as shown in: 289 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 290 c, err := aiplatform.NewFeaturestoreClient(ctx) 291 if err != nil { 292 // TODO: Handle error. 293 } 294 defer c.Close() 295 296 req := &aiplatformpb.DeleteFeaturestoreRequest{ 297 // TODO: Fill request struct fields. 298 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteFeaturestoreRequest. 299 } 300 op, err := c.DeleteFeaturestore(ctx, req) 301 if err != nil { 302 // TODO: Handle error. 303 } 304 305 err = op.Wait(ctx) 306 if err != nil { 307 // TODO: Handle error. 308 } 309 } 310 311 func ExampleFeaturestoreClient_ExportFeatureValues() { 312 ctx := context.Background() 313 // This snippet has been automatically generated and should be regarded as a code template only. 314 // It will require modifications to work: 315 // - It may require correct/in-range values for request initialization. 316 // - It may require specifying regional endpoints when creating the service client as shown in: 317 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 318 c, err := aiplatform.NewFeaturestoreClient(ctx) 319 if err != nil { 320 // TODO: Handle error. 321 } 322 defer c.Close() 323 324 req := &aiplatformpb.ExportFeatureValuesRequest{ 325 // TODO: Fill request struct fields. 326 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ExportFeatureValuesRequest. 327 } 328 op, err := c.ExportFeatureValues(ctx, req) 329 if err != nil { 330 // TODO: Handle error. 331 } 332 333 resp, err := op.Wait(ctx) 334 if err != nil { 335 // TODO: Handle error. 336 } 337 // TODO: Use resp. 338 _ = resp 339 } 340 341 func ExampleFeaturestoreClient_GetEntityType() { 342 ctx := context.Background() 343 // This snippet has been automatically generated and should be regarded as a code template only. 344 // It will require modifications to work: 345 // - It may require correct/in-range values for request initialization. 346 // - It may require specifying regional endpoints when creating the service client as shown in: 347 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 348 c, err := aiplatform.NewFeaturestoreClient(ctx) 349 if err != nil { 350 // TODO: Handle error. 351 } 352 defer c.Close() 353 354 req := &aiplatformpb.GetEntityTypeRequest{ 355 // TODO: Fill request struct fields. 356 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetEntityTypeRequest. 357 } 358 resp, err := c.GetEntityType(ctx, req) 359 if err != nil { 360 // TODO: Handle error. 361 } 362 // TODO: Use resp. 363 _ = resp 364 } 365 366 func ExampleFeaturestoreClient_GetFeature() { 367 ctx := context.Background() 368 // This snippet has been automatically generated and should be regarded as a code template only. 369 // It will require modifications to work: 370 // - It may require correct/in-range values for request initialization. 371 // - It may require specifying regional endpoints when creating the service client as shown in: 372 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 373 c, err := aiplatform.NewFeaturestoreClient(ctx) 374 if err != nil { 375 // TODO: Handle error. 376 } 377 defer c.Close() 378 379 req := &aiplatformpb.GetFeatureRequest{ 380 // TODO: Fill request struct fields. 381 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetFeatureRequest. 382 } 383 resp, err := c.GetFeature(ctx, req) 384 if err != nil { 385 // TODO: Handle error. 386 } 387 // TODO: Use resp. 388 _ = resp 389 } 390 391 func ExampleFeaturestoreClient_GetFeaturestore() { 392 ctx := context.Background() 393 // This snippet has been automatically generated and should be regarded as a code template only. 394 // It will require modifications to work: 395 // - It may require correct/in-range values for request initialization. 396 // - It may require specifying regional endpoints when creating the service client as shown in: 397 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 398 c, err := aiplatform.NewFeaturestoreClient(ctx) 399 if err != nil { 400 // TODO: Handle error. 401 } 402 defer c.Close() 403 404 req := &aiplatformpb.GetFeaturestoreRequest{ 405 // TODO: Fill request struct fields. 406 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetFeaturestoreRequest. 407 } 408 resp, err := c.GetFeaturestore(ctx, req) 409 if err != nil { 410 // TODO: Handle error. 411 } 412 // TODO: Use resp. 413 _ = resp 414 } 415 416 func ExampleFeaturestoreClient_ImportFeatureValues() { 417 ctx := context.Background() 418 // This snippet has been automatically generated and should be regarded as a code template only. 419 // It will require modifications to work: 420 // - It may require correct/in-range values for request initialization. 421 // - It may require specifying regional endpoints when creating the service client as shown in: 422 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 423 c, err := aiplatform.NewFeaturestoreClient(ctx) 424 if err != nil { 425 // TODO: Handle error. 426 } 427 defer c.Close() 428 429 req := &aiplatformpb.ImportFeatureValuesRequest{ 430 // TODO: Fill request struct fields. 431 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ImportFeatureValuesRequest. 432 } 433 op, err := c.ImportFeatureValues(ctx, req) 434 if err != nil { 435 // TODO: Handle error. 436 } 437 438 resp, err := op.Wait(ctx) 439 if err != nil { 440 // TODO: Handle error. 441 } 442 // TODO: Use resp. 443 _ = resp 444 } 445 446 func ExampleFeaturestoreClient_ListEntityTypes() { 447 ctx := context.Background() 448 // This snippet has been automatically generated and should be regarded as a code template only. 449 // It will require modifications to work: 450 // - It may require correct/in-range values for request initialization. 451 // - It may require specifying regional endpoints when creating the service client as shown in: 452 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 453 c, err := aiplatform.NewFeaturestoreClient(ctx) 454 if err != nil { 455 // TODO: Handle error. 456 } 457 defer c.Close() 458 459 req := &aiplatformpb.ListEntityTypesRequest{ 460 // TODO: Fill request struct fields. 461 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListEntityTypesRequest. 462 } 463 it := c.ListEntityTypes(ctx, req) 464 for { 465 resp, err := it.Next() 466 if err == iterator.Done { 467 break 468 } 469 if err != nil { 470 // TODO: Handle error. 471 } 472 // TODO: Use resp. 473 _ = resp 474 475 // If you need to access the underlying RPC response, 476 // you can do so by casting the `Response` as below. 477 // Otherwise, remove this line. Only populated after 478 // first call to Next(). Not safe for concurrent access. 479 _ = it.Response.(*aiplatformpb.ListEntityTypesResponse) 480 } 481 } 482 483 func ExampleFeaturestoreClient_ListFeatures() { 484 ctx := context.Background() 485 // This snippet has been automatically generated and should be regarded as a code template only. 486 // It will require modifications to work: 487 // - It may require correct/in-range values for request initialization. 488 // - It may require specifying regional endpoints when creating the service client as shown in: 489 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 490 c, err := aiplatform.NewFeaturestoreClient(ctx) 491 if err != nil { 492 // TODO: Handle error. 493 } 494 defer c.Close() 495 496 req := &aiplatformpb.ListFeaturesRequest{ 497 // TODO: Fill request struct fields. 498 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListFeaturesRequest. 499 } 500 it := c.ListFeatures(ctx, req) 501 for { 502 resp, err := it.Next() 503 if err == iterator.Done { 504 break 505 } 506 if err != nil { 507 // TODO: Handle error. 508 } 509 // TODO: Use resp. 510 _ = resp 511 512 // If you need to access the underlying RPC response, 513 // you can do so by casting the `Response` as below. 514 // Otherwise, remove this line. Only populated after 515 // first call to Next(). Not safe for concurrent access. 516 _ = it.Response.(*aiplatformpb.ListFeaturesResponse) 517 } 518 } 519 520 func ExampleFeaturestoreClient_ListFeaturestores() { 521 ctx := context.Background() 522 // This snippet has been automatically generated and should be regarded as a code template only. 523 // It will require modifications to work: 524 // - It may require correct/in-range values for request initialization. 525 // - It may require specifying regional endpoints when creating the service client as shown in: 526 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 527 c, err := aiplatform.NewFeaturestoreClient(ctx) 528 if err != nil { 529 // TODO: Handle error. 530 } 531 defer c.Close() 532 533 req := &aiplatformpb.ListFeaturestoresRequest{ 534 // TODO: Fill request struct fields. 535 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListFeaturestoresRequest. 536 } 537 it := c.ListFeaturestores(ctx, req) 538 for { 539 resp, err := it.Next() 540 if err == iterator.Done { 541 break 542 } 543 if err != nil { 544 // TODO: Handle error. 545 } 546 // TODO: Use resp. 547 _ = resp 548 549 // If you need to access the underlying RPC response, 550 // you can do so by casting the `Response` as below. 551 // Otherwise, remove this line. Only populated after 552 // first call to Next(). Not safe for concurrent access. 553 _ = it.Response.(*aiplatformpb.ListFeaturestoresResponse) 554 } 555 } 556 557 func ExampleFeaturestoreClient_SearchFeatures() { 558 ctx := context.Background() 559 // This snippet has been automatically generated and should be regarded as a code template only. 560 // It will require modifications to work: 561 // - It may require correct/in-range values for request initialization. 562 // - It may require specifying regional endpoints when creating the service client as shown in: 563 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 564 c, err := aiplatform.NewFeaturestoreClient(ctx) 565 if err != nil { 566 // TODO: Handle error. 567 } 568 defer c.Close() 569 570 req := &aiplatformpb.SearchFeaturesRequest{ 571 // TODO: Fill request struct fields. 572 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#SearchFeaturesRequest. 573 } 574 it := c.SearchFeatures(ctx, req) 575 for { 576 resp, err := it.Next() 577 if err == iterator.Done { 578 break 579 } 580 if err != nil { 581 // TODO: Handle error. 582 } 583 // TODO: Use resp. 584 _ = resp 585 586 // If you need to access the underlying RPC response, 587 // you can do so by casting the `Response` as below. 588 // Otherwise, remove this line. Only populated after 589 // first call to Next(). Not safe for concurrent access. 590 _ = it.Response.(*aiplatformpb.SearchFeaturesResponse) 591 } 592 } 593 594 func ExampleFeaturestoreClient_UpdateEntityType() { 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 := aiplatform.NewFeaturestoreClient(ctx) 602 if err != nil { 603 // TODO: Handle error. 604 } 605 defer c.Close() 606 607 req := &aiplatformpb.UpdateEntityTypeRequest{ 608 // TODO: Fill request struct fields. 609 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#UpdateEntityTypeRequest. 610 } 611 resp, err := c.UpdateEntityType(ctx, req) 612 if err != nil { 613 // TODO: Handle error. 614 } 615 // TODO: Use resp. 616 _ = resp 617 } 618 619 func ExampleFeaturestoreClient_UpdateFeature() { 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 := aiplatform.NewFeaturestoreClient(ctx) 627 if err != nil { 628 // TODO: Handle error. 629 } 630 defer c.Close() 631 632 req := &aiplatformpb.UpdateFeatureRequest{ 633 // TODO: Fill request struct fields. 634 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#UpdateFeatureRequest. 635 } 636 resp, err := c.UpdateFeature(ctx, req) 637 if err != nil { 638 // TODO: Handle error. 639 } 640 // TODO: Use resp. 641 _ = resp 642 } 643 644 func ExampleFeaturestoreClient_UpdateFeaturestore() { 645 ctx := context.Background() 646 // This snippet has been automatically generated and should be regarded as a code template only. 647 // It will require modifications to work: 648 // - It may require correct/in-range values for request initialization. 649 // - It may require specifying regional endpoints when creating the service client as shown in: 650 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 651 c, err := aiplatform.NewFeaturestoreClient(ctx) 652 if err != nil { 653 // TODO: Handle error. 654 } 655 defer c.Close() 656 657 req := &aiplatformpb.UpdateFeaturestoreRequest{ 658 // TODO: Fill request struct fields. 659 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#UpdateFeaturestoreRequest. 660 } 661 op, err := c.UpdateFeaturestore(ctx, req) 662 if err != nil { 663 // TODO: Handle error. 664 } 665 666 resp, err := op.Wait(ctx) 667 if err != nil { 668 // TODO: Handle error. 669 } 670 // TODO: Use resp. 671 _ = resp 672 } 673 674 func ExampleFeaturestoreClient_GetLocation() { 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 := aiplatform.NewFeaturestoreClient(ctx) 682 if err != nil { 683 // TODO: Handle error. 684 } 685 defer c.Close() 686 687 req := &locationpb.GetLocationRequest{ 688 // TODO: Fill request struct fields. 689 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest. 690 } 691 resp, err := c.GetLocation(ctx, req) 692 if err != nil { 693 // TODO: Handle error. 694 } 695 // TODO: Use resp. 696 _ = resp 697 } 698 699 func ExampleFeaturestoreClient_ListLocations() { 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 := aiplatform.NewFeaturestoreClient(ctx) 707 if err != nil { 708 // TODO: Handle error. 709 } 710 defer c.Close() 711 712 req := &locationpb.ListLocationsRequest{ 713 // TODO: Fill request struct fields. 714 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. 715 } 716 it := c.ListLocations(ctx, req) 717 for { 718 resp, err := it.Next() 719 if err == iterator.Done { 720 break 721 } 722 if err != nil { 723 // TODO: Handle error. 724 } 725 // TODO: Use resp. 726 _ = resp 727 728 // If you need to access the underlying RPC response, 729 // you can do so by casting the `Response` as below. 730 // Otherwise, remove this line. Only populated after 731 // first call to Next(). Not safe for concurrent access. 732 _ = it.Response.(*locationpb.ListLocationsResponse) 733 } 734 } 735 736 func ExampleFeaturestoreClient_GetIamPolicy() { 737 ctx := context.Background() 738 // This snippet has been automatically generated and should be regarded as a code template only. 739 // It will require modifications to work: 740 // - It may require correct/in-range values for request initialization. 741 // - It may require specifying regional endpoints when creating the service client as shown in: 742 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 743 c, err := aiplatform.NewFeaturestoreClient(ctx) 744 if err != nil { 745 // TODO: Handle error. 746 } 747 defer c.Close() 748 749 req := &iampb.GetIamPolicyRequest{ 750 // TODO: Fill request struct fields. 751 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest. 752 } 753 resp, err := c.GetIamPolicy(ctx, req) 754 if err != nil { 755 // TODO: Handle error. 756 } 757 // TODO: Use resp. 758 _ = resp 759 } 760 761 func ExampleFeaturestoreClient_SetIamPolicy() { 762 ctx := context.Background() 763 // This snippet has been automatically generated and should be regarded as a code template only. 764 // It will require modifications to work: 765 // - It may require correct/in-range values for request initialization. 766 // - It may require specifying regional endpoints when creating the service client as shown in: 767 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 768 c, err := aiplatform.NewFeaturestoreClient(ctx) 769 if err != nil { 770 // TODO: Handle error. 771 } 772 defer c.Close() 773 774 req := &iampb.SetIamPolicyRequest{ 775 // TODO: Fill request struct fields. 776 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest. 777 } 778 resp, err := c.SetIamPolicy(ctx, req) 779 if err != nil { 780 // TODO: Handle error. 781 } 782 // TODO: Use resp. 783 _ = resp 784 } 785 786 func ExampleFeaturestoreClient_TestIamPermissions() { 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 := aiplatform.NewFeaturestoreClient(ctx) 794 if err != nil { 795 // TODO: Handle error. 796 } 797 defer c.Close() 798 799 req := &iampb.TestIamPermissionsRequest{ 800 // TODO: Fill request struct fields. 801 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest. 802 } 803 resp, err := c.TestIamPermissions(ctx, req) 804 if err != nil { 805 // TODO: Handle error. 806 } 807 // TODO: Use resp. 808 _ = resp 809 } 810 811 func ExampleFeaturestoreClient_CancelOperation() { 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 := aiplatform.NewFeaturestoreClient(ctx) 819 if err != nil { 820 // TODO: Handle error. 821 } 822 defer c.Close() 823 824 req := &longrunningpb.CancelOperationRequest{ 825 // TODO: Fill request struct fields. 826 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. 827 } 828 err = c.CancelOperation(ctx, req) 829 if err != nil { 830 // TODO: Handle error. 831 } 832 } 833 834 func ExampleFeaturestoreClient_DeleteOperation() { 835 ctx := context.Background() 836 // This snippet has been automatically generated and should be regarded as a code template only. 837 // It will require modifications to work: 838 // - It may require correct/in-range values for request initialization. 839 // - It may require specifying regional endpoints when creating the service client as shown in: 840 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 841 c, err := aiplatform.NewFeaturestoreClient(ctx) 842 if err != nil { 843 // TODO: Handle error. 844 } 845 defer c.Close() 846 847 req := &longrunningpb.DeleteOperationRequest{ 848 // TODO: Fill request struct fields. 849 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest. 850 } 851 err = c.DeleteOperation(ctx, req) 852 if err != nil { 853 // TODO: Handle error. 854 } 855 } 856 857 func ExampleFeaturestoreClient_GetOperation() { 858 ctx := context.Background() 859 // This snippet has been automatically generated and should be regarded as a code template only. 860 // It will require modifications to work: 861 // - It may require correct/in-range values for request initialization. 862 // - It may require specifying regional endpoints when creating the service client as shown in: 863 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 864 c, err := aiplatform.NewFeaturestoreClient(ctx) 865 if err != nil { 866 // TODO: Handle error. 867 } 868 defer c.Close() 869 870 req := &longrunningpb.GetOperationRequest{ 871 // TODO: Fill request struct fields. 872 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. 873 } 874 resp, err := c.GetOperation(ctx, req) 875 if err != nil { 876 // TODO: Handle error. 877 } 878 // TODO: Use resp. 879 _ = resp 880 } 881 882 func ExampleFeaturestoreClient_ListOperations() { 883 ctx := context.Background() 884 // This snippet has been automatically generated and should be regarded as a code template only. 885 // It will require modifications to work: 886 // - It may require correct/in-range values for request initialization. 887 // - It may require specifying regional endpoints when creating the service client as shown in: 888 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 889 c, err := aiplatform.NewFeaturestoreClient(ctx) 890 if err != nil { 891 // TODO: Handle error. 892 } 893 defer c.Close() 894 895 req := &longrunningpb.ListOperationsRequest{ 896 // TODO: Fill request struct fields. 897 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. 898 } 899 it := c.ListOperations(ctx, req) 900 for { 901 resp, err := it.Next() 902 if err == iterator.Done { 903 break 904 } 905 if err != nil { 906 // TODO: Handle error. 907 } 908 // TODO: Use resp. 909 _ = resp 910 911 // If you need to access the underlying RPC response, 912 // you can do so by casting the `Response` as below. 913 // Otherwise, remove this line. Only populated after 914 // first call to Next(). Not safe for concurrent access. 915 _ = it.Response.(*longrunningpb.ListOperationsResponse) 916 } 917 } 918 919 func ExampleFeaturestoreClient_WaitOperation() { 920 ctx := context.Background() 921 // This snippet has been automatically generated and should be regarded as a code template only. 922 // It will require modifications to work: 923 // - It may require correct/in-range values for request initialization. 924 // - It may require specifying regional endpoints when creating the service client as shown in: 925 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 926 c, err := aiplatform.NewFeaturestoreClient(ctx) 927 if err != nil { 928 // TODO: Handle error. 929 } 930 defer c.Close() 931 932 req := &longrunningpb.WaitOperationRequest{ 933 // TODO: Fill request struct fields. 934 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest. 935 } 936 resp, err := c.WaitOperation(ctx, req) 937 if err != nil { 938 // TODO: Handle error. 939 } 940 // TODO: Use resp. 941 _ = resp 942 }