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