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