cloud.google.com/go/aiplatform@v1.106.0/apiv1/job_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 ExampleNewJobClient() { 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.NewJobClient(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 ExampleJobClient_CancelBatchPredictionJob() { 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.NewJobClient(ctx) 55 if err != nil { 56 // TODO: Handle error. 57 } 58 defer c.Close() 59 60 req := &aiplatformpb.CancelBatchPredictionJobRequest{ 61 // TODO: Fill request struct fields. 62 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CancelBatchPredictionJobRequest. 63 } 64 err = c.CancelBatchPredictionJob(ctx, req) 65 if err != nil { 66 // TODO: Handle error. 67 } 68 } 69 70 func ExampleJobClient_CancelCustomJob() { 71 ctx := context.Background() 72 // This snippet has been automatically generated and should be regarded as a code template only. 73 // It will require modifications to work: 74 // - It may require correct/in-range values for request initialization. 75 // - It may require specifying regional endpoints when creating the service client as shown in: 76 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 77 c, err := aiplatform.NewJobClient(ctx) 78 if err != nil { 79 // TODO: Handle error. 80 } 81 defer c.Close() 82 83 req := &aiplatformpb.CancelCustomJobRequest{ 84 // TODO: Fill request struct fields. 85 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CancelCustomJobRequest. 86 } 87 err = c.CancelCustomJob(ctx, req) 88 if err != nil { 89 // TODO: Handle error. 90 } 91 } 92 93 func ExampleJobClient_CancelDataLabelingJob() { 94 ctx := context.Background() 95 // This snippet has been automatically generated and should be regarded as a code template only. 96 // It will require modifications to work: 97 // - It may require correct/in-range values for request initialization. 98 // - It may require specifying regional endpoints when creating the service client as shown in: 99 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 100 c, err := aiplatform.NewJobClient(ctx) 101 if err != nil { 102 // TODO: Handle error. 103 } 104 defer c.Close() 105 106 req := &aiplatformpb.CancelDataLabelingJobRequest{ 107 // TODO: Fill request struct fields. 108 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CancelDataLabelingJobRequest. 109 } 110 err = c.CancelDataLabelingJob(ctx, req) 111 if err != nil { 112 // TODO: Handle error. 113 } 114 } 115 116 func ExampleJobClient_CancelHyperparameterTuningJob() { 117 ctx := context.Background() 118 // This snippet has been automatically generated and should be regarded as a code template only. 119 // It will require modifications to work: 120 // - It may require correct/in-range values for request initialization. 121 // - It may require specifying regional endpoints when creating the service client as shown in: 122 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 123 c, err := aiplatform.NewJobClient(ctx) 124 if err != nil { 125 // TODO: Handle error. 126 } 127 defer c.Close() 128 129 req := &aiplatformpb.CancelHyperparameterTuningJobRequest{ 130 // TODO: Fill request struct fields. 131 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CancelHyperparameterTuningJobRequest. 132 } 133 err = c.CancelHyperparameterTuningJob(ctx, req) 134 if err != nil { 135 // TODO: Handle error. 136 } 137 } 138 139 func ExampleJobClient_CancelNasJob() { 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.NewJobClient(ctx) 147 if err != nil { 148 // TODO: Handle error. 149 } 150 defer c.Close() 151 152 req := &aiplatformpb.CancelNasJobRequest{ 153 // TODO: Fill request struct fields. 154 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CancelNasJobRequest. 155 } 156 err = c.CancelNasJob(ctx, req) 157 if err != nil { 158 // TODO: Handle error. 159 } 160 } 161 162 func ExampleJobClient_CreateBatchPredictionJob() { 163 ctx := context.Background() 164 // This snippet has been automatically generated and should be regarded as a code template only. 165 // It will require modifications to work: 166 // - It may require correct/in-range values for request initialization. 167 // - It may require specifying regional endpoints when creating the service client as shown in: 168 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 169 c, err := aiplatform.NewJobClient(ctx) 170 if err != nil { 171 // TODO: Handle error. 172 } 173 defer c.Close() 174 175 req := &aiplatformpb.CreateBatchPredictionJobRequest{ 176 // TODO: Fill request struct fields. 177 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateBatchPredictionJobRequest. 178 } 179 resp, err := c.CreateBatchPredictionJob(ctx, req) 180 if err != nil { 181 // TODO: Handle error. 182 } 183 // TODO: Use resp. 184 _ = resp 185 } 186 187 func ExampleJobClient_CreateCustomJob() { 188 ctx := context.Background() 189 // This snippet has been automatically generated and should be regarded as a code template only. 190 // It will require modifications to work: 191 // - It may require correct/in-range values for request initialization. 192 // - It may require specifying regional endpoints when creating the service client as shown in: 193 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 194 c, err := aiplatform.NewJobClient(ctx) 195 if err != nil { 196 // TODO: Handle error. 197 } 198 defer c.Close() 199 200 req := &aiplatformpb.CreateCustomJobRequest{ 201 // TODO: Fill request struct fields. 202 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateCustomJobRequest. 203 } 204 resp, err := c.CreateCustomJob(ctx, req) 205 if err != nil { 206 // TODO: Handle error. 207 } 208 // TODO: Use resp. 209 _ = resp 210 } 211 212 func ExampleJobClient_CreateDataLabelingJob() { 213 ctx := context.Background() 214 // This snippet has been automatically generated and should be regarded as a code template only. 215 // It will require modifications to work: 216 // - It may require correct/in-range values for request initialization. 217 // - It may require specifying regional endpoints when creating the service client as shown in: 218 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 219 c, err := aiplatform.NewJobClient(ctx) 220 if err != nil { 221 // TODO: Handle error. 222 } 223 defer c.Close() 224 225 req := &aiplatformpb.CreateDataLabelingJobRequest{ 226 // TODO: Fill request struct fields. 227 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateDataLabelingJobRequest. 228 } 229 resp, err := c.CreateDataLabelingJob(ctx, req) 230 if err != nil { 231 // TODO: Handle error. 232 } 233 // TODO: Use resp. 234 _ = resp 235 } 236 237 func ExampleJobClient_CreateHyperparameterTuningJob() { 238 ctx := context.Background() 239 // This snippet has been automatically generated and should be regarded as a code template only. 240 // It will require modifications to work: 241 // - It may require correct/in-range values for request initialization. 242 // - It may require specifying regional endpoints when creating the service client as shown in: 243 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 244 c, err := aiplatform.NewJobClient(ctx) 245 if err != nil { 246 // TODO: Handle error. 247 } 248 defer c.Close() 249 250 req := &aiplatformpb.CreateHyperparameterTuningJobRequest{ 251 // TODO: Fill request struct fields. 252 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateHyperparameterTuningJobRequest. 253 } 254 resp, err := c.CreateHyperparameterTuningJob(ctx, req) 255 if err != nil { 256 // TODO: Handle error. 257 } 258 // TODO: Use resp. 259 _ = resp 260 } 261 262 func ExampleJobClient_CreateModelDeploymentMonitoringJob() { 263 ctx := context.Background() 264 // This snippet has been automatically generated and should be regarded as a code template only. 265 // It will require modifications to work: 266 // - It may require correct/in-range values for request initialization. 267 // - It may require specifying regional endpoints when creating the service client as shown in: 268 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 269 c, err := aiplatform.NewJobClient(ctx) 270 if err != nil { 271 // TODO: Handle error. 272 } 273 defer c.Close() 274 275 req := &aiplatformpb.CreateModelDeploymentMonitoringJobRequest{ 276 // TODO: Fill request struct fields. 277 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateModelDeploymentMonitoringJobRequest. 278 } 279 resp, err := c.CreateModelDeploymentMonitoringJob(ctx, req) 280 if err != nil { 281 // TODO: Handle error. 282 } 283 // TODO: Use resp. 284 _ = resp 285 } 286 287 func ExampleJobClient_CreateNasJob() { 288 ctx := context.Background() 289 // This snippet has been automatically generated and should be regarded as a code template only. 290 // It will require modifications to work: 291 // - It may require correct/in-range values for request initialization. 292 // - It may require specifying regional endpoints when creating the service client as shown in: 293 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 294 c, err := aiplatform.NewJobClient(ctx) 295 if err != nil { 296 // TODO: Handle error. 297 } 298 defer c.Close() 299 300 req := &aiplatformpb.CreateNasJobRequest{ 301 // TODO: Fill request struct fields. 302 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateNasJobRequest. 303 } 304 resp, err := c.CreateNasJob(ctx, req) 305 if err != nil { 306 // TODO: Handle error. 307 } 308 // TODO: Use resp. 309 _ = resp 310 } 311 312 func ExampleJobClient_DeleteBatchPredictionJob() { 313 ctx := context.Background() 314 // This snippet has been automatically generated and should be regarded as a code template only. 315 // It will require modifications to work: 316 // - It may require correct/in-range values for request initialization. 317 // - It may require specifying regional endpoints when creating the service client as shown in: 318 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 319 c, err := aiplatform.NewJobClient(ctx) 320 if err != nil { 321 // TODO: Handle error. 322 } 323 defer c.Close() 324 325 req := &aiplatformpb.DeleteBatchPredictionJobRequest{ 326 // TODO: Fill request struct fields. 327 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteBatchPredictionJobRequest. 328 } 329 op, err := c.DeleteBatchPredictionJob(ctx, req) 330 if err != nil { 331 // TODO: Handle error. 332 } 333 334 err = op.Wait(ctx) 335 if err != nil { 336 // TODO: Handle error. 337 } 338 } 339 340 func ExampleJobClient_DeleteCustomJob() { 341 ctx := context.Background() 342 // This snippet has been automatically generated and should be regarded as a code template only. 343 // It will require modifications to work: 344 // - It may require correct/in-range values for request initialization. 345 // - It may require specifying regional endpoints when creating the service client as shown in: 346 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 347 c, err := aiplatform.NewJobClient(ctx) 348 if err != nil { 349 // TODO: Handle error. 350 } 351 defer c.Close() 352 353 req := &aiplatformpb.DeleteCustomJobRequest{ 354 // TODO: Fill request struct fields. 355 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteCustomJobRequest. 356 } 357 op, err := c.DeleteCustomJob(ctx, req) 358 if err != nil { 359 // TODO: Handle error. 360 } 361 362 err = op.Wait(ctx) 363 if err != nil { 364 // TODO: Handle error. 365 } 366 } 367 368 func ExampleJobClient_DeleteDataLabelingJob() { 369 ctx := context.Background() 370 // This snippet has been automatically generated and should be regarded as a code template only. 371 // It will require modifications to work: 372 // - It may require correct/in-range values for request initialization. 373 // - It may require specifying regional endpoints when creating the service client as shown in: 374 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 375 c, err := aiplatform.NewJobClient(ctx) 376 if err != nil { 377 // TODO: Handle error. 378 } 379 defer c.Close() 380 381 req := &aiplatformpb.DeleteDataLabelingJobRequest{ 382 // TODO: Fill request struct fields. 383 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteDataLabelingJobRequest. 384 } 385 op, err := c.DeleteDataLabelingJob(ctx, req) 386 if err != nil { 387 // TODO: Handle error. 388 } 389 390 err = op.Wait(ctx) 391 if err != nil { 392 // TODO: Handle error. 393 } 394 } 395 396 func ExampleJobClient_DeleteHyperparameterTuningJob() { 397 ctx := context.Background() 398 // This snippet has been automatically generated and should be regarded as a code template only. 399 // It will require modifications to work: 400 // - It may require correct/in-range values for request initialization. 401 // - It may require specifying regional endpoints when creating the service client as shown in: 402 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 403 c, err := aiplatform.NewJobClient(ctx) 404 if err != nil { 405 // TODO: Handle error. 406 } 407 defer c.Close() 408 409 req := &aiplatformpb.DeleteHyperparameterTuningJobRequest{ 410 // TODO: Fill request struct fields. 411 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteHyperparameterTuningJobRequest. 412 } 413 op, err := c.DeleteHyperparameterTuningJob(ctx, req) 414 if err != nil { 415 // TODO: Handle error. 416 } 417 418 err = op.Wait(ctx) 419 if err != nil { 420 // TODO: Handle error. 421 } 422 } 423 424 func ExampleJobClient_DeleteModelDeploymentMonitoringJob() { 425 ctx := context.Background() 426 // This snippet has been automatically generated and should be regarded as a code template only. 427 // It will require modifications to work: 428 // - It may require correct/in-range values for request initialization. 429 // - It may require specifying regional endpoints when creating the service client as shown in: 430 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 431 c, err := aiplatform.NewJobClient(ctx) 432 if err != nil { 433 // TODO: Handle error. 434 } 435 defer c.Close() 436 437 req := &aiplatformpb.DeleteModelDeploymentMonitoringJobRequest{ 438 // TODO: Fill request struct fields. 439 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteModelDeploymentMonitoringJobRequest. 440 } 441 op, err := c.DeleteModelDeploymentMonitoringJob(ctx, req) 442 if err != nil { 443 // TODO: Handle error. 444 } 445 446 err = op.Wait(ctx) 447 if err != nil { 448 // TODO: Handle error. 449 } 450 } 451 452 func ExampleJobClient_DeleteNasJob() { 453 ctx := context.Background() 454 // This snippet has been automatically generated and should be regarded as a code template only. 455 // It will require modifications to work: 456 // - It may require correct/in-range values for request initialization. 457 // - It may require specifying regional endpoints when creating the service client as shown in: 458 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 459 c, err := aiplatform.NewJobClient(ctx) 460 if err != nil { 461 // TODO: Handle error. 462 } 463 defer c.Close() 464 465 req := &aiplatformpb.DeleteNasJobRequest{ 466 // TODO: Fill request struct fields. 467 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteNasJobRequest. 468 } 469 op, err := c.DeleteNasJob(ctx, req) 470 if err != nil { 471 // TODO: Handle error. 472 } 473 474 err = op.Wait(ctx) 475 if err != nil { 476 // TODO: Handle error. 477 } 478 } 479 480 func ExampleJobClient_GetBatchPredictionJob() { 481 ctx := context.Background() 482 // This snippet has been automatically generated and should be regarded as a code template only. 483 // It will require modifications to work: 484 // - It may require correct/in-range values for request initialization. 485 // - It may require specifying regional endpoints when creating the service client as shown in: 486 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 487 c, err := aiplatform.NewJobClient(ctx) 488 if err != nil { 489 // TODO: Handle error. 490 } 491 defer c.Close() 492 493 req := &aiplatformpb.GetBatchPredictionJobRequest{ 494 // TODO: Fill request struct fields. 495 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetBatchPredictionJobRequest. 496 } 497 resp, err := c.GetBatchPredictionJob(ctx, req) 498 if err != nil { 499 // TODO: Handle error. 500 } 501 // TODO: Use resp. 502 _ = resp 503 } 504 505 func ExampleJobClient_GetCustomJob() { 506 ctx := context.Background() 507 // This snippet has been automatically generated and should be regarded as a code template only. 508 // It will require modifications to work: 509 // - It may require correct/in-range values for request initialization. 510 // - It may require specifying regional endpoints when creating the service client as shown in: 511 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 512 c, err := aiplatform.NewJobClient(ctx) 513 if err != nil { 514 // TODO: Handle error. 515 } 516 defer c.Close() 517 518 req := &aiplatformpb.GetCustomJobRequest{ 519 // TODO: Fill request struct fields. 520 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetCustomJobRequest. 521 } 522 resp, err := c.GetCustomJob(ctx, req) 523 if err != nil { 524 // TODO: Handle error. 525 } 526 // TODO: Use resp. 527 _ = resp 528 } 529 530 func ExampleJobClient_GetDataLabelingJob() { 531 ctx := context.Background() 532 // This snippet has been automatically generated and should be regarded as a code template only. 533 // It will require modifications to work: 534 // - It may require correct/in-range values for request initialization. 535 // - It may require specifying regional endpoints when creating the service client as shown in: 536 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 537 c, err := aiplatform.NewJobClient(ctx) 538 if err != nil { 539 // TODO: Handle error. 540 } 541 defer c.Close() 542 543 req := &aiplatformpb.GetDataLabelingJobRequest{ 544 // TODO: Fill request struct fields. 545 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetDataLabelingJobRequest. 546 } 547 resp, err := c.GetDataLabelingJob(ctx, req) 548 if err != nil { 549 // TODO: Handle error. 550 } 551 // TODO: Use resp. 552 _ = resp 553 } 554 555 func ExampleJobClient_GetHyperparameterTuningJob() { 556 ctx := context.Background() 557 // This snippet has been automatically generated and should be regarded as a code template only. 558 // It will require modifications to work: 559 // - It may require correct/in-range values for request initialization. 560 // - It may require specifying regional endpoints when creating the service client as shown in: 561 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 562 c, err := aiplatform.NewJobClient(ctx) 563 if err != nil { 564 // TODO: Handle error. 565 } 566 defer c.Close() 567 568 req := &aiplatformpb.GetHyperparameterTuningJobRequest{ 569 // TODO: Fill request struct fields. 570 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetHyperparameterTuningJobRequest. 571 } 572 resp, err := c.GetHyperparameterTuningJob(ctx, req) 573 if err != nil { 574 // TODO: Handle error. 575 } 576 // TODO: Use resp. 577 _ = resp 578 } 579 580 func ExampleJobClient_GetModelDeploymentMonitoringJob() { 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.NewJobClient(ctx) 588 if err != nil { 589 // TODO: Handle error. 590 } 591 defer c.Close() 592 593 req := &aiplatformpb.GetModelDeploymentMonitoringJobRequest{ 594 // TODO: Fill request struct fields. 595 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetModelDeploymentMonitoringJobRequest. 596 } 597 resp, err := c.GetModelDeploymentMonitoringJob(ctx, req) 598 if err != nil { 599 // TODO: Handle error. 600 } 601 // TODO: Use resp. 602 _ = resp 603 } 604 605 func ExampleJobClient_GetNasJob() { 606 ctx := context.Background() 607 // This snippet has been automatically generated and should be regarded as a code template only. 608 // It will require modifications to work: 609 // - It may require correct/in-range values for request initialization. 610 // - It may require specifying regional endpoints when creating the service client as shown in: 611 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 612 c, err := aiplatform.NewJobClient(ctx) 613 if err != nil { 614 // TODO: Handle error. 615 } 616 defer c.Close() 617 618 req := &aiplatformpb.GetNasJobRequest{ 619 // TODO: Fill request struct fields. 620 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetNasJobRequest. 621 } 622 resp, err := c.GetNasJob(ctx, req) 623 if err != nil { 624 // TODO: Handle error. 625 } 626 // TODO: Use resp. 627 _ = resp 628 } 629 630 func ExampleJobClient_GetNasTrialDetail() { 631 ctx := context.Background() 632 // This snippet has been automatically generated and should be regarded as a code template only. 633 // It will require modifications to work: 634 // - It may require correct/in-range values for request initialization. 635 // - It may require specifying regional endpoints when creating the service client as shown in: 636 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 637 c, err := aiplatform.NewJobClient(ctx) 638 if err != nil { 639 // TODO: Handle error. 640 } 641 defer c.Close() 642 643 req := &aiplatformpb.GetNasTrialDetailRequest{ 644 // TODO: Fill request struct fields. 645 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetNasTrialDetailRequest. 646 } 647 resp, err := c.GetNasTrialDetail(ctx, req) 648 if err != nil { 649 // TODO: Handle error. 650 } 651 // TODO: Use resp. 652 _ = resp 653 } 654 655 func ExampleJobClient_ListBatchPredictionJobs() { 656 ctx := context.Background() 657 // This snippet has been automatically generated and should be regarded as a code template only. 658 // It will require modifications to work: 659 // - It may require correct/in-range values for request initialization. 660 // - It may require specifying regional endpoints when creating the service client as shown in: 661 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 662 c, err := aiplatform.NewJobClient(ctx) 663 if err != nil { 664 // TODO: Handle error. 665 } 666 defer c.Close() 667 668 req := &aiplatformpb.ListBatchPredictionJobsRequest{ 669 // TODO: Fill request struct fields. 670 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListBatchPredictionJobsRequest. 671 } 672 it := c.ListBatchPredictionJobs(ctx, req) 673 for { 674 resp, err := it.Next() 675 if err == iterator.Done { 676 break 677 } 678 if err != nil { 679 // TODO: Handle error. 680 } 681 // TODO: Use resp. 682 _ = resp 683 684 // If you need to access the underlying RPC response, 685 // you can do so by casting the `Response` as below. 686 // Otherwise, remove this line. Only populated after 687 // first call to Next(). Not safe for concurrent access. 688 _ = it.Response.(*aiplatformpb.ListBatchPredictionJobsResponse) 689 } 690 } 691 692 func ExampleJobClient_ListCustomJobs() { 693 ctx := context.Background() 694 // This snippet has been automatically generated and should be regarded as a code template only. 695 // It will require modifications to work: 696 // - It may require correct/in-range values for request initialization. 697 // - It may require specifying regional endpoints when creating the service client as shown in: 698 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 699 c, err := aiplatform.NewJobClient(ctx) 700 if err != nil { 701 // TODO: Handle error. 702 } 703 defer c.Close() 704 705 req := &aiplatformpb.ListCustomJobsRequest{ 706 // TODO: Fill request struct fields. 707 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListCustomJobsRequest. 708 } 709 it := c.ListCustomJobs(ctx, req) 710 for { 711 resp, err := it.Next() 712 if err == iterator.Done { 713 break 714 } 715 if err != nil { 716 // TODO: Handle error. 717 } 718 // TODO: Use resp. 719 _ = resp 720 721 // If you need to access the underlying RPC response, 722 // you can do so by casting the `Response` as below. 723 // Otherwise, remove this line. Only populated after 724 // first call to Next(). Not safe for concurrent access. 725 _ = it.Response.(*aiplatformpb.ListCustomJobsResponse) 726 } 727 } 728 729 func ExampleJobClient_ListDataLabelingJobs() { 730 ctx := context.Background() 731 // This snippet has been automatically generated and should be regarded as a code template only. 732 // It will require modifications to work: 733 // - It may require correct/in-range values for request initialization. 734 // - It may require specifying regional endpoints when creating the service client as shown in: 735 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 736 c, err := aiplatform.NewJobClient(ctx) 737 if err != nil { 738 // TODO: Handle error. 739 } 740 defer c.Close() 741 742 req := &aiplatformpb.ListDataLabelingJobsRequest{ 743 // TODO: Fill request struct fields. 744 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListDataLabelingJobsRequest. 745 } 746 it := c.ListDataLabelingJobs(ctx, req) 747 for { 748 resp, err := it.Next() 749 if err == iterator.Done { 750 break 751 } 752 if err != nil { 753 // TODO: Handle error. 754 } 755 // TODO: Use resp. 756 _ = resp 757 758 // If you need to access the underlying RPC response, 759 // you can do so by casting the `Response` as below. 760 // Otherwise, remove this line. Only populated after 761 // first call to Next(). Not safe for concurrent access. 762 _ = it.Response.(*aiplatformpb.ListDataLabelingJobsResponse) 763 } 764 } 765 766 func ExampleJobClient_ListHyperparameterTuningJobs() { 767 ctx := context.Background() 768 // This snippet has been automatically generated and should be regarded as a code template only. 769 // It will require modifications to work: 770 // - It may require correct/in-range values for request initialization. 771 // - It may require specifying regional endpoints when creating the service client as shown in: 772 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 773 c, err := aiplatform.NewJobClient(ctx) 774 if err != nil { 775 // TODO: Handle error. 776 } 777 defer c.Close() 778 779 req := &aiplatformpb.ListHyperparameterTuningJobsRequest{ 780 // TODO: Fill request struct fields. 781 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListHyperparameterTuningJobsRequest. 782 } 783 it := c.ListHyperparameterTuningJobs(ctx, req) 784 for { 785 resp, err := it.Next() 786 if err == iterator.Done { 787 break 788 } 789 if err != nil { 790 // TODO: Handle error. 791 } 792 // TODO: Use resp. 793 _ = resp 794 795 // If you need to access the underlying RPC response, 796 // you can do so by casting the `Response` as below. 797 // Otherwise, remove this line. Only populated after 798 // first call to Next(). Not safe for concurrent access. 799 _ = it.Response.(*aiplatformpb.ListHyperparameterTuningJobsResponse) 800 } 801 } 802 803 func ExampleJobClient_ListModelDeploymentMonitoringJobs() { 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.NewJobClient(ctx) 811 if err != nil { 812 // TODO: Handle error. 813 } 814 defer c.Close() 815 816 req := &aiplatformpb.ListModelDeploymentMonitoringJobsRequest{ 817 // TODO: Fill request struct fields. 818 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListModelDeploymentMonitoringJobsRequest. 819 } 820 it := c.ListModelDeploymentMonitoringJobs(ctx, req) 821 for { 822 resp, err := it.Next() 823 if err == iterator.Done { 824 break 825 } 826 if err != nil { 827 // TODO: Handle error. 828 } 829 // TODO: Use resp. 830 _ = resp 831 832 // If you need to access the underlying RPC response, 833 // you can do so by casting the `Response` as below. 834 // Otherwise, remove this line. Only populated after 835 // first call to Next(). Not safe for concurrent access. 836 _ = it.Response.(*aiplatformpb.ListModelDeploymentMonitoringJobsResponse) 837 } 838 } 839 840 func ExampleJobClient_ListNasJobs() { 841 ctx := context.Background() 842 // This snippet has been automatically generated and should be regarded as a code template only. 843 // It will require modifications to work: 844 // - It may require correct/in-range values for request initialization. 845 // - It may require specifying regional endpoints when creating the service client as shown in: 846 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 847 c, err := aiplatform.NewJobClient(ctx) 848 if err != nil { 849 // TODO: Handle error. 850 } 851 defer c.Close() 852 853 req := &aiplatformpb.ListNasJobsRequest{ 854 // TODO: Fill request struct fields. 855 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListNasJobsRequest. 856 } 857 it := c.ListNasJobs(ctx, req) 858 for { 859 resp, err := it.Next() 860 if err == iterator.Done { 861 break 862 } 863 if err != nil { 864 // TODO: Handle error. 865 } 866 // TODO: Use resp. 867 _ = resp 868 869 // If you need to access the underlying RPC response, 870 // you can do so by casting the `Response` as below. 871 // Otherwise, remove this line. Only populated after 872 // first call to Next(). Not safe for concurrent access. 873 _ = it.Response.(*aiplatformpb.ListNasJobsResponse) 874 } 875 } 876 877 func ExampleJobClient_ListNasTrialDetails() { 878 ctx := context.Background() 879 // This snippet has been automatically generated and should be regarded as a code template only. 880 // It will require modifications to work: 881 // - It may require correct/in-range values for request initialization. 882 // - It may require specifying regional endpoints when creating the service client as shown in: 883 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 884 c, err := aiplatform.NewJobClient(ctx) 885 if err != nil { 886 // TODO: Handle error. 887 } 888 defer c.Close() 889 890 req := &aiplatformpb.ListNasTrialDetailsRequest{ 891 // TODO: Fill request struct fields. 892 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListNasTrialDetailsRequest. 893 } 894 it := c.ListNasTrialDetails(ctx, req) 895 for { 896 resp, err := it.Next() 897 if err == iterator.Done { 898 break 899 } 900 if err != nil { 901 // TODO: Handle error. 902 } 903 // TODO: Use resp. 904 _ = resp 905 906 // If you need to access the underlying RPC response, 907 // you can do so by casting the `Response` as below. 908 // Otherwise, remove this line. Only populated after 909 // first call to Next(). Not safe for concurrent access. 910 _ = it.Response.(*aiplatformpb.ListNasTrialDetailsResponse) 911 } 912 } 913 914 func ExampleJobClient_PauseModelDeploymentMonitoringJob() { 915 ctx := context.Background() 916 // This snippet has been automatically generated and should be regarded as a code template only. 917 // It will require modifications to work: 918 // - It may require correct/in-range values for request initialization. 919 // - It may require specifying regional endpoints when creating the service client as shown in: 920 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 921 c, err := aiplatform.NewJobClient(ctx) 922 if err != nil { 923 // TODO: Handle error. 924 } 925 defer c.Close() 926 927 req := &aiplatformpb.PauseModelDeploymentMonitoringJobRequest{ 928 // TODO: Fill request struct fields. 929 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#PauseModelDeploymentMonitoringJobRequest. 930 } 931 err = c.PauseModelDeploymentMonitoringJob(ctx, req) 932 if err != nil { 933 // TODO: Handle error. 934 } 935 } 936 937 func ExampleJobClient_ResumeModelDeploymentMonitoringJob() { 938 ctx := context.Background() 939 // This snippet has been automatically generated and should be regarded as a code template only. 940 // It will require modifications to work: 941 // - It may require correct/in-range values for request initialization. 942 // - It may require specifying regional endpoints when creating the service client as shown in: 943 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 944 c, err := aiplatform.NewJobClient(ctx) 945 if err != nil { 946 // TODO: Handle error. 947 } 948 defer c.Close() 949 950 req := &aiplatformpb.ResumeModelDeploymentMonitoringJobRequest{ 951 // TODO: Fill request struct fields. 952 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ResumeModelDeploymentMonitoringJobRequest. 953 } 954 err = c.ResumeModelDeploymentMonitoringJob(ctx, req) 955 if err != nil { 956 // TODO: Handle error. 957 } 958 } 959 960 func ExampleJobClient_SearchModelDeploymentMonitoringStatsAnomalies() { 961 ctx := context.Background() 962 // This snippet has been automatically generated and should be regarded as a code template only. 963 // It will require modifications to work: 964 // - It may require correct/in-range values for request initialization. 965 // - It may require specifying regional endpoints when creating the service client as shown in: 966 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 967 c, err := aiplatform.NewJobClient(ctx) 968 if err != nil { 969 // TODO: Handle error. 970 } 971 defer c.Close() 972 973 req := &aiplatformpb.SearchModelDeploymentMonitoringStatsAnomaliesRequest{ 974 // TODO: Fill request struct fields. 975 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#SearchModelDeploymentMonitoringStatsAnomaliesRequest. 976 } 977 it := c.SearchModelDeploymentMonitoringStatsAnomalies(ctx, req) 978 for { 979 resp, err := it.Next() 980 if err == iterator.Done { 981 break 982 } 983 if err != nil { 984 // TODO: Handle error. 985 } 986 // TODO: Use resp. 987 _ = resp 988 989 // If you need to access the underlying RPC response, 990 // you can do so by casting the `Response` as below. 991 // Otherwise, remove this line. Only populated after 992 // first call to Next(). Not safe for concurrent access. 993 _ = it.Response.(*aiplatformpb.SearchModelDeploymentMonitoringStatsAnomaliesResponse) 994 } 995 } 996 997 func ExampleJobClient_UpdateModelDeploymentMonitoringJob() { 998 ctx := context.Background() 999 // This snippet has been automatically generated and should be regarded as a code template only. 1000 // It will require modifications to work: 1001 // - It may require correct/in-range values for request initialization. 1002 // - It may require specifying regional endpoints when creating the service client as shown in: 1003 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1004 c, err := aiplatform.NewJobClient(ctx) 1005 if err != nil { 1006 // TODO: Handle error. 1007 } 1008 defer c.Close() 1009 1010 req := &aiplatformpb.UpdateModelDeploymentMonitoringJobRequest{ 1011 // TODO: Fill request struct fields. 1012 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#UpdateModelDeploymentMonitoringJobRequest. 1013 } 1014 op, err := c.UpdateModelDeploymentMonitoringJob(ctx, req) 1015 if err != nil { 1016 // TODO: Handle error. 1017 } 1018 1019 resp, err := op.Wait(ctx) 1020 if err != nil { 1021 // TODO: Handle error. 1022 } 1023 // TODO: Use resp. 1024 _ = resp 1025 } 1026 1027 func ExampleJobClient_GetLocation() { 1028 ctx := context.Background() 1029 // This snippet has been automatically generated and should be regarded as a code template only. 1030 // It will require modifications to work: 1031 // - It may require correct/in-range values for request initialization. 1032 // - It may require specifying regional endpoints when creating the service client as shown in: 1033 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1034 c, err := aiplatform.NewJobClient(ctx) 1035 if err != nil { 1036 // TODO: Handle error. 1037 } 1038 defer c.Close() 1039 1040 req := &locationpb.GetLocationRequest{ 1041 // TODO: Fill request struct fields. 1042 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest. 1043 } 1044 resp, err := c.GetLocation(ctx, req) 1045 if err != nil { 1046 // TODO: Handle error. 1047 } 1048 // TODO: Use resp. 1049 _ = resp 1050 } 1051 1052 func ExampleJobClient_ListLocations() { 1053 ctx := context.Background() 1054 // This snippet has been automatically generated and should be regarded as a code template only. 1055 // It will require modifications to work: 1056 // - It may require correct/in-range values for request initialization. 1057 // - It may require specifying regional endpoints when creating the service client as shown in: 1058 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1059 c, err := aiplatform.NewJobClient(ctx) 1060 if err != nil { 1061 // TODO: Handle error. 1062 } 1063 defer c.Close() 1064 1065 req := &locationpb.ListLocationsRequest{ 1066 // TODO: Fill request struct fields. 1067 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. 1068 } 1069 it := c.ListLocations(ctx, req) 1070 for { 1071 resp, err := it.Next() 1072 if err == iterator.Done { 1073 break 1074 } 1075 if err != nil { 1076 // TODO: Handle error. 1077 } 1078 // TODO: Use resp. 1079 _ = resp 1080 1081 // If you need to access the underlying RPC response, 1082 // you can do so by casting the `Response` as below. 1083 // Otherwise, remove this line. Only populated after 1084 // first call to Next(). Not safe for concurrent access. 1085 _ = it.Response.(*locationpb.ListLocationsResponse) 1086 } 1087 } 1088 1089 func ExampleJobClient_GetIamPolicy() { 1090 ctx := context.Background() 1091 // This snippet has been automatically generated and should be regarded as a code template only. 1092 // It will require modifications to work: 1093 // - It may require correct/in-range values for request initialization. 1094 // - It may require specifying regional endpoints when creating the service client as shown in: 1095 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1096 c, err := aiplatform.NewJobClient(ctx) 1097 if err != nil { 1098 // TODO: Handle error. 1099 } 1100 defer c.Close() 1101 1102 req := &iampb.GetIamPolicyRequest{ 1103 // TODO: Fill request struct fields. 1104 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest. 1105 } 1106 resp, err := c.GetIamPolicy(ctx, req) 1107 if err != nil { 1108 // TODO: Handle error. 1109 } 1110 // TODO: Use resp. 1111 _ = resp 1112 } 1113 1114 func ExampleJobClient_SetIamPolicy() { 1115 ctx := context.Background() 1116 // This snippet has been automatically generated and should be regarded as a code template only. 1117 // It will require modifications to work: 1118 // - It may require correct/in-range values for request initialization. 1119 // - It may require specifying regional endpoints when creating the service client as shown in: 1120 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1121 c, err := aiplatform.NewJobClient(ctx) 1122 if err != nil { 1123 // TODO: Handle error. 1124 } 1125 defer c.Close() 1126 1127 req := &iampb.SetIamPolicyRequest{ 1128 // TODO: Fill request struct fields. 1129 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest. 1130 } 1131 resp, err := c.SetIamPolicy(ctx, req) 1132 if err != nil { 1133 // TODO: Handle error. 1134 } 1135 // TODO: Use resp. 1136 _ = resp 1137 } 1138 1139 func ExampleJobClient_TestIamPermissions() { 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.NewJobClient(ctx) 1147 if err != nil { 1148 // TODO: Handle error. 1149 } 1150 defer c.Close() 1151 1152 req := &iampb.TestIamPermissionsRequest{ 1153 // TODO: Fill request struct fields. 1154 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest. 1155 } 1156 resp, err := c.TestIamPermissions(ctx, req) 1157 if err != nil { 1158 // TODO: Handle error. 1159 } 1160 // TODO: Use resp. 1161 _ = resp 1162 } 1163 1164 func ExampleJobClient_CancelOperation() { 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.NewJobClient(ctx) 1172 if err != nil { 1173 // TODO: Handle error. 1174 } 1175 defer c.Close() 1176 1177 req := &longrunningpb.CancelOperationRequest{ 1178 // TODO: Fill request struct fields. 1179 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. 1180 } 1181 err = c.CancelOperation(ctx, req) 1182 if err != nil { 1183 // TODO: Handle error. 1184 } 1185 } 1186 1187 func ExampleJobClient_DeleteOperation() { 1188 ctx := context.Background() 1189 // This snippet has been automatically generated and should be regarded as a code template only. 1190 // It will require modifications to work: 1191 // - It may require correct/in-range values for request initialization. 1192 // - It may require specifying regional endpoints when creating the service client as shown in: 1193 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1194 c, err := aiplatform.NewJobClient(ctx) 1195 if err != nil { 1196 // TODO: Handle error. 1197 } 1198 defer c.Close() 1199 1200 req := &longrunningpb.DeleteOperationRequest{ 1201 // TODO: Fill request struct fields. 1202 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest. 1203 } 1204 err = c.DeleteOperation(ctx, req) 1205 if err != nil { 1206 // TODO: Handle error. 1207 } 1208 } 1209 1210 func ExampleJobClient_GetOperation() { 1211 ctx := context.Background() 1212 // This snippet has been automatically generated and should be regarded as a code template only. 1213 // It will require modifications to work: 1214 // - It may require correct/in-range values for request initialization. 1215 // - It may require specifying regional endpoints when creating the service client as shown in: 1216 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1217 c, err := aiplatform.NewJobClient(ctx) 1218 if err != nil { 1219 // TODO: Handle error. 1220 } 1221 defer c.Close() 1222 1223 req := &longrunningpb.GetOperationRequest{ 1224 // TODO: Fill request struct fields. 1225 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. 1226 } 1227 resp, err := c.GetOperation(ctx, req) 1228 if err != nil { 1229 // TODO: Handle error. 1230 } 1231 // TODO: Use resp. 1232 _ = resp 1233 } 1234 1235 func ExampleJobClient_ListOperations() { 1236 ctx := context.Background() 1237 // This snippet has been automatically generated and should be regarded as a code template only. 1238 // It will require modifications to work: 1239 // - It may require correct/in-range values for request initialization. 1240 // - It may require specifying regional endpoints when creating the service client as shown in: 1241 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1242 c, err := aiplatform.NewJobClient(ctx) 1243 if err != nil { 1244 // TODO: Handle error. 1245 } 1246 defer c.Close() 1247 1248 req := &longrunningpb.ListOperationsRequest{ 1249 // TODO: Fill request struct fields. 1250 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. 1251 } 1252 it := c.ListOperations(ctx, req) 1253 for { 1254 resp, err := it.Next() 1255 if err == iterator.Done { 1256 break 1257 } 1258 if err != nil { 1259 // TODO: Handle error. 1260 } 1261 // TODO: Use resp. 1262 _ = resp 1263 1264 // If you need to access the underlying RPC response, 1265 // you can do so by casting the `Response` as below. 1266 // Otherwise, remove this line. Only populated after 1267 // first call to Next(). Not safe for concurrent access. 1268 _ = it.Response.(*longrunningpb.ListOperationsResponse) 1269 } 1270 } 1271 1272 func ExampleJobClient_WaitOperation() { 1273 ctx := context.Background() 1274 // This snippet has been automatically generated and should be regarded as a code template only. 1275 // It will require modifications to work: 1276 // - It may require correct/in-range values for request initialization. 1277 // - It may require specifying regional endpoints when creating the service client as shown in: 1278 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1279 c, err := aiplatform.NewJobClient(ctx) 1280 if err != nil { 1281 // TODO: Handle error. 1282 } 1283 defer c.Close() 1284 1285 req := &longrunningpb.WaitOperationRequest{ 1286 // TODO: Fill request struct fields. 1287 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest. 1288 } 1289 resp, err := c.WaitOperation(ctx, req) 1290 if err != nil { 1291 // TODO: Handle error. 1292 } 1293 // TODO: Use resp. 1294 _ = resp 1295 }