cloud.google.com/go/aiplatform@v1.106.0/apiv1beta1/metadata_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 ExampleNewMetadataClient() { 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.NewMetadataClient(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 ExampleNewMetadataRESTClient() { 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.NewMetadataRESTClient(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 ExampleMetadataClient_AddContextArtifactsAndExecutions() { 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.NewMetadataClient(ctx) 72 if err != nil { 73 // TODO: Handle error. 74 } 75 defer c.Close() 76 77 req := &aiplatformpb.AddContextArtifactsAndExecutionsRequest{ 78 // TODO: Fill request struct fields. 79 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#AddContextArtifactsAndExecutionsRequest. 80 } 81 resp, err := c.AddContextArtifactsAndExecutions(ctx, req) 82 if err != nil { 83 // TODO: Handle error. 84 } 85 // TODO: Use resp. 86 _ = resp 87 } 88 89 func ExampleMetadataClient_AddContextChildren() { 90 ctx := context.Background() 91 // This snippet has been automatically generated and should be regarded as a code template only. 92 // It will require modifications to work: 93 // - It may require correct/in-range values for request initialization. 94 // - It may require specifying regional endpoints when creating the service client as shown in: 95 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 96 c, err := aiplatform.NewMetadataClient(ctx) 97 if err != nil { 98 // TODO: Handle error. 99 } 100 defer c.Close() 101 102 req := &aiplatformpb.AddContextChildrenRequest{ 103 // TODO: Fill request struct fields. 104 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#AddContextChildrenRequest. 105 } 106 resp, err := c.AddContextChildren(ctx, req) 107 if err != nil { 108 // TODO: Handle error. 109 } 110 // TODO: Use resp. 111 _ = resp 112 } 113 114 func ExampleMetadataClient_AddExecutionEvents() { 115 ctx := context.Background() 116 // This snippet has been automatically generated and should be regarded as a code template only. 117 // It will require modifications to work: 118 // - It may require correct/in-range values for request initialization. 119 // - It may require specifying regional endpoints when creating the service client as shown in: 120 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 121 c, err := aiplatform.NewMetadataClient(ctx) 122 if err != nil { 123 // TODO: Handle error. 124 } 125 defer c.Close() 126 127 req := &aiplatformpb.AddExecutionEventsRequest{ 128 // TODO: Fill request struct fields. 129 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#AddExecutionEventsRequest. 130 } 131 resp, err := c.AddExecutionEvents(ctx, req) 132 if err != nil { 133 // TODO: Handle error. 134 } 135 // TODO: Use resp. 136 _ = resp 137 } 138 139 func ExampleMetadataClient_CreateArtifact() { 140 ctx := context.Background() 141 // This snippet has been automatically generated and should be regarded as a code template only. 142 // It will require modifications to work: 143 // - It may require correct/in-range values for request initialization. 144 // - It may require specifying regional endpoints when creating the service client as shown in: 145 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 146 c, err := aiplatform.NewMetadataClient(ctx) 147 if err != nil { 148 // TODO: Handle error. 149 } 150 defer c.Close() 151 152 req := &aiplatformpb.CreateArtifactRequest{ 153 // TODO: Fill request struct fields. 154 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateArtifactRequest. 155 } 156 resp, err := c.CreateArtifact(ctx, req) 157 if err != nil { 158 // TODO: Handle error. 159 } 160 // TODO: Use resp. 161 _ = resp 162 } 163 164 func ExampleMetadataClient_CreateContext() { 165 ctx := context.Background() 166 // This snippet has been automatically generated and should be regarded as a code template only. 167 // It will require modifications to work: 168 // - It may require correct/in-range values for request initialization. 169 // - It may require specifying regional endpoints when creating the service client as shown in: 170 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 171 c, err := aiplatform.NewMetadataClient(ctx) 172 if err != nil { 173 // TODO: Handle error. 174 } 175 defer c.Close() 176 177 req := &aiplatformpb.CreateContextRequest{ 178 // TODO: Fill request struct fields. 179 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateContextRequest. 180 } 181 resp, err := c.CreateContext(ctx, req) 182 if err != nil { 183 // TODO: Handle error. 184 } 185 // TODO: Use resp. 186 _ = resp 187 } 188 189 func ExampleMetadataClient_CreateExecution() { 190 ctx := context.Background() 191 // This snippet has been automatically generated and should be regarded as a code template only. 192 // It will require modifications to work: 193 // - It may require correct/in-range values for request initialization. 194 // - It may require specifying regional endpoints when creating the service client as shown in: 195 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 196 c, err := aiplatform.NewMetadataClient(ctx) 197 if err != nil { 198 // TODO: Handle error. 199 } 200 defer c.Close() 201 202 req := &aiplatformpb.CreateExecutionRequest{ 203 // TODO: Fill request struct fields. 204 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateExecutionRequest. 205 } 206 resp, err := c.CreateExecution(ctx, req) 207 if err != nil { 208 // TODO: Handle error. 209 } 210 // TODO: Use resp. 211 _ = resp 212 } 213 214 func ExampleMetadataClient_CreateMetadataSchema() { 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.NewMetadataClient(ctx) 222 if err != nil { 223 // TODO: Handle error. 224 } 225 defer c.Close() 226 227 req := &aiplatformpb.CreateMetadataSchemaRequest{ 228 // TODO: Fill request struct fields. 229 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateMetadataSchemaRequest. 230 } 231 resp, err := c.CreateMetadataSchema(ctx, req) 232 if err != nil { 233 // TODO: Handle error. 234 } 235 // TODO: Use resp. 236 _ = resp 237 } 238 239 func ExampleMetadataClient_CreateMetadataStore() { 240 ctx := context.Background() 241 // This snippet has been automatically generated and should be regarded as a code template only. 242 // It will require modifications to work: 243 // - It may require correct/in-range values for request initialization. 244 // - It may require specifying regional endpoints when creating the service client as shown in: 245 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 246 c, err := aiplatform.NewMetadataClient(ctx) 247 if err != nil { 248 // TODO: Handle error. 249 } 250 defer c.Close() 251 252 req := &aiplatformpb.CreateMetadataStoreRequest{ 253 // TODO: Fill request struct fields. 254 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateMetadataStoreRequest. 255 } 256 op, err := c.CreateMetadataStore(ctx, req) 257 if err != nil { 258 // TODO: Handle error. 259 } 260 261 resp, err := op.Wait(ctx) 262 if err != nil { 263 // TODO: Handle error. 264 } 265 // TODO: Use resp. 266 _ = resp 267 } 268 269 func ExampleMetadataClient_DeleteArtifact() { 270 ctx := context.Background() 271 // This snippet has been automatically generated and should be regarded as a code template only. 272 // It will require modifications to work: 273 // - It may require correct/in-range values for request initialization. 274 // - It may require specifying regional endpoints when creating the service client as shown in: 275 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 276 c, err := aiplatform.NewMetadataClient(ctx) 277 if err != nil { 278 // TODO: Handle error. 279 } 280 defer c.Close() 281 282 req := &aiplatformpb.DeleteArtifactRequest{ 283 // TODO: Fill request struct fields. 284 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#DeleteArtifactRequest. 285 } 286 op, err := c.DeleteArtifact(ctx, req) 287 if err != nil { 288 // TODO: Handle error. 289 } 290 291 err = op.Wait(ctx) 292 if err != nil { 293 // TODO: Handle error. 294 } 295 } 296 297 func ExampleMetadataClient_DeleteContext() { 298 ctx := context.Background() 299 // This snippet has been automatically generated and should be regarded as a code template only. 300 // It will require modifications to work: 301 // - It may require correct/in-range values for request initialization. 302 // - It may require specifying regional endpoints when creating the service client as shown in: 303 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 304 c, err := aiplatform.NewMetadataClient(ctx) 305 if err != nil { 306 // TODO: Handle error. 307 } 308 defer c.Close() 309 310 req := &aiplatformpb.DeleteContextRequest{ 311 // TODO: Fill request struct fields. 312 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#DeleteContextRequest. 313 } 314 op, err := c.DeleteContext(ctx, req) 315 if err != nil { 316 // TODO: Handle error. 317 } 318 319 err = op.Wait(ctx) 320 if err != nil { 321 // TODO: Handle error. 322 } 323 } 324 325 func ExampleMetadataClient_DeleteExecution() { 326 ctx := context.Background() 327 // This snippet has been automatically generated and should be regarded as a code template only. 328 // It will require modifications to work: 329 // - It may require correct/in-range values for request initialization. 330 // - It may require specifying regional endpoints when creating the service client as shown in: 331 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 332 c, err := aiplatform.NewMetadataClient(ctx) 333 if err != nil { 334 // TODO: Handle error. 335 } 336 defer c.Close() 337 338 req := &aiplatformpb.DeleteExecutionRequest{ 339 // TODO: Fill request struct fields. 340 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#DeleteExecutionRequest. 341 } 342 op, err := c.DeleteExecution(ctx, req) 343 if err != nil { 344 // TODO: Handle error. 345 } 346 347 err = op.Wait(ctx) 348 if err != nil { 349 // TODO: Handle error. 350 } 351 } 352 353 func ExampleMetadataClient_DeleteMetadataStore() { 354 ctx := context.Background() 355 // This snippet has been automatically generated and should be regarded as a code template only. 356 // It will require modifications to work: 357 // - It may require correct/in-range values for request initialization. 358 // - It may require specifying regional endpoints when creating the service client as shown in: 359 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 360 c, err := aiplatform.NewMetadataClient(ctx) 361 if err != nil { 362 // TODO: Handle error. 363 } 364 defer c.Close() 365 366 req := &aiplatformpb.DeleteMetadataStoreRequest{ 367 // TODO: Fill request struct fields. 368 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#DeleteMetadataStoreRequest. 369 } 370 op, err := c.DeleteMetadataStore(ctx, req) 371 if err != nil { 372 // TODO: Handle error. 373 } 374 375 err = op.Wait(ctx) 376 if err != nil { 377 // TODO: Handle error. 378 } 379 } 380 381 func ExampleMetadataClient_GetArtifact() { 382 ctx := context.Background() 383 // This snippet has been automatically generated and should be regarded as a code template only. 384 // It will require modifications to work: 385 // - It may require correct/in-range values for request initialization. 386 // - It may require specifying regional endpoints when creating the service client as shown in: 387 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 388 c, err := aiplatform.NewMetadataClient(ctx) 389 if err != nil { 390 // TODO: Handle error. 391 } 392 defer c.Close() 393 394 req := &aiplatformpb.GetArtifactRequest{ 395 // TODO: Fill request struct fields. 396 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetArtifactRequest. 397 } 398 resp, err := c.GetArtifact(ctx, req) 399 if err != nil { 400 // TODO: Handle error. 401 } 402 // TODO: Use resp. 403 _ = resp 404 } 405 406 func ExampleMetadataClient_GetContext() { 407 ctx := context.Background() 408 // This snippet has been automatically generated and should be regarded as a code template only. 409 // It will require modifications to work: 410 // - It may require correct/in-range values for request initialization. 411 // - It may require specifying regional endpoints when creating the service client as shown in: 412 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 413 c, err := aiplatform.NewMetadataClient(ctx) 414 if err != nil { 415 // TODO: Handle error. 416 } 417 defer c.Close() 418 419 req := &aiplatformpb.GetContextRequest{ 420 // TODO: Fill request struct fields. 421 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetContextRequest. 422 } 423 resp, err := c.GetContext(ctx, req) 424 if err != nil { 425 // TODO: Handle error. 426 } 427 // TODO: Use resp. 428 _ = resp 429 } 430 431 func ExampleMetadataClient_GetExecution() { 432 ctx := context.Background() 433 // This snippet has been automatically generated and should be regarded as a code template only. 434 // It will require modifications to work: 435 // - It may require correct/in-range values for request initialization. 436 // - It may require specifying regional endpoints when creating the service client as shown in: 437 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 438 c, err := aiplatform.NewMetadataClient(ctx) 439 if err != nil { 440 // TODO: Handle error. 441 } 442 defer c.Close() 443 444 req := &aiplatformpb.GetExecutionRequest{ 445 // TODO: Fill request struct fields. 446 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetExecutionRequest. 447 } 448 resp, err := c.GetExecution(ctx, req) 449 if err != nil { 450 // TODO: Handle error. 451 } 452 // TODO: Use resp. 453 _ = resp 454 } 455 456 func ExampleMetadataClient_GetMetadataSchema() { 457 ctx := context.Background() 458 // This snippet has been automatically generated and should be regarded as a code template only. 459 // It will require modifications to work: 460 // - It may require correct/in-range values for request initialization. 461 // - It may require specifying regional endpoints when creating the service client as shown in: 462 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 463 c, err := aiplatform.NewMetadataClient(ctx) 464 if err != nil { 465 // TODO: Handle error. 466 } 467 defer c.Close() 468 469 req := &aiplatformpb.GetMetadataSchemaRequest{ 470 // TODO: Fill request struct fields. 471 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetMetadataSchemaRequest. 472 } 473 resp, err := c.GetMetadataSchema(ctx, req) 474 if err != nil { 475 // TODO: Handle error. 476 } 477 // TODO: Use resp. 478 _ = resp 479 } 480 481 func ExampleMetadataClient_GetMetadataStore() { 482 ctx := context.Background() 483 // This snippet has been automatically generated and should be regarded as a code template only. 484 // It will require modifications to work: 485 // - It may require correct/in-range values for request initialization. 486 // - It may require specifying regional endpoints when creating the service client as shown in: 487 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 488 c, err := aiplatform.NewMetadataClient(ctx) 489 if err != nil { 490 // TODO: Handle error. 491 } 492 defer c.Close() 493 494 req := &aiplatformpb.GetMetadataStoreRequest{ 495 // TODO: Fill request struct fields. 496 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetMetadataStoreRequest. 497 } 498 resp, err := c.GetMetadataStore(ctx, req) 499 if err != nil { 500 // TODO: Handle error. 501 } 502 // TODO: Use resp. 503 _ = resp 504 } 505 506 func ExampleMetadataClient_ListArtifacts() { 507 ctx := context.Background() 508 // This snippet has been automatically generated and should be regarded as a code template only. 509 // It will require modifications to work: 510 // - It may require correct/in-range values for request initialization. 511 // - It may require specifying regional endpoints when creating the service client as shown in: 512 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 513 c, err := aiplatform.NewMetadataClient(ctx) 514 if err != nil { 515 // TODO: Handle error. 516 } 517 defer c.Close() 518 519 req := &aiplatformpb.ListArtifactsRequest{ 520 // TODO: Fill request struct fields. 521 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListArtifactsRequest. 522 } 523 it := c.ListArtifacts(ctx, req) 524 for { 525 resp, err := it.Next() 526 if err == iterator.Done { 527 break 528 } 529 if err != nil { 530 // TODO: Handle error. 531 } 532 // TODO: Use resp. 533 _ = resp 534 535 // If you need to access the underlying RPC response, 536 // you can do so by casting the `Response` as below. 537 // Otherwise, remove this line. Only populated after 538 // first call to Next(). Not safe for concurrent access. 539 _ = it.Response.(*aiplatformpb.ListArtifactsResponse) 540 } 541 } 542 543 func ExampleMetadataClient_ListContexts() { 544 ctx := context.Background() 545 // This snippet has been automatically generated and should be regarded as a code template only. 546 // It will require modifications to work: 547 // - It may require correct/in-range values for request initialization. 548 // - It may require specifying regional endpoints when creating the service client as shown in: 549 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 550 c, err := aiplatform.NewMetadataClient(ctx) 551 if err != nil { 552 // TODO: Handle error. 553 } 554 defer c.Close() 555 556 req := &aiplatformpb.ListContextsRequest{ 557 // TODO: Fill request struct fields. 558 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListContextsRequest. 559 } 560 it := c.ListContexts(ctx, req) 561 for { 562 resp, err := it.Next() 563 if err == iterator.Done { 564 break 565 } 566 if err != nil { 567 // TODO: Handle error. 568 } 569 // TODO: Use resp. 570 _ = resp 571 572 // If you need to access the underlying RPC response, 573 // you can do so by casting the `Response` as below. 574 // Otherwise, remove this line. Only populated after 575 // first call to Next(). Not safe for concurrent access. 576 _ = it.Response.(*aiplatformpb.ListContextsResponse) 577 } 578 } 579 580 func ExampleMetadataClient_ListExecutions() { 581 ctx := context.Background() 582 // This snippet has been automatically generated and should be regarded as a code template only. 583 // It will require modifications to work: 584 // - It may require correct/in-range values for request initialization. 585 // - It may require specifying regional endpoints when creating the service client as shown in: 586 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 587 c, err := aiplatform.NewMetadataClient(ctx) 588 if err != nil { 589 // TODO: Handle error. 590 } 591 defer c.Close() 592 593 req := &aiplatformpb.ListExecutionsRequest{ 594 // TODO: Fill request struct fields. 595 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListExecutionsRequest. 596 } 597 it := c.ListExecutions(ctx, req) 598 for { 599 resp, err := it.Next() 600 if err == iterator.Done { 601 break 602 } 603 if err != nil { 604 // TODO: Handle error. 605 } 606 // TODO: Use resp. 607 _ = resp 608 609 // If you need to access the underlying RPC response, 610 // you can do so by casting the `Response` as below. 611 // Otherwise, remove this line. Only populated after 612 // first call to Next(). Not safe for concurrent access. 613 _ = it.Response.(*aiplatformpb.ListExecutionsResponse) 614 } 615 } 616 617 func ExampleMetadataClient_ListMetadataSchemas() { 618 ctx := context.Background() 619 // This snippet has been automatically generated and should be regarded as a code template only. 620 // It will require modifications to work: 621 // - It may require correct/in-range values for request initialization. 622 // - It may require specifying regional endpoints when creating the service client as shown in: 623 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 624 c, err := aiplatform.NewMetadataClient(ctx) 625 if err != nil { 626 // TODO: Handle error. 627 } 628 defer c.Close() 629 630 req := &aiplatformpb.ListMetadataSchemasRequest{ 631 // TODO: Fill request struct fields. 632 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListMetadataSchemasRequest. 633 } 634 it := c.ListMetadataSchemas(ctx, req) 635 for { 636 resp, err := it.Next() 637 if err == iterator.Done { 638 break 639 } 640 if err != nil { 641 // TODO: Handle error. 642 } 643 // TODO: Use resp. 644 _ = resp 645 646 // If you need to access the underlying RPC response, 647 // you can do so by casting the `Response` as below. 648 // Otherwise, remove this line. Only populated after 649 // first call to Next(). Not safe for concurrent access. 650 _ = it.Response.(*aiplatformpb.ListMetadataSchemasResponse) 651 } 652 } 653 654 func ExampleMetadataClient_ListMetadataStores() { 655 ctx := context.Background() 656 // This snippet has been automatically generated and should be regarded as a code template only. 657 // It will require modifications to work: 658 // - It may require correct/in-range values for request initialization. 659 // - It may require specifying regional endpoints when creating the service client as shown in: 660 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 661 c, err := aiplatform.NewMetadataClient(ctx) 662 if err != nil { 663 // TODO: Handle error. 664 } 665 defer c.Close() 666 667 req := &aiplatformpb.ListMetadataStoresRequest{ 668 // TODO: Fill request struct fields. 669 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListMetadataStoresRequest. 670 } 671 it := c.ListMetadataStores(ctx, req) 672 for { 673 resp, err := it.Next() 674 if err == iterator.Done { 675 break 676 } 677 if err != nil { 678 // TODO: Handle error. 679 } 680 // TODO: Use resp. 681 _ = resp 682 683 // If you need to access the underlying RPC response, 684 // you can do so by casting the `Response` as below. 685 // Otherwise, remove this line. Only populated after 686 // first call to Next(). Not safe for concurrent access. 687 _ = it.Response.(*aiplatformpb.ListMetadataStoresResponse) 688 } 689 } 690 691 func ExampleMetadataClient_PurgeArtifacts() { 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.NewMetadataClient(ctx) 699 if err != nil { 700 // TODO: Handle error. 701 } 702 defer c.Close() 703 704 req := &aiplatformpb.PurgeArtifactsRequest{ 705 // TODO: Fill request struct fields. 706 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#PurgeArtifactsRequest. 707 } 708 op, err := c.PurgeArtifacts(ctx, req) 709 if err != nil { 710 // TODO: Handle error. 711 } 712 713 resp, err := op.Wait(ctx) 714 if err != nil { 715 // TODO: Handle error. 716 } 717 // TODO: Use resp. 718 _ = resp 719 } 720 721 func ExampleMetadataClient_PurgeContexts() { 722 ctx := context.Background() 723 // This snippet has been automatically generated and should be regarded as a code template only. 724 // It will require modifications to work: 725 // - It may require correct/in-range values for request initialization. 726 // - It may require specifying regional endpoints when creating the service client as shown in: 727 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 728 c, err := aiplatform.NewMetadataClient(ctx) 729 if err != nil { 730 // TODO: Handle error. 731 } 732 defer c.Close() 733 734 req := &aiplatformpb.PurgeContextsRequest{ 735 // TODO: Fill request struct fields. 736 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#PurgeContextsRequest. 737 } 738 op, err := c.PurgeContexts(ctx, req) 739 if err != nil { 740 // TODO: Handle error. 741 } 742 743 resp, err := op.Wait(ctx) 744 if err != nil { 745 // TODO: Handle error. 746 } 747 // TODO: Use resp. 748 _ = resp 749 } 750 751 func ExampleMetadataClient_PurgeExecutions() { 752 ctx := context.Background() 753 // This snippet has been automatically generated and should be regarded as a code template only. 754 // It will require modifications to work: 755 // - It may require correct/in-range values for request initialization. 756 // - It may require specifying regional endpoints when creating the service client as shown in: 757 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 758 c, err := aiplatform.NewMetadataClient(ctx) 759 if err != nil { 760 // TODO: Handle error. 761 } 762 defer c.Close() 763 764 req := &aiplatformpb.PurgeExecutionsRequest{ 765 // TODO: Fill request struct fields. 766 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#PurgeExecutionsRequest. 767 } 768 op, err := c.PurgeExecutions(ctx, req) 769 if err != nil { 770 // TODO: Handle error. 771 } 772 773 resp, err := op.Wait(ctx) 774 if err != nil { 775 // TODO: Handle error. 776 } 777 // TODO: Use resp. 778 _ = resp 779 } 780 781 func ExampleMetadataClient_QueryArtifactLineageSubgraph() { 782 ctx := context.Background() 783 // This snippet has been automatically generated and should be regarded as a code template only. 784 // It will require modifications to work: 785 // - It may require correct/in-range values for request initialization. 786 // - It may require specifying regional endpoints when creating the service client as shown in: 787 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 788 c, err := aiplatform.NewMetadataClient(ctx) 789 if err != nil { 790 // TODO: Handle error. 791 } 792 defer c.Close() 793 794 req := &aiplatformpb.QueryArtifactLineageSubgraphRequest{ 795 // TODO: Fill request struct fields. 796 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#QueryArtifactLineageSubgraphRequest. 797 } 798 resp, err := c.QueryArtifactLineageSubgraph(ctx, req) 799 if err != nil { 800 // TODO: Handle error. 801 } 802 // TODO: Use resp. 803 _ = resp 804 } 805 806 func ExampleMetadataClient_QueryContextLineageSubgraph() { 807 ctx := context.Background() 808 // This snippet has been automatically generated and should be regarded as a code template only. 809 // It will require modifications to work: 810 // - It may require correct/in-range values for request initialization. 811 // - It may require specifying regional endpoints when creating the service client as shown in: 812 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 813 c, err := aiplatform.NewMetadataClient(ctx) 814 if err != nil { 815 // TODO: Handle error. 816 } 817 defer c.Close() 818 819 req := &aiplatformpb.QueryContextLineageSubgraphRequest{ 820 // TODO: Fill request struct fields. 821 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#QueryContextLineageSubgraphRequest. 822 } 823 resp, err := c.QueryContextLineageSubgraph(ctx, req) 824 if err != nil { 825 // TODO: Handle error. 826 } 827 // TODO: Use resp. 828 _ = resp 829 } 830 831 func ExampleMetadataClient_QueryExecutionInputsAndOutputs() { 832 ctx := context.Background() 833 // This snippet has been automatically generated and should be regarded as a code template only. 834 // It will require modifications to work: 835 // - It may require correct/in-range values for request initialization. 836 // - It may require specifying regional endpoints when creating the service client as shown in: 837 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 838 c, err := aiplatform.NewMetadataClient(ctx) 839 if err != nil { 840 // TODO: Handle error. 841 } 842 defer c.Close() 843 844 req := &aiplatformpb.QueryExecutionInputsAndOutputsRequest{ 845 // TODO: Fill request struct fields. 846 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#QueryExecutionInputsAndOutputsRequest. 847 } 848 resp, err := c.QueryExecutionInputsAndOutputs(ctx, req) 849 if err != nil { 850 // TODO: Handle error. 851 } 852 // TODO: Use resp. 853 _ = resp 854 } 855 856 func ExampleMetadataClient_RemoveContextChildren() { 857 ctx := context.Background() 858 // This snippet has been automatically generated and should be regarded as a code template only. 859 // It will require modifications to work: 860 // - It may require correct/in-range values for request initialization. 861 // - It may require specifying regional endpoints when creating the service client as shown in: 862 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 863 c, err := aiplatform.NewMetadataClient(ctx) 864 if err != nil { 865 // TODO: Handle error. 866 } 867 defer c.Close() 868 869 req := &aiplatformpb.RemoveContextChildrenRequest{ 870 // TODO: Fill request struct fields. 871 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#RemoveContextChildrenRequest. 872 } 873 resp, err := c.RemoveContextChildren(ctx, req) 874 if err != nil { 875 // TODO: Handle error. 876 } 877 // TODO: Use resp. 878 _ = resp 879 } 880 881 func ExampleMetadataClient_UpdateArtifact() { 882 ctx := context.Background() 883 // This snippet has been automatically generated and should be regarded as a code template only. 884 // It will require modifications to work: 885 // - It may require correct/in-range values for request initialization. 886 // - It may require specifying regional endpoints when creating the service client as shown in: 887 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 888 c, err := aiplatform.NewMetadataClient(ctx) 889 if err != nil { 890 // TODO: Handle error. 891 } 892 defer c.Close() 893 894 req := &aiplatformpb.UpdateArtifactRequest{ 895 // TODO: Fill request struct fields. 896 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#UpdateArtifactRequest. 897 } 898 resp, err := c.UpdateArtifact(ctx, req) 899 if err != nil { 900 // TODO: Handle error. 901 } 902 // TODO: Use resp. 903 _ = resp 904 } 905 906 func ExampleMetadataClient_UpdateContext() { 907 ctx := context.Background() 908 // This snippet has been automatically generated and should be regarded as a code template only. 909 // It will require modifications to work: 910 // - It may require correct/in-range values for request initialization. 911 // - It may require specifying regional endpoints when creating the service client as shown in: 912 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 913 c, err := aiplatform.NewMetadataClient(ctx) 914 if err != nil { 915 // TODO: Handle error. 916 } 917 defer c.Close() 918 919 req := &aiplatformpb.UpdateContextRequest{ 920 // TODO: Fill request struct fields. 921 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#UpdateContextRequest. 922 } 923 resp, err := c.UpdateContext(ctx, req) 924 if err != nil { 925 // TODO: Handle error. 926 } 927 // TODO: Use resp. 928 _ = resp 929 } 930 931 func ExampleMetadataClient_UpdateExecution() { 932 ctx := context.Background() 933 // This snippet has been automatically generated and should be regarded as a code template only. 934 // It will require modifications to work: 935 // - It may require correct/in-range values for request initialization. 936 // - It may require specifying regional endpoints when creating the service client as shown in: 937 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 938 c, err := aiplatform.NewMetadataClient(ctx) 939 if err != nil { 940 // TODO: Handle error. 941 } 942 defer c.Close() 943 944 req := &aiplatformpb.UpdateExecutionRequest{ 945 // TODO: Fill request struct fields. 946 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#UpdateExecutionRequest. 947 } 948 resp, err := c.UpdateExecution(ctx, req) 949 if err != nil { 950 // TODO: Handle error. 951 } 952 // TODO: Use resp. 953 _ = resp 954 } 955 956 func ExampleMetadataClient_GetLocation() { 957 ctx := context.Background() 958 // This snippet has been automatically generated and should be regarded as a code template only. 959 // It will require modifications to work: 960 // - It may require correct/in-range values for request initialization. 961 // - It may require specifying regional endpoints when creating the service client as shown in: 962 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 963 c, err := aiplatform.NewMetadataClient(ctx) 964 if err != nil { 965 // TODO: Handle error. 966 } 967 defer c.Close() 968 969 req := &locationpb.GetLocationRequest{ 970 // TODO: Fill request struct fields. 971 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest. 972 } 973 resp, err := c.GetLocation(ctx, req) 974 if err != nil { 975 // TODO: Handle error. 976 } 977 // TODO: Use resp. 978 _ = resp 979 } 980 981 func ExampleMetadataClient_ListLocations() { 982 ctx := context.Background() 983 // This snippet has been automatically generated and should be regarded as a code template only. 984 // It will require modifications to work: 985 // - It may require correct/in-range values for request initialization. 986 // - It may require specifying regional endpoints when creating the service client as shown in: 987 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 988 c, err := aiplatform.NewMetadataClient(ctx) 989 if err != nil { 990 // TODO: Handle error. 991 } 992 defer c.Close() 993 994 req := &locationpb.ListLocationsRequest{ 995 // TODO: Fill request struct fields. 996 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. 997 } 998 it := c.ListLocations(ctx, req) 999 for { 1000 resp, err := it.Next() 1001 if err == iterator.Done { 1002 break 1003 } 1004 if err != nil { 1005 // TODO: Handle error. 1006 } 1007 // TODO: Use resp. 1008 _ = resp 1009 1010 // If you need to access the underlying RPC response, 1011 // you can do so by casting the `Response` as below. 1012 // Otherwise, remove this line. Only populated after 1013 // first call to Next(). Not safe for concurrent access. 1014 _ = it.Response.(*locationpb.ListLocationsResponse) 1015 } 1016 } 1017 1018 func ExampleMetadataClient_GetIamPolicy() { 1019 ctx := context.Background() 1020 // This snippet has been automatically generated and should be regarded as a code template only. 1021 // It will require modifications to work: 1022 // - It may require correct/in-range values for request initialization. 1023 // - It may require specifying regional endpoints when creating the service client as shown in: 1024 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1025 c, err := aiplatform.NewMetadataClient(ctx) 1026 if err != nil { 1027 // TODO: Handle error. 1028 } 1029 defer c.Close() 1030 1031 req := &iampb.GetIamPolicyRequest{ 1032 // TODO: Fill request struct fields. 1033 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest. 1034 } 1035 resp, err := c.GetIamPolicy(ctx, req) 1036 if err != nil { 1037 // TODO: Handle error. 1038 } 1039 // TODO: Use resp. 1040 _ = resp 1041 } 1042 1043 func ExampleMetadataClient_SetIamPolicy() { 1044 ctx := context.Background() 1045 // This snippet has been automatically generated and should be regarded as a code template only. 1046 // It will require modifications to work: 1047 // - It may require correct/in-range values for request initialization. 1048 // - It may require specifying regional endpoints when creating the service client as shown in: 1049 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1050 c, err := aiplatform.NewMetadataClient(ctx) 1051 if err != nil { 1052 // TODO: Handle error. 1053 } 1054 defer c.Close() 1055 1056 req := &iampb.SetIamPolicyRequest{ 1057 // TODO: Fill request struct fields. 1058 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest. 1059 } 1060 resp, err := c.SetIamPolicy(ctx, req) 1061 if err != nil { 1062 // TODO: Handle error. 1063 } 1064 // TODO: Use resp. 1065 _ = resp 1066 } 1067 1068 func ExampleMetadataClient_TestIamPermissions() { 1069 ctx := context.Background() 1070 // This snippet has been automatically generated and should be regarded as a code template only. 1071 // It will require modifications to work: 1072 // - It may require correct/in-range values for request initialization. 1073 // - It may require specifying regional endpoints when creating the service client as shown in: 1074 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1075 c, err := aiplatform.NewMetadataClient(ctx) 1076 if err != nil { 1077 // TODO: Handle error. 1078 } 1079 defer c.Close() 1080 1081 req := &iampb.TestIamPermissionsRequest{ 1082 // TODO: Fill request struct fields. 1083 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest. 1084 } 1085 resp, err := c.TestIamPermissions(ctx, req) 1086 if err != nil { 1087 // TODO: Handle error. 1088 } 1089 // TODO: Use resp. 1090 _ = resp 1091 } 1092 1093 func ExampleMetadataClient_CancelOperation() { 1094 ctx := context.Background() 1095 // This snippet has been automatically generated and should be regarded as a code template only. 1096 // It will require modifications to work: 1097 // - It may require correct/in-range values for request initialization. 1098 // - It may require specifying regional endpoints when creating the service client as shown in: 1099 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1100 c, err := aiplatform.NewMetadataClient(ctx) 1101 if err != nil { 1102 // TODO: Handle error. 1103 } 1104 defer c.Close() 1105 1106 req := &longrunningpb.CancelOperationRequest{ 1107 // TODO: Fill request struct fields. 1108 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. 1109 } 1110 err = c.CancelOperation(ctx, req) 1111 if err != nil { 1112 // TODO: Handle error. 1113 } 1114 } 1115 1116 func ExampleMetadataClient_DeleteOperation() { 1117 ctx := context.Background() 1118 // This snippet has been automatically generated and should be regarded as a code template only. 1119 // It will require modifications to work: 1120 // - It may require correct/in-range values for request initialization. 1121 // - It may require specifying regional endpoints when creating the service client as shown in: 1122 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1123 c, err := aiplatform.NewMetadataClient(ctx) 1124 if err != nil { 1125 // TODO: Handle error. 1126 } 1127 defer c.Close() 1128 1129 req := &longrunningpb.DeleteOperationRequest{ 1130 // TODO: Fill request struct fields. 1131 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest. 1132 } 1133 err = c.DeleteOperation(ctx, req) 1134 if err != nil { 1135 // TODO: Handle error. 1136 } 1137 } 1138 1139 func ExampleMetadataClient_GetOperation() { 1140 ctx := context.Background() 1141 // This snippet has been automatically generated and should be regarded as a code template only. 1142 // It will require modifications to work: 1143 // - It may require correct/in-range values for request initialization. 1144 // - It may require specifying regional endpoints when creating the service client as shown in: 1145 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1146 c, err := aiplatform.NewMetadataClient(ctx) 1147 if err != nil { 1148 // TODO: Handle error. 1149 } 1150 defer c.Close() 1151 1152 req := &longrunningpb.GetOperationRequest{ 1153 // TODO: Fill request struct fields. 1154 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. 1155 } 1156 resp, err := c.GetOperation(ctx, req) 1157 if err != nil { 1158 // TODO: Handle error. 1159 } 1160 // TODO: Use resp. 1161 _ = resp 1162 } 1163 1164 func ExampleMetadataClient_ListOperations() { 1165 ctx := context.Background() 1166 // This snippet has been automatically generated and should be regarded as a code template only. 1167 // It will require modifications to work: 1168 // - It may require correct/in-range values for request initialization. 1169 // - It may require specifying regional endpoints when creating the service client as shown in: 1170 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1171 c, err := aiplatform.NewMetadataClient(ctx) 1172 if err != nil { 1173 // TODO: Handle error. 1174 } 1175 defer c.Close() 1176 1177 req := &longrunningpb.ListOperationsRequest{ 1178 // TODO: Fill request struct fields. 1179 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. 1180 } 1181 it := c.ListOperations(ctx, req) 1182 for { 1183 resp, err := it.Next() 1184 if err == iterator.Done { 1185 break 1186 } 1187 if err != nil { 1188 // TODO: Handle error. 1189 } 1190 // TODO: Use resp. 1191 _ = resp 1192 1193 // If you need to access the underlying RPC response, 1194 // you can do so by casting the `Response` as below. 1195 // Otherwise, remove this line. Only populated after 1196 // first call to Next(). Not safe for concurrent access. 1197 _ = it.Response.(*longrunningpb.ListOperationsResponse) 1198 } 1199 } 1200 1201 func ExampleMetadataClient_WaitOperation() { 1202 ctx := context.Background() 1203 // This snippet has been automatically generated and should be regarded as a code template only. 1204 // It will require modifications to work: 1205 // - It may require correct/in-range values for request initialization. 1206 // - It may require specifying regional endpoints when creating the service client as shown in: 1207 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1208 c, err := aiplatform.NewMetadataClient(ctx) 1209 if err != nil { 1210 // TODO: Handle error. 1211 } 1212 defer c.Close() 1213 1214 req := &longrunningpb.WaitOperationRequest{ 1215 // TODO: Fill request struct fields. 1216 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest. 1217 } 1218 resp, err := c.WaitOperation(ctx, req) 1219 if err != nil { 1220 // TODO: Handle error. 1221 } 1222 // TODO: Use resp. 1223 _ = resp 1224 }