cloud.google.com/go/aiplatform@v1.106.0/apiv1beta1/tensorboard_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 ExampleNewTensorboardClient() { 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.NewTensorboardClient(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 ExampleNewTensorboardRESTClient() { 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.NewTensorboardRESTClient(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 ExampleTensorboardClient_BatchCreateTensorboardRuns() { 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.NewTensorboardClient(ctx) 72 if err != nil { 73 // TODO: Handle error. 74 } 75 defer c.Close() 76 77 req := &aiplatformpb.BatchCreateTensorboardRunsRequest{ 78 // TODO: Fill request struct fields. 79 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#BatchCreateTensorboardRunsRequest. 80 } 81 resp, err := c.BatchCreateTensorboardRuns(ctx, req) 82 if err != nil { 83 // TODO: Handle error. 84 } 85 // TODO: Use resp. 86 _ = resp 87 } 88 89 func ExampleTensorboardClient_BatchCreateTensorboardTimeSeries() { 90 ctx := context.Background() 91 // This snippet has been automatically generated and should be regarded as a code template only. 92 // It will require modifications to work: 93 // - It may require correct/in-range values for request initialization. 94 // - It may require specifying regional endpoints when creating the service client as shown in: 95 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 96 c, err := aiplatform.NewTensorboardClient(ctx) 97 if err != nil { 98 // TODO: Handle error. 99 } 100 defer c.Close() 101 102 req := &aiplatformpb.BatchCreateTensorboardTimeSeriesRequest{ 103 // TODO: Fill request struct fields. 104 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#BatchCreateTensorboardTimeSeriesRequest. 105 } 106 resp, err := c.BatchCreateTensorboardTimeSeries(ctx, req) 107 if err != nil { 108 // TODO: Handle error. 109 } 110 // TODO: Use resp. 111 _ = resp 112 } 113 114 func ExampleTensorboardClient_BatchReadTensorboardTimeSeriesData() { 115 ctx := context.Background() 116 // This snippet has been automatically generated and should be regarded as a code template only. 117 // It will require modifications to work: 118 // - It may require correct/in-range values for request initialization. 119 // - It may require specifying regional endpoints when creating the service client as shown in: 120 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 121 c, err := aiplatform.NewTensorboardClient(ctx) 122 if err != nil { 123 // TODO: Handle error. 124 } 125 defer c.Close() 126 127 req := &aiplatformpb.BatchReadTensorboardTimeSeriesDataRequest{ 128 // TODO: Fill request struct fields. 129 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#BatchReadTensorboardTimeSeriesDataRequest. 130 } 131 resp, err := c.BatchReadTensorboardTimeSeriesData(ctx, req) 132 if err != nil { 133 // TODO: Handle error. 134 } 135 // TODO: Use resp. 136 _ = resp 137 } 138 139 func ExampleTensorboardClient_CreateTensorboard() { 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.NewTensorboardClient(ctx) 147 if err != nil { 148 // TODO: Handle error. 149 } 150 defer c.Close() 151 152 req := &aiplatformpb.CreateTensorboardRequest{ 153 // TODO: Fill request struct fields. 154 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateTensorboardRequest. 155 } 156 op, err := c.CreateTensorboard(ctx, req) 157 if err != nil { 158 // TODO: Handle error. 159 } 160 161 resp, err := op.Wait(ctx) 162 if err != nil { 163 // TODO: Handle error. 164 } 165 // TODO: Use resp. 166 _ = resp 167 } 168 169 func ExampleTensorboardClient_CreateTensorboardExperiment() { 170 ctx := context.Background() 171 // This snippet has been automatically generated and should be regarded as a code template only. 172 // It will require modifications to work: 173 // - It may require correct/in-range values for request initialization. 174 // - It may require specifying regional endpoints when creating the service client as shown in: 175 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 176 c, err := aiplatform.NewTensorboardClient(ctx) 177 if err != nil { 178 // TODO: Handle error. 179 } 180 defer c.Close() 181 182 req := &aiplatformpb.CreateTensorboardExperimentRequest{ 183 // TODO: Fill request struct fields. 184 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateTensorboardExperimentRequest. 185 } 186 resp, err := c.CreateTensorboardExperiment(ctx, req) 187 if err != nil { 188 // TODO: Handle error. 189 } 190 // TODO: Use resp. 191 _ = resp 192 } 193 194 func ExampleTensorboardClient_CreateTensorboardRun() { 195 ctx := context.Background() 196 // This snippet has been automatically generated and should be regarded as a code template only. 197 // It will require modifications to work: 198 // - It may require correct/in-range values for request initialization. 199 // - It may require specifying regional endpoints when creating the service client as shown in: 200 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 201 c, err := aiplatform.NewTensorboardClient(ctx) 202 if err != nil { 203 // TODO: Handle error. 204 } 205 defer c.Close() 206 207 req := &aiplatformpb.CreateTensorboardRunRequest{ 208 // TODO: Fill request struct fields. 209 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateTensorboardRunRequest. 210 } 211 resp, err := c.CreateTensorboardRun(ctx, req) 212 if err != nil { 213 // TODO: Handle error. 214 } 215 // TODO: Use resp. 216 _ = resp 217 } 218 219 func ExampleTensorboardClient_CreateTensorboardTimeSeries() { 220 ctx := context.Background() 221 // This snippet has been automatically generated and should be regarded as a code template only. 222 // It will require modifications to work: 223 // - It may require correct/in-range values for request initialization. 224 // - It may require specifying regional endpoints when creating the service client as shown in: 225 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 226 c, err := aiplatform.NewTensorboardClient(ctx) 227 if err != nil { 228 // TODO: Handle error. 229 } 230 defer c.Close() 231 232 req := &aiplatformpb.CreateTensorboardTimeSeriesRequest{ 233 // TODO: Fill request struct fields. 234 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateTensorboardTimeSeriesRequest. 235 } 236 resp, err := c.CreateTensorboardTimeSeries(ctx, req) 237 if err != nil { 238 // TODO: Handle error. 239 } 240 // TODO: Use resp. 241 _ = resp 242 } 243 244 func ExampleTensorboardClient_DeleteTensorboard() { 245 ctx := context.Background() 246 // This snippet has been automatically generated and should be regarded as a code template only. 247 // It will require modifications to work: 248 // - It may require correct/in-range values for request initialization. 249 // - It may require specifying regional endpoints when creating the service client as shown in: 250 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 251 c, err := aiplatform.NewTensorboardClient(ctx) 252 if err != nil { 253 // TODO: Handle error. 254 } 255 defer c.Close() 256 257 req := &aiplatformpb.DeleteTensorboardRequest{ 258 // TODO: Fill request struct fields. 259 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#DeleteTensorboardRequest. 260 } 261 op, err := c.DeleteTensorboard(ctx, req) 262 if err != nil { 263 // TODO: Handle error. 264 } 265 266 err = op.Wait(ctx) 267 if err != nil { 268 // TODO: Handle error. 269 } 270 } 271 272 func ExampleTensorboardClient_DeleteTensorboardExperiment() { 273 ctx := context.Background() 274 // This snippet has been automatically generated and should be regarded as a code template only. 275 // It will require modifications to work: 276 // - It may require correct/in-range values for request initialization. 277 // - It may require specifying regional endpoints when creating the service client as shown in: 278 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 279 c, err := aiplatform.NewTensorboardClient(ctx) 280 if err != nil { 281 // TODO: Handle error. 282 } 283 defer c.Close() 284 285 req := &aiplatformpb.DeleteTensorboardExperimentRequest{ 286 // TODO: Fill request struct fields. 287 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#DeleteTensorboardExperimentRequest. 288 } 289 op, err := c.DeleteTensorboardExperiment(ctx, req) 290 if err != nil { 291 // TODO: Handle error. 292 } 293 294 err = op.Wait(ctx) 295 if err != nil { 296 // TODO: Handle error. 297 } 298 } 299 300 func ExampleTensorboardClient_DeleteTensorboardRun() { 301 ctx := context.Background() 302 // This snippet has been automatically generated and should be regarded as a code template only. 303 // It will require modifications to work: 304 // - It may require correct/in-range values for request initialization. 305 // - It may require specifying regional endpoints when creating the service client as shown in: 306 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 307 c, err := aiplatform.NewTensorboardClient(ctx) 308 if err != nil { 309 // TODO: Handle error. 310 } 311 defer c.Close() 312 313 req := &aiplatformpb.DeleteTensorboardRunRequest{ 314 // TODO: Fill request struct fields. 315 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#DeleteTensorboardRunRequest. 316 } 317 op, err := c.DeleteTensorboardRun(ctx, req) 318 if err != nil { 319 // TODO: Handle error. 320 } 321 322 err = op.Wait(ctx) 323 if err != nil { 324 // TODO: Handle error. 325 } 326 } 327 328 func ExampleTensorboardClient_DeleteTensorboardTimeSeries() { 329 ctx := context.Background() 330 // This snippet has been automatically generated and should be regarded as a code template only. 331 // It will require modifications to work: 332 // - It may require correct/in-range values for request initialization. 333 // - It may require specifying regional endpoints when creating the service client as shown in: 334 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 335 c, err := aiplatform.NewTensorboardClient(ctx) 336 if err != nil { 337 // TODO: Handle error. 338 } 339 defer c.Close() 340 341 req := &aiplatformpb.DeleteTensorboardTimeSeriesRequest{ 342 // TODO: Fill request struct fields. 343 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#DeleteTensorboardTimeSeriesRequest. 344 } 345 op, err := c.DeleteTensorboardTimeSeries(ctx, req) 346 if err != nil { 347 // TODO: Handle error. 348 } 349 350 err = op.Wait(ctx) 351 if err != nil { 352 // TODO: Handle error. 353 } 354 } 355 356 func ExampleTensorboardClient_ExportTensorboardTimeSeriesData() { 357 ctx := context.Background() 358 // This snippet has been automatically generated and should be regarded as a code template only. 359 // It will require modifications to work: 360 // - It may require correct/in-range values for request initialization. 361 // - It may require specifying regional endpoints when creating the service client as shown in: 362 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 363 c, err := aiplatform.NewTensorboardClient(ctx) 364 if err != nil { 365 // TODO: Handle error. 366 } 367 defer c.Close() 368 369 req := &aiplatformpb.ExportTensorboardTimeSeriesDataRequest{ 370 // TODO: Fill request struct fields. 371 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ExportTensorboardTimeSeriesDataRequest. 372 } 373 it := c.ExportTensorboardTimeSeriesData(ctx, req) 374 for { 375 resp, err := it.Next() 376 if err == iterator.Done { 377 break 378 } 379 if err != nil { 380 // TODO: Handle error. 381 } 382 // TODO: Use resp. 383 _ = resp 384 385 // If you need to access the underlying RPC response, 386 // you can do so by casting the `Response` as below. 387 // Otherwise, remove this line. Only populated after 388 // first call to Next(). Not safe for concurrent access. 389 _ = it.Response.(*aiplatformpb.ExportTensorboardTimeSeriesDataResponse) 390 } 391 } 392 393 func ExampleTensorboardClient_GetTensorboard() { 394 ctx := context.Background() 395 // This snippet has been automatically generated and should be regarded as a code template only. 396 // It will require modifications to work: 397 // - It may require correct/in-range values for request initialization. 398 // - It may require specifying regional endpoints when creating the service client as shown in: 399 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 400 c, err := aiplatform.NewTensorboardClient(ctx) 401 if err != nil { 402 // TODO: Handle error. 403 } 404 defer c.Close() 405 406 req := &aiplatformpb.GetTensorboardRequest{ 407 // TODO: Fill request struct fields. 408 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetTensorboardRequest. 409 } 410 resp, err := c.GetTensorboard(ctx, req) 411 if err != nil { 412 // TODO: Handle error. 413 } 414 // TODO: Use resp. 415 _ = resp 416 } 417 418 func ExampleTensorboardClient_GetTensorboardExperiment() { 419 ctx := context.Background() 420 // This snippet has been automatically generated and should be regarded as a code template only. 421 // It will require modifications to work: 422 // - It may require correct/in-range values for request initialization. 423 // - It may require specifying regional endpoints when creating the service client as shown in: 424 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 425 c, err := aiplatform.NewTensorboardClient(ctx) 426 if err != nil { 427 // TODO: Handle error. 428 } 429 defer c.Close() 430 431 req := &aiplatformpb.GetTensorboardExperimentRequest{ 432 // TODO: Fill request struct fields. 433 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetTensorboardExperimentRequest. 434 } 435 resp, err := c.GetTensorboardExperiment(ctx, req) 436 if err != nil { 437 // TODO: Handle error. 438 } 439 // TODO: Use resp. 440 _ = resp 441 } 442 443 func ExampleTensorboardClient_GetTensorboardRun() { 444 ctx := context.Background() 445 // This snippet has been automatically generated and should be regarded as a code template only. 446 // It will require modifications to work: 447 // - It may require correct/in-range values for request initialization. 448 // - It may require specifying regional endpoints when creating the service client as shown in: 449 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 450 c, err := aiplatform.NewTensorboardClient(ctx) 451 if err != nil { 452 // TODO: Handle error. 453 } 454 defer c.Close() 455 456 req := &aiplatformpb.GetTensorboardRunRequest{ 457 // TODO: Fill request struct fields. 458 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetTensorboardRunRequest. 459 } 460 resp, err := c.GetTensorboardRun(ctx, req) 461 if err != nil { 462 // TODO: Handle error. 463 } 464 // TODO: Use resp. 465 _ = resp 466 } 467 468 func ExampleTensorboardClient_GetTensorboardTimeSeries() { 469 ctx := context.Background() 470 // This snippet has been automatically generated and should be regarded as a code template only. 471 // It will require modifications to work: 472 // - It may require correct/in-range values for request initialization. 473 // - It may require specifying regional endpoints when creating the service client as shown in: 474 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 475 c, err := aiplatform.NewTensorboardClient(ctx) 476 if err != nil { 477 // TODO: Handle error. 478 } 479 defer c.Close() 480 481 req := &aiplatformpb.GetTensorboardTimeSeriesRequest{ 482 // TODO: Fill request struct fields. 483 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetTensorboardTimeSeriesRequest. 484 } 485 resp, err := c.GetTensorboardTimeSeries(ctx, req) 486 if err != nil { 487 // TODO: Handle error. 488 } 489 // TODO: Use resp. 490 _ = resp 491 } 492 493 func ExampleTensorboardClient_ListTensorboardExperiments() { 494 ctx := context.Background() 495 // This snippet has been automatically generated and should be regarded as a code template only. 496 // It will require modifications to work: 497 // - It may require correct/in-range values for request initialization. 498 // - It may require specifying regional endpoints when creating the service client as shown in: 499 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 500 c, err := aiplatform.NewTensorboardClient(ctx) 501 if err != nil { 502 // TODO: Handle error. 503 } 504 defer c.Close() 505 506 req := &aiplatformpb.ListTensorboardExperimentsRequest{ 507 // TODO: Fill request struct fields. 508 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListTensorboardExperimentsRequest. 509 } 510 it := c.ListTensorboardExperiments(ctx, req) 511 for { 512 resp, err := it.Next() 513 if err == iterator.Done { 514 break 515 } 516 if err != nil { 517 // TODO: Handle error. 518 } 519 // TODO: Use resp. 520 _ = resp 521 522 // If you need to access the underlying RPC response, 523 // you can do so by casting the `Response` as below. 524 // Otherwise, remove this line. Only populated after 525 // first call to Next(). Not safe for concurrent access. 526 _ = it.Response.(*aiplatformpb.ListTensorboardExperimentsResponse) 527 } 528 } 529 530 func ExampleTensorboardClient_ListTensorboardRuns() { 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.NewTensorboardClient(ctx) 538 if err != nil { 539 // TODO: Handle error. 540 } 541 defer c.Close() 542 543 req := &aiplatformpb.ListTensorboardRunsRequest{ 544 // TODO: Fill request struct fields. 545 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListTensorboardRunsRequest. 546 } 547 it := c.ListTensorboardRuns(ctx, req) 548 for { 549 resp, err := it.Next() 550 if err == iterator.Done { 551 break 552 } 553 if err != nil { 554 // TODO: Handle error. 555 } 556 // TODO: Use resp. 557 _ = resp 558 559 // If you need to access the underlying RPC response, 560 // you can do so by casting the `Response` as below. 561 // Otherwise, remove this line. Only populated after 562 // first call to Next(). Not safe for concurrent access. 563 _ = it.Response.(*aiplatformpb.ListTensorboardRunsResponse) 564 } 565 } 566 567 func ExampleTensorboardClient_ListTensorboardTimeSeries() { 568 ctx := context.Background() 569 // This snippet has been automatically generated and should be regarded as a code template only. 570 // It will require modifications to work: 571 // - It may require correct/in-range values for request initialization. 572 // - It may require specifying regional endpoints when creating the service client as shown in: 573 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 574 c, err := aiplatform.NewTensorboardClient(ctx) 575 if err != nil { 576 // TODO: Handle error. 577 } 578 defer c.Close() 579 580 req := &aiplatformpb.ListTensorboardTimeSeriesRequest{ 581 // TODO: Fill request struct fields. 582 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListTensorboardTimeSeriesRequest. 583 } 584 it := c.ListTensorboardTimeSeries(ctx, req) 585 for { 586 resp, err := it.Next() 587 if err == iterator.Done { 588 break 589 } 590 if err != nil { 591 // TODO: Handle error. 592 } 593 // TODO: Use resp. 594 _ = resp 595 596 // If you need to access the underlying RPC response, 597 // you can do so by casting the `Response` as below. 598 // Otherwise, remove this line. Only populated after 599 // first call to Next(). Not safe for concurrent access. 600 _ = it.Response.(*aiplatformpb.ListTensorboardTimeSeriesResponse) 601 } 602 } 603 604 func ExampleTensorboardClient_ListTensorboards() { 605 ctx := context.Background() 606 // This snippet has been automatically generated and should be regarded as a code template only. 607 // It will require modifications to work: 608 // - It may require correct/in-range values for request initialization. 609 // - It may require specifying regional endpoints when creating the service client as shown in: 610 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 611 c, err := aiplatform.NewTensorboardClient(ctx) 612 if err != nil { 613 // TODO: Handle error. 614 } 615 defer c.Close() 616 617 req := &aiplatformpb.ListTensorboardsRequest{ 618 // TODO: Fill request struct fields. 619 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListTensorboardsRequest. 620 } 621 it := c.ListTensorboards(ctx, req) 622 for { 623 resp, err := it.Next() 624 if err == iterator.Done { 625 break 626 } 627 if err != nil { 628 // TODO: Handle error. 629 } 630 // TODO: Use resp. 631 _ = resp 632 633 // If you need to access the underlying RPC response, 634 // you can do so by casting the `Response` as below. 635 // Otherwise, remove this line. Only populated after 636 // first call to Next(). Not safe for concurrent access. 637 _ = it.Response.(*aiplatformpb.ListTensorboardsResponse) 638 } 639 } 640 641 func ExampleTensorboardClient_ReadTensorboardSize() { 642 ctx := context.Background() 643 // This snippet has been automatically generated and should be regarded as a code template only. 644 // It will require modifications to work: 645 // - It may require correct/in-range values for request initialization. 646 // - It may require specifying regional endpoints when creating the service client as shown in: 647 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 648 c, err := aiplatform.NewTensorboardClient(ctx) 649 if err != nil { 650 // TODO: Handle error. 651 } 652 defer c.Close() 653 654 req := &aiplatformpb.ReadTensorboardSizeRequest{ 655 // TODO: Fill request struct fields. 656 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ReadTensorboardSizeRequest. 657 } 658 resp, err := c.ReadTensorboardSize(ctx, req) 659 if err != nil { 660 // TODO: Handle error. 661 } 662 // TODO: Use resp. 663 _ = resp 664 } 665 666 func ExampleTensorboardClient_ReadTensorboardTimeSeriesData() { 667 ctx := context.Background() 668 // This snippet has been automatically generated and should be regarded as a code template only. 669 // It will require modifications to work: 670 // - It may require correct/in-range values for request initialization. 671 // - It may require specifying regional endpoints when creating the service client as shown in: 672 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 673 c, err := aiplatform.NewTensorboardClient(ctx) 674 if err != nil { 675 // TODO: Handle error. 676 } 677 defer c.Close() 678 679 req := &aiplatformpb.ReadTensorboardTimeSeriesDataRequest{ 680 // TODO: Fill request struct fields. 681 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ReadTensorboardTimeSeriesDataRequest. 682 } 683 resp, err := c.ReadTensorboardTimeSeriesData(ctx, req) 684 if err != nil { 685 // TODO: Handle error. 686 } 687 // TODO: Use resp. 688 _ = resp 689 } 690 691 func ExampleTensorboardClient_ReadTensorboardUsage() { 692 ctx := context.Background() 693 // This snippet has been automatically generated and should be regarded as a code template only. 694 // It will require modifications to work: 695 // - It may require correct/in-range values for request initialization. 696 // - It may require specifying regional endpoints when creating the service client as shown in: 697 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 698 c, err := aiplatform.NewTensorboardClient(ctx) 699 if err != nil { 700 // TODO: Handle error. 701 } 702 defer c.Close() 703 704 req := &aiplatformpb.ReadTensorboardUsageRequest{ 705 // TODO: Fill request struct fields. 706 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ReadTensorboardUsageRequest. 707 } 708 resp, err := c.ReadTensorboardUsage(ctx, req) 709 if err != nil { 710 // TODO: Handle error. 711 } 712 // TODO: Use resp. 713 _ = resp 714 } 715 716 func ExampleTensorboardClient_UpdateTensorboard() { 717 ctx := context.Background() 718 // This snippet has been automatically generated and should be regarded as a code template only. 719 // It will require modifications to work: 720 // - It may require correct/in-range values for request initialization. 721 // - It may require specifying regional endpoints when creating the service client as shown in: 722 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 723 c, err := aiplatform.NewTensorboardClient(ctx) 724 if err != nil { 725 // TODO: Handle error. 726 } 727 defer c.Close() 728 729 req := &aiplatformpb.UpdateTensorboardRequest{ 730 // TODO: Fill request struct fields. 731 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#UpdateTensorboardRequest. 732 } 733 op, err := c.UpdateTensorboard(ctx, req) 734 if err != nil { 735 // TODO: Handle error. 736 } 737 738 resp, err := op.Wait(ctx) 739 if err != nil { 740 // TODO: Handle error. 741 } 742 // TODO: Use resp. 743 _ = resp 744 } 745 746 func ExampleTensorboardClient_UpdateTensorboardExperiment() { 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.NewTensorboardClient(ctx) 754 if err != nil { 755 // TODO: Handle error. 756 } 757 defer c.Close() 758 759 req := &aiplatformpb.UpdateTensorboardExperimentRequest{ 760 // TODO: Fill request struct fields. 761 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#UpdateTensorboardExperimentRequest. 762 } 763 resp, err := c.UpdateTensorboardExperiment(ctx, req) 764 if err != nil { 765 // TODO: Handle error. 766 } 767 // TODO: Use resp. 768 _ = resp 769 } 770 771 func ExampleTensorboardClient_UpdateTensorboardRun() { 772 ctx := context.Background() 773 // This snippet has been automatically generated and should be regarded as a code template only. 774 // It will require modifications to work: 775 // - It may require correct/in-range values for request initialization. 776 // - It may require specifying regional endpoints when creating the service client as shown in: 777 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 778 c, err := aiplatform.NewTensorboardClient(ctx) 779 if err != nil { 780 // TODO: Handle error. 781 } 782 defer c.Close() 783 784 req := &aiplatformpb.UpdateTensorboardRunRequest{ 785 // TODO: Fill request struct fields. 786 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#UpdateTensorboardRunRequest. 787 } 788 resp, err := c.UpdateTensorboardRun(ctx, req) 789 if err != nil { 790 // TODO: Handle error. 791 } 792 // TODO: Use resp. 793 _ = resp 794 } 795 796 func ExampleTensorboardClient_UpdateTensorboardTimeSeries() { 797 ctx := context.Background() 798 // This snippet has been automatically generated and should be regarded as a code template only. 799 // It will require modifications to work: 800 // - It may require correct/in-range values for request initialization. 801 // - It may require specifying regional endpoints when creating the service client as shown in: 802 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 803 c, err := aiplatform.NewTensorboardClient(ctx) 804 if err != nil { 805 // TODO: Handle error. 806 } 807 defer c.Close() 808 809 req := &aiplatformpb.UpdateTensorboardTimeSeriesRequest{ 810 // TODO: Fill request struct fields. 811 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#UpdateTensorboardTimeSeriesRequest. 812 } 813 resp, err := c.UpdateTensorboardTimeSeries(ctx, req) 814 if err != nil { 815 // TODO: Handle error. 816 } 817 // TODO: Use resp. 818 _ = resp 819 } 820 821 func ExampleTensorboardClient_WriteTensorboardExperimentData() { 822 ctx := context.Background() 823 // This snippet has been automatically generated and should be regarded as a code template only. 824 // It will require modifications to work: 825 // - It may require correct/in-range values for request initialization. 826 // - It may require specifying regional endpoints when creating the service client as shown in: 827 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 828 c, err := aiplatform.NewTensorboardClient(ctx) 829 if err != nil { 830 // TODO: Handle error. 831 } 832 defer c.Close() 833 834 req := &aiplatformpb.WriteTensorboardExperimentDataRequest{ 835 // TODO: Fill request struct fields. 836 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#WriteTensorboardExperimentDataRequest. 837 } 838 resp, err := c.WriteTensorboardExperimentData(ctx, req) 839 if err != nil { 840 // TODO: Handle error. 841 } 842 // TODO: Use resp. 843 _ = resp 844 } 845 846 func ExampleTensorboardClient_WriteTensorboardRunData() { 847 ctx := context.Background() 848 // This snippet has been automatically generated and should be regarded as a code template only. 849 // It will require modifications to work: 850 // - It may require correct/in-range values for request initialization. 851 // - It may require specifying regional endpoints when creating the service client as shown in: 852 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 853 c, err := aiplatform.NewTensorboardClient(ctx) 854 if err != nil { 855 // TODO: Handle error. 856 } 857 defer c.Close() 858 859 req := &aiplatformpb.WriteTensorboardRunDataRequest{ 860 // TODO: Fill request struct fields. 861 // See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#WriteTensorboardRunDataRequest. 862 } 863 resp, err := c.WriteTensorboardRunData(ctx, req) 864 if err != nil { 865 // TODO: Handle error. 866 } 867 // TODO: Use resp. 868 _ = resp 869 } 870 871 func ExampleTensorboardClient_GetLocation() { 872 ctx := context.Background() 873 // This snippet has been automatically generated and should be regarded as a code template only. 874 // It will require modifications to work: 875 // - It may require correct/in-range values for request initialization. 876 // - It may require specifying regional endpoints when creating the service client as shown in: 877 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 878 c, err := aiplatform.NewTensorboardClient(ctx) 879 if err != nil { 880 // TODO: Handle error. 881 } 882 defer c.Close() 883 884 req := &locationpb.GetLocationRequest{ 885 // TODO: Fill request struct fields. 886 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest. 887 } 888 resp, err := c.GetLocation(ctx, req) 889 if err != nil { 890 // TODO: Handle error. 891 } 892 // TODO: Use resp. 893 _ = resp 894 } 895 896 func ExampleTensorboardClient_ListLocations() { 897 ctx := context.Background() 898 // This snippet has been automatically generated and should be regarded as a code template only. 899 // It will require modifications to work: 900 // - It may require correct/in-range values for request initialization. 901 // - It may require specifying regional endpoints when creating the service client as shown in: 902 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 903 c, err := aiplatform.NewTensorboardClient(ctx) 904 if err != nil { 905 // TODO: Handle error. 906 } 907 defer c.Close() 908 909 req := &locationpb.ListLocationsRequest{ 910 // TODO: Fill request struct fields. 911 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. 912 } 913 it := c.ListLocations(ctx, req) 914 for { 915 resp, err := it.Next() 916 if err == iterator.Done { 917 break 918 } 919 if err != nil { 920 // TODO: Handle error. 921 } 922 // TODO: Use resp. 923 _ = resp 924 925 // If you need to access the underlying RPC response, 926 // you can do so by casting the `Response` as below. 927 // Otherwise, remove this line. Only populated after 928 // first call to Next(). Not safe for concurrent access. 929 _ = it.Response.(*locationpb.ListLocationsResponse) 930 } 931 } 932 933 func ExampleTensorboardClient_GetIamPolicy() { 934 ctx := context.Background() 935 // This snippet has been automatically generated and should be regarded as a code template only. 936 // It will require modifications to work: 937 // - It may require correct/in-range values for request initialization. 938 // - It may require specifying regional endpoints when creating the service client as shown in: 939 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 940 c, err := aiplatform.NewTensorboardClient(ctx) 941 if err != nil { 942 // TODO: Handle error. 943 } 944 defer c.Close() 945 946 req := &iampb.GetIamPolicyRequest{ 947 // TODO: Fill request struct fields. 948 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest. 949 } 950 resp, err := c.GetIamPolicy(ctx, req) 951 if err != nil { 952 // TODO: Handle error. 953 } 954 // TODO: Use resp. 955 _ = resp 956 } 957 958 func ExampleTensorboardClient_SetIamPolicy() { 959 ctx := context.Background() 960 // This snippet has been automatically generated and should be regarded as a code template only. 961 // It will require modifications to work: 962 // - It may require correct/in-range values for request initialization. 963 // - It may require specifying regional endpoints when creating the service client as shown in: 964 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 965 c, err := aiplatform.NewTensorboardClient(ctx) 966 if err != nil { 967 // TODO: Handle error. 968 } 969 defer c.Close() 970 971 req := &iampb.SetIamPolicyRequest{ 972 // TODO: Fill request struct fields. 973 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest. 974 } 975 resp, err := c.SetIamPolicy(ctx, req) 976 if err != nil { 977 // TODO: Handle error. 978 } 979 // TODO: Use resp. 980 _ = resp 981 } 982 983 func ExampleTensorboardClient_TestIamPermissions() { 984 ctx := context.Background() 985 // This snippet has been automatically generated and should be regarded as a code template only. 986 // It will require modifications to work: 987 // - It may require correct/in-range values for request initialization. 988 // - It may require specifying regional endpoints when creating the service client as shown in: 989 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 990 c, err := aiplatform.NewTensorboardClient(ctx) 991 if err != nil { 992 // TODO: Handle error. 993 } 994 defer c.Close() 995 996 req := &iampb.TestIamPermissionsRequest{ 997 // TODO: Fill request struct fields. 998 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest. 999 } 1000 resp, err := c.TestIamPermissions(ctx, req) 1001 if err != nil { 1002 // TODO: Handle error. 1003 } 1004 // TODO: Use resp. 1005 _ = resp 1006 } 1007 1008 func ExampleTensorboardClient_CancelOperation() { 1009 ctx := context.Background() 1010 // This snippet has been automatically generated and should be regarded as a code template only. 1011 // It will require modifications to work: 1012 // - It may require correct/in-range values for request initialization. 1013 // - It may require specifying regional endpoints when creating the service client as shown in: 1014 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1015 c, err := aiplatform.NewTensorboardClient(ctx) 1016 if err != nil { 1017 // TODO: Handle error. 1018 } 1019 defer c.Close() 1020 1021 req := &longrunningpb.CancelOperationRequest{ 1022 // TODO: Fill request struct fields. 1023 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. 1024 } 1025 err = c.CancelOperation(ctx, req) 1026 if err != nil { 1027 // TODO: Handle error. 1028 } 1029 } 1030 1031 func ExampleTensorboardClient_DeleteOperation() { 1032 ctx := context.Background() 1033 // This snippet has been automatically generated and should be regarded as a code template only. 1034 // It will require modifications to work: 1035 // - It may require correct/in-range values for request initialization. 1036 // - It may require specifying regional endpoints when creating the service client as shown in: 1037 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1038 c, err := aiplatform.NewTensorboardClient(ctx) 1039 if err != nil { 1040 // TODO: Handle error. 1041 } 1042 defer c.Close() 1043 1044 req := &longrunningpb.DeleteOperationRequest{ 1045 // TODO: Fill request struct fields. 1046 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest. 1047 } 1048 err = c.DeleteOperation(ctx, req) 1049 if err != nil { 1050 // TODO: Handle error. 1051 } 1052 } 1053 1054 func ExampleTensorboardClient_GetOperation() { 1055 ctx := context.Background() 1056 // This snippet has been automatically generated and should be regarded as a code template only. 1057 // It will require modifications to work: 1058 // - It may require correct/in-range values for request initialization. 1059 // - It may require specifying regional endpoints when creating the service client as shown in: 1060 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1061 c, err := aiplatform.NewTensorboardClient(ctx) 1062 if err != nil { 1063 // TODO: Handle error. 1064 } 1065 defer c.Close() 1066 1067 req := &longrunningpb.GetOperationRequest{ 1068 // TODO: Fill request struct fields. 1069 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. 1070 } 1071 resp, err := c.GetOperation(ctx, req) 1072 if err != nil { 1073 // TODO: Handle error. 1074 } 1075 // TODO: Use resp. 1076 _ = resp 1077 } 1078 1079 func ExampleTensorboardClient_ListOperations() { 1080 ctx := context.Background() 1081 // This snippet has been automatically generated and should be regarded as a code template only. 1082 // It will require modifications to work: 1083 // - It may require correct/in-range values for request initialization. 1084 // - It may require specifying regional endpoints when creating the service client as shown in: 1085 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1086 c, err := aiplatform.NewTensorboardClient(ctx) 1087 if err != nil { 1088 // TODO: Handle error. 1089 } 1090 defer c.Close() 1091 1092 req := &longrunningpb.ListOperationsRequest{ 1093 // TODO: Fill request struct fields. 1094 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. 1095 } 1096 it := c.ListOperations(ctx, req) 1097 for { 1098 resp, err := it.Next() 1099 if err == iterator.Done { 1100 break 1101 } 1102 if err != nil { 1103 // TODO: Handle error. 1104 } 1105 // TODO: Use resp. 1106 _ = resp 1107 1108 // If you need to access the underlying RPC response, 1109 // you can do so by casting the `Response` as below. 1110 // Otherwise, remove this line. Only populated after 1111 // first call to Next(). Not safe for concurrent access. 1112 _ = it.Response.(*longrunningpb.ListOperationsResponse) 1113 } 1114 } 1115 1116 func ExampleTensorboardClient_WaitOperation() { 1117 ctx := context.Background() 1118 // This snippet has been automatically generated and should be regarded as a code template only. 1119 // It will require modifications to work: 1120 // - It may require correct/in-range values for request initialization. 1121 // - It may require specifying regional endpoints when creating the service client as shown in: 1122 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 1123 c, err := aiplatform.NewTensorboardClient(ctx) 1124 if err != nil { 1125 // TODO: Handle error. 1126 } 1127 defer c.Close() 1128 1129 req := &longrunningpb.WaitOperationRequest{ 1130 // TODO: Fill request struct fields. 1131 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest. 1132 } 1133 resp, err := c.WaitOperation(ctx, req) 1134 if err != nil { 1135 // TODO: Handle error. 1136 } 1137 // TODO: Use resp. 1138 _ = resp 1139 }