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