| 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 visionai_test |
| 18 |
|
| 19 |
import ( |
| 20 |
"context" |
| 21 |
|
| 22 |
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 23 |
visionai "cloud.google.com/go/visionai/apiv1" |
| 24 |
visionaipb "cloud.google.com/go/visionai/apiv1/visionaipb" |
| 25 |
"google.golang.org/api/iterator" |
| 26 |
) |
| 27 |
|
| 28 |
func ExampleNewStreamsClient() { |
| 29 |
ctx := context.Background() |
| 30 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 31 |
// It will require modifications to work: |
| 32 |
// - It may require correct/in-range values for request initialization. |
| 33 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 34 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 35 |
c, err := visionai.NewStreamsClient(ctx) |
| 36 |
if err != nil { |
| 37 |
// TODO: Handle error. |
| 38 |
} |
| 39 |
defer c.Close() |
| 40 |
|
| 41 |
// TODO: Use client. |
| 42 |
_ = c |
| 43 |
} |
| 44 |
|
| 45 |
func ExampleNewStreamsRESTClient() { |
| 46 |
ctx := context.Background() |
| 47 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 48 |
// It will require modifications to work: |
| 49 |
// - It may require correct/in-range values for request initialization. |
| 50 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 51 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 52 |
c, err := visionai.NewStreamsRESTClient(ctx) |
| 53 |
if err != nil { |
| 54 |
// TODO: Handle error. |
| 55 |
} |
| 56 |
defer c.Close() |
| 57 |
|
| 58 |
// TODO: Use client. |
| 59 |
_ = c |
| 60 |
} |
| 61 |
|
| 62 |
func ExampleStreamsClient_CreateCluster() { |
| 63 |
ctx := context.Background() |
| 64 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 65 |
// It will require modifications to work: |
| 66 |
// - It may require correct/in-range values for request initialization. |
| 67 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 68 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 69 |
c, err := visionai.NewStreamsClient(ctx) |
| 70 |
if err != nil { |
| 71 |
// TODO: Handle error. |
| 72 |
} |
| 73 |
defer c.Close() |
| 74 |
|
| 75 |
req := &visionaipb.CreateClusterRequest{ |
| 76 |
// TODO: Fill request struct fields. |
| 77 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#CreateClusterRequest. |
| 78 |
} |
| 79 |
op, err := c.CreateCluster(ctx, req) |
| 80 |
if err != nil { |
| 81 |
// TODO: Handle error. |
| 82 |
} |
| 83 |
|
| 84 |
resp, err := op.Wait(ctx) |
| 85 |
if err != nil { |
| 86 |
// TODO: Handle error. |
| 87 |
} |
| 88 |
// TODO: Use resp. |
| 89 |
_ = resp |
| 90 |
} |
| 91 |
|
| 92 |
func ExampleStreamsClient_CreateEvent() { |
| 93 |
ctx := context.Background() |
| 94 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 95 |
// It will require modifications to work: |
| 96 |
// - It may require correct/in-range values for request initialization. |
| 97 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 98 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 99 |
c, err := visionai.NewStreamsClient(ctx) |
| 100 |
if err != nil { |
| 101 |
// TODO: Handle error. |
| 102 |
} |
| 103 |
defer c.Close() |
| 104 |
|
| 105 |
req := &visionaipb.CreateEventRequest{ |
| 106 |
// TODO: Fill request struct fields. |
| 107 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#CreateEventRequest. |
| 108 |
} |
| 109 |
op, err := c.CreateEvent(ctx, req) |
| 110 |
if err != nil { |
| 111 |
// TODO: Handle error. |
| 112 |
} |
| 113 |
|
| 114 |
resp, err := op.Wait(ctx) |
| 115 |
if err != nil { |
| 116 |
// TODO: Handle error. |
| 117 |
} |
| 118 |
// TODO: Use resp. |
| 119 |
_ = resp |
| 120 |
} |
| 121 |
|
| 122 |
func ExampleStreamsClient_CreateSeries() { |
| 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 := visionai.NewStreamsClient(ctx) |
| 130 |
if err != nil { |
| 131 |
// TODO: Handle error. |
| 132 |
} |
| 133 |
defer c.Close() |
| 134 |
|
| 135 |
req := &visionaipb.CreateSeriesRequest{ |
| 136 |
// TODO: Fill request struct fields. |
| 137 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#CreateSeriesRequest. |
| 138 |
} |
| 139 |
op, err := c.CreateSeries(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 ExampleStreamsClient_CreateStream() { |
| 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 := visionai.NewStreamsClient(ctx) |
| 160 |
if err != nil { |
| 161 |
// TODO: Handle error. |
| 162 |
} |
| 163 |
defer c.Close() |
| 164 |
|
| 165 |
req := &visionaipb.CreateStreamRequest{ |
| 166 |
// TODO: Fill request struct fields. |
| 167 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#CreateStreamRequest. |
| 168 |
} |
| 169 |
op, err := c.CreateStream(ctx, req) |
| 170 |
if err != nil { |
| 171 |
// TODO: Handle error. |
| 172 |
} |
| 173 |
|
| 174 |
resp, err := op.Wait(ctx) |
| 175 |
if err != nil { |
| 176 |
// TODO: Handle error. |
| 177 |
} |
| 178 |
// TODO: Use resp. |
| 179 |
_ = resp |
| 180 |
} |
| 181 |
|
| 182 |
func ExampleStreamsClient_DeleteCluster() { |
| 183 |
ctx := context.Background() |
| 184 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 185 |
// It will require modifications to work: |
| 186 |
// - It may require correct/in-range values for request initialization. |
| 187 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 188 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 189 |
c, err := visionai.NewStreamsClient(ctx) |
| 190 |
if err != nil { |
| 191 |
// TODO: Handle error. |
| 192 |
} |
| 193 |
defer c.Close() |
| 194 |
|
| 195 |
req := &visionaipb.DeleteClusterRequest{ |
| 196 |
// TODO: Fill request struct fields. |
| 197 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#DeleteClusterRequest. |
| 198 |
} |
| 199 |
op, err := c.DeleteCluster(ctx, req) |
| 200 |
if err != nil { |
| 201 |
// TODO: Handle error. |
| 202 |
} |
| 203 |
|
| 204 |
err = op.Wait(ctx) |
| 205 |
if err != nil { |
| 206 |
// TODO: Handle error. |
| 207 |
} |
| 208 |
} |
| 209 |
|
| 210 |
func ExampleStreamsClient_DeleteEvent() { |
| 211 |
ctx := context.Background() |
| 212 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 213 |
// It will require modifications to work: |
| 214 |
// - It may require correct/in-range values for request initialization. |
| 215 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 216 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 217 |
c, err := visionai.NewStreamsClient(ctx) |
| 218 |
if err != nil { |
| 219 |
// TODO: Handle error. |
| 220 |
} |
| 221 |
defer c.Close() |
| 222 |
|
| 223 |
req := &visionaipb.DeleteEventRequest{ |
| 224 |
// TODO: Fill request struct fields. |
| 225 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#DeleteEventRequest. |
| 226 |
} |
| 227 |
op, err := c.DeleteEvent(ctx, req) |
| 228 |
if err != nil { |
| 229 |
// TODO: Handle error. |
| 230 |
} |
| 231 |
|
| 232 |
err = op.Wait(ctx) |
| 233 |
if err != nil { |
| 234 |
// TODO: Handle error. |
| 235 |
} |
| 236 |
} |
| 237 |
|
| 238 |
func ExampleStreamsClient_DeleteSeries() { |
| 239 |
ctx := context.Background() |
| 240 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 241 |
// It will require modifications to work: |
| 242 |
// - It may require correct/in-range values for request initialization. |
| 243 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 244 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 245 |
c, err := visionai.NewStreamsClient(ctx) |
| 246 |
if err != nil { |
| 247 |
// TODO: Handle error. |
| 248 |
} |
| 249 |
defer c.Close() |
| 250 |
|
| 251 |
req := &visionaipb.DeleteSeriesRequest{ |
| 252 |
// TODO: Fill request struct fields. |
| 253 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#DeleteSeriesRequest. |
| 254 |
} |
| 255 |
op, err := c.DeleteSeries(ctx, req) |
| 256 |
if err != nil { |
| 257 |
// TODO: Handle error. |
| 258 |
} |
| 259 |
|
| 260 |
err = op.Wait(ctx) |
| 261 |
if err != nil { |
| 262 |
// TODO: Handle error. |
| 263 |
} |
| 264 |
} |
| 265 |
|
| 266 |
func ExampleStreamsClient_DeleteStream() { |
| 267 |
ctx := context.Background() |
| 268 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 269 |
// It will require modifications to work: |
| 270 |
// - It may require correct/in-range values for request initialization. |
| 271 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 272 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 273 |
c, err := visionai.NewStreamsClient(ctx) |
| 274 |
if err != nil { |
| 275 |
// TODO: Handle error. |
| 276 |
} |
| 277 |
defer c.Close() |
| 278 |
|
| 279 |
req := &visionaipb.DeleteStreamRequest{ |
| 280 |
// TODO: Fill request struct fields. |
| 281 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#DeleteStreamRequest. |
| 282 |
} |
| 283 |
op, err := c.DeleteStream(ctx, req) |
| 284 |
if err != nil { |
| 285 |
// TODO: Handle error. |
| 286 |
} |
| 287 |
|
| 288 |
err = op.Wait(ctx) |
| 289 |
if err != nil { |
| 290 |
// TODO: Handle error. |
| 291 |
} |
| 292 |
} |
| 293 |
|
| 294 |
func ExampleStreamsClient_GenerateStreamHlsToken() { |
| 295 |
ctx := context.Background() |
| 296 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 297 |
// It will require modifications to work: |
| 298 |
// - It may require correct/in-range values for request initialization. |
| 299 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 300 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 301 |
c, err := visionai.NewStreamsClient(ctx) |
| 302 |
if err != nil { |
| 303 |
// TODO: Handle error. |
| 304 |
} |
| 305 |
defer c.Close() |
| 306 |
|
| 307 |
req := &visionaipb.GenerateStreamHlsTokenRequest{ |
| 308 |
// TODO: Fill request struct fields. |
| 309 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#GenerateStreamHlsTokenRequest. |
| 310 |
} |
| 311 |
resp, err := c.GenerateStreamHlsToken(ctx, req) |
| 312 |
if err != nil { |
| 313 |
// TODO: Handle error. |
| 314 |
} |
| 315 |
// TODO: Use resp. |
| 316 |
_ = resp |
| 317 |
} |
| 318 |
|
| 319 |
func ExampleStreamsClient_GetCluster() { |
| 320 |
ctx := context.Background() |
| 321 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 322 |
// It will require modifications to work: |
| 323 |
// - It may require correct/in-range values for request initialization. |
| 324 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 325 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 326 |
c, err := visionai.NewStreamsClient(ctx) |
| 327 |
if err != nil { |
| 328 |
// TODO: Handle error. |
| 329 |
} |
| 330 |
defer c.Close() |
| 331 |
|
| 332 |
req := &visionaipb.GetClusterRequest{ |
| 333 |
// TODO: Fill request struct fields. |
| 334 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#GetClusterRequest. |
| 335 |
} |
| 336 |
resp, err := c.GetCluster(ctx, req) |
| 337 |
if err != nil { |
| 338 |
// TODO: Handle error. |
| 339 |
} |
| 340 |
// TODO: Use resp. |
| 341 |
_ = resp |
| 342 |
} |
| 343 |
|
| 344 |
func ExampleStreamsClient_GetEvent() { |
| 345 |
ctx := context.Background() |
| 346 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 347 |
// It will require modifications to work: |
| 348 |
// - It may require correct/in-range values for request initialization. |
| 349 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 350 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 351 |
c, err := visionai.NewStreamsClient(ctx) |
| 352 |
if err != nil { |
| 353 |
// TODO: Handle error. |
| 354 |
} |
| 355 |
defer c.Close() |
| 356 |
|
| 357 |
req := &visionaipb.GetEventRequest{ |
| 358 |
// TODO: Fill request struct fields. |
| 359 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#GetEventRequest. |
| 360 |
} |
| 361 |
resp, err := c.GetEvent(ctx, req) |
| 362 |
if err != nil { |
| 363 |
// TODO: Handle error. |
| 364 |
} |
| 365 |
// TODO: Use resp. |
| 366 |
_ = resp |
| 367 |
} |
| 368 |
|
| 369 |
func ExampleStreamsClient_GetSeries() { |
| 370 |
ctx := context.Background() |
| 371 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 372 |
// It will require modifications to work: |
| 373 |
// - It may require correct/in-range values for request initialization. |
| 374 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 375 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 376 |
c, err := visionai.NewStreamsClient(ctx) |
| 377 |
if err != nil { |
| 378 |
// TODO: Handle error. |
| 379 |
} |
| 380 |
defer c.Close() |
| 381 |
|
| 382 |
req := &visionaipb.GetSeriesRequest{ |
| 383 |
// TODO: Fill request struct fields. |
| 384 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#GetSeriesRequest. |
| 385 |
} |
| 386 |
resp, err := c.GetSeries(ctx, req) |
| 387 |
if err != nil { |
| 388 |
// TODO: Handle error. |
| 389 |
} |
| 390 |
// TODO: Use resp. |
| 391 |
_ = resp |
| 392 |
} |
| 393 |
|
| 394 |
func ExampleStreamsClient_GetStream() { |
| 395 |
ctx := context.Background() |
| 396 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 397 |
// It will require modifications to work: |
| 398 |
// - It may require correct/in-range values for request initialization. |
| 399 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 400 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 401 |
c, err := visionai.NewStreamsClient(ctx) |
| 402 |
if err != nil { |
| 403 |
// TODO: Handle error. |
| 404 |
} |
| 405 |
defer c.Close() |
| 406 |
|
| 407 |
req := &visionaipb.GetStreamRequest{ |
| 408 |
// TODO: Fill request struct fields. |
| 409 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#GetStreamRequest. |
| 410 |
} |
| 411 |
resp, err := c.GetStream(ctx, req) |
| 412 |
if err != nil { |
| 413 |
// TODO: Handle error. |
| 414 |
} |
| 415 |
// TODO: Use resp. |
| 416 |
_ = resp |
| 417 |
} |
| 418 |
|
| 419 |
func ExampleStreamsClient_GetStreamThumbnail() { |
| 420 |
ctx := context.Background() |
| 421 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 422 |
// It will require modifications to work: |
| 423 |
// - It may require correct/in-range values for request initialization. |
| 424 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 425 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 426 |
c, err := visionai.NewStreamsClient(ctx) |
| 427 |
if err != nil { |
| 428 |
// TODO: Handle error. |
| 429 |
} |
| 430 |
defer c.Close() |
| 431 |
|
| 432 |
req := &visionaipb.GetStreamThumbnailRequest{ |
| 433 |
// TODO: Fill request struct fields. |
| 434 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#GetStreamThumbnailRequest. |
| 435 |
} |
| 436 |
op, err := c.GetStreamThumbnail(ctx, req) |
| 437 |
if err != nil { |
| 438 |
// TODO: Handle error. |
| 439 |
} |
| 440 |
|
| 441 |
resp, err := op.Wait(ctx) |
| 442 |
if err != nil { |
| 443 |
// TODO: Handle error. |
| 444 |
} |
| 445 |
// TODO: Use resp. |
| 446 |
_ = resp |
| 447 |
} |
| 448 |
|
| 449 |
func ExampleStreamsClient_ListClusters() { |
| 450 |
ctx := context.Background() |
| 451 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 452 |
// It will require modifications to work: |
| 453 |
// - It may require correct/in-range values for request initialization. |
| 454 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 455 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 456 |
c, err := visionai.NewStreamsClient(ctx) |
| 457 |
if err != nil { |
| 458 |
// TODO: Handle error. |
| 459 |
} |
| 460 |
defer c.Close() |
| 461 |
|
| 462 |
req := &visionaipb.ListClustersRequest{ |
| 463 |
// TODO: Fill request struct fields. |
| 464 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListClustersRequest. |
| 465 |
} |
| 466 |
it := c.ListClusters(ctx, req) |
| 467 |
for { |
| 468 |
resp, err := it.Next() |
| 469 |
if err == iterator.Done { |
| 470 |
break |
| 471 |
} |
| 472 |
if err != nil { |
| 473 |
// TODO: Handle error. |
| 474 |
} |
| 475 |
// TODO: Use resp. |
| 476 |
_ = resp |
| 477 |
|
| 478 |
// If you need to access the underlying RPC response, |
| 479 |
// you can do so by casting the `Response` as below. |
| 480 |
// Otherwise, remove this line. Only populated after |
| 481 |
// first call to Next(). Not safe for concurrent access. |
| 482 |
_ = it.Response.(*visionaipb.ListClustersResponse) |
| 483 |
} |
| 484 |
} |
| 485 |
|
| 486 |
func ExampleStreamsClient_ListEvents() { |
| 487 |
ctx := context.Background() |
| 488 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 489 |
// It will require modifications to work: |
| 490 |
// - It may require correct/in-range values for request initialization. |
| 491 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 492 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 493 |
c, err := visionai.NewStreamsClient(ctx) |
| 494 |
if err != nil { |
| 495 |
// TODO: Handle error. |
| 496 |
} |
| 497 |
defer c.Close() |
| 498 |
|
| 499 |
req := &visionaipb.ListEventsRequest{ |
| 500 |
// TODO: Fill request struct fields. |
| 501 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListEventsRequest. |
| 502 |
} |
| 503 |
it := c.ListEvents(ctx, req) |
| 504 |
for { |
| 505 |
resp, err := it.Next() |
| 506 |
if err == iterator.Done { |
| 507 |
break |
| 508 |
} |
| 509 |
if err != nil { |
| 510 |
// TODO: Handle error. |
| 511 |
} |
| 512 |
// TODO: Use resp. |
| 513 |
_ = resp |
| 514 |
|
| 515 |
// If you need to access the underlying RPC response, |
| 516 |
// you can do so by casting the `Response` as below. |
| 517 |
// Otherwise, remove this line. Only populated after |
| 518 |
// first call to Next(). Not safe for concurrent access. |
| 519 |
_ = it.Response.(*visionaipb.ListEventsResponse) |
| 520 |
} |
| 521 |
} |
| 522 |
|
| 523 |
func ExampleStreamsClient_ListSeries() { |
| 524 |
ctx := context.Background() |
| 525 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 526 |
// It will require modifications to work: |
| 527 |
// - It may require correct/in-range values for request initialization. |
| 528 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 529 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 530 |
c, err := visionai.NewStreamsClient(ctx) |
| 531 |
if err != nil { |
| 532 |
// TODO: Handle error. |
| 533 |
} |
| 534 |
defer c.Close() |
| 535 |
|
| 536 |
req := &visionaipb.ListSeriesRequest{ |
| 537 |
// TODO: Fill request struct fields. |
| 538 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListSeriesRequest. |
| 539 |
} |
| 540 |
it := c.ListSeries(ctx, req) |
| 541 |
for { |
| 542 |
resp, err := it.Next() |
| 543 |
if err == iterator.Done { |
| 544 |
break |
| 545 |
} |
| 546 |
if err != nil { |
| 547 |
// TODO: Handle error. |
| 548 |
} |
| 549 |
// TODO: Use resp. |
| 550 |
_ = resp |
| 551 |
|
| 552 |
// If you need to access the underlying RPC response, |
| 553 |
// you can do so by casting the `Response` as below. |
| 554 |
// Otherwise, remove this line. Only populated after |
| 555 |
// first call to Next(). Not safe for concurrent access. |
| 556 |
_ = it.Response.(*visionaipb.ListSeriesResponse) |
| 557 |
} |
| 558 |
} |
| 559 |
|
| 560 |
func ExampleStreamsClient_ListStreams() { |
| 561 |
ctx := context.Background() |
| 562 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 563 |
// It will require modifications to work: |
| 564 |
// - It may require correct/in-range values for request initialization. |
| 565 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 566 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 567 |
c, err := visionai.NewStreamsClient(ctx) |
| 568 |
if err != nil { |
| 569 |
// TODO: Handle error. |
| 570 |
} |
| 571 |
defer c.Close() |
| 572 |
|
| 573 |
req := &visionaipb.ListStreamsRequest{ |
| 574 |
// TODO: Fill request struct fields. |
| 575 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListStreamsRequest. |
| 576 |
} |
| 577 |
it := c.ListStreams(ctx, req) |
| 578 |
for { |
| 579 |
resp, err := it.Next() |
| 580 |
if err == iterator.Done { |
| 581 |
break |
| 582 |
} |
| 583 |
if err != nil { |
| 584 |
// TODO: Handle error. |
| 585 |
} |
| 586 |
// TODO: Use resp. |
| 587 |
_ = resp |
| 588 |
|
| 589 |
// If you need to access the underlying RPC response, |
| 590 |
// you can do so by casting the `Response` as below. |
| 591 |
// Otherwise, remove this line. Only populated after |
| 592 |
// first call to Next(). Not safe for concurrent access. |
| 593 |
_ = it.Response.(*visionaipb.ListStreamsResponse) |
| 594 |
} |
| 595 |
} |
| 596 |
|
| 597 |
func ExampleStreamsClient_MaterializeChannel() { |
| 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 := visionai.NewStreamsClient(ctx) |
| 605 |
if err != nil { |
| 606 |
// TODO: Handle error. |
| 607 |
} |
| 608 |
defer c.Close() |
| 609 |
|
| 610 |
req := &visionaipb.MaterializeChannelRequest{ |
| 611 |
// TODO: Fill request struct fields. |
| 612 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#MaterializeChannelRequest. |
| 613 |
} |
| 614 |
op, err := c.MaterializeChannel(ctx, req) |
| 615 |
if err != nil { |
| 616 |
// TODO: Handle error. |
| 617 |
} |
| 618 |
|
| 619 |
resp, err := op.Wait(ctx) |
| 620 |
if err != nil { |
| 621 |
// TODO: Handle error. |
| 622 |
} |
| 623 |
// TODO: Use resp. |
| 624 |
_ = resp |
| 625 |
} |
| 626 |
|
| 627 |
func ExampleStreamsClient_UpdateCluster() { |
| 628 |
ctx := context.Background() |
| 629 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 630 |
// It will require modifications to work: |
| 631 |
// - It may require correct/in-range values for request initialization. |
| 632 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 633 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 634 |
c, err := visionai.NewStreamsClient(ctx) |
| 635 |
if err != nil { |
| 636 |
// TODO: Handle error. |
| 637 |
} |
| 638 |
defer c.Close() |
| 639 |
|
| 640 |
req := &visionaipb.UpdateClusterRequest{ |
| 641 |
// TODO: Fill request struct fields. |
| 642 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#UpdateClusterRequest. |
| 643 |
} |
| 644 |
op, err := c.UpdateCluster(ctx, req) |
| 645 |
if err != nil { |
| 646 |
// TODO: Handle error. |
| 647 |
} |
| 648 |
|
| 649 |
resp, err := op.Wait(ctx) |
| 650 |
if err != nil { |
| 651 |
// TODO: Handle error. |
| 652 |
} |
| 653 |
// TODO: Use resp. |
| 654 |
_ = resp |
| 655 |
} |
| 656 |
|
| 657 |
func ExampleStreamsClient_UpdateEvent() { |
| 658 |
ctx := context.Background() |
| 659 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 660 |
// It will require modifications to work: |
| 661 |
// - It may require correct/in-range values for request initialization. |
| 662 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 663 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 664 |
c, err := visionai.NewStreamsClient(ctx) |
| 665 |
if err != nil { |
| 666 |
// TODO: Handle error. |
| 667 |
} |
| 668 |
defer c.Close() |
| 669 |
|
| 670 |
req := &visionaipb.UpdateEventRequest{ |
| 671 |
// TODO: Fill request struct fields. |
| 672 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#UpdateEventRequest. |
| 673 |
} |
| 674 |
op, err := c.UpdateEvent(ctx, req) |
| 675 |
if err != nil { |
| 676 |
// TODO: Handle error. |
| 677 |
} |
| 678 |
|
| 679 |
resp, err := op.Wait(ctx) |
| 680 |
if err != nil { |
| 681 |
// TODO: Handle error. |
| 682 |
} |
| 683 |
// TODO: Use resp. |
| 684 |
_ = resp |
| 685 |
} |
| 686 |
|
| 687 |
func ExampleStreamsClient_UpdateSeries() { |
| 688 |
ctx := context.Background() |
| 689 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 690 |
// It will require modifications to work: |
| 691 |
// - It may require correct/in-range values for request initialization. |
| 692 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 693 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 694 |
c, err := visionai.NewStreamsClient(ctx) |
| 695 |
if err != nil { |
| 696 |
// TODO: Handle error. |
| 697 |
} |
| 698 |
defer c.Close() |
| 699 |
|
| 700 |
req := &visionaipb.UpdateSeriesRequest{ |
| 701 |
// TODO: Fill request struct fields. |
| 702 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#UpdateSeriesRequest. |
| 703 |
} |
| 704 |
op, err := c.UpdateSeries(ctx, req) |
| 705 |
if err != nil { |
| 706 |
// TODO: Handle error. |
| 707 |
} |
| 708 |
|
| 709 |
resp, err := op.Wait(ctx) |
| 710 |
if err != nil { |
| 711 |
// TODO: Handle error. |
| 712 |
} |
| 713 |
// TODO: Use resp. |
| 714 |
_ = resp |
| 715 |
} |
| 716 |
|
| 717 |
func ExampleStreamsClient_UpdateStream() { |
| 718 |
ctx := context.Background() |
| 719 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 720 |
// It will require modifications to work: |
| 721 |
// - It may require correct/in-range values for request initialization. |
| 722 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 723 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 724 |
c, err := visionai.NewStreamsClient(ctx) |
| 725 |
if err != nil { |
| 726 |
// TODO: Handle error. |
| 727 |
} |
| 728 |
defer c.Close() |
| 729 |
|
| 730 |
req := &visionaipb.UpdateStreamRequest{ |
| 731 |
// TODO: Fill request struct fields. |
| 732 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#UpdateStreamRequest. |
| 733 |
} |
| 734 |
op, err := c.UpdateStream(ctx, req) |
| 735 |
if err != nil { |
| 736 |
// TODO: Handle error. |
| 737 |
} |
| 738 |
|
| 739 |
resp, err := op.Wait(ctx) |
| 740 |
if err != nil { |
| 741 |
// TODO: Handle error. |
| 742 |
} |
| 743 |
// TODO: Use resp. |
| 744 |
_ = resp |
| 745 |
} |
| 746 |
|
| 747 |
func ExampleStreamsClient_CancelOperation() { |
| 748 |
ctx := context.Background() |
| 749 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 750 |
// It will require modifications to work: |
| 751 |
// - It may require correct/in-range values for request initialization. |
| 752 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 753 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 754 |
c, err := visionai.NewStreamsClient(ctx) |
| 755 |
if err != nil { |
| 756 |
// TODO: Handle error. |
| 757 |
} |
| 758 |
defer c.Close() |
| 759 |
|
| 760 |
req := &longrunningpb.CancelOperationRequest{ |
| 761 |
// TODO: Fill request struct fields. |
| 762 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. |
| 763 |
} |
| 764 |
err = c.CancelOperation(ctx, req) |
| 765 |
if err != nil { |
| 766 |
// TODO: Handle error. |
| 767 |
} |
| 768 |
} |
| 769 |
|
| 770 |
func ExampleStreamsClient_DeleteOperation() { |
| 771 |
ctx := context.Background() |
| 772 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 773 |
// It will require modifications to work: |
| 774 |
// - It may require correct/in-range values for request initialization. |
| 775 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 776 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 777 |
c, err := visionai.NewStreamsClient(ctx) |
| 778 |
if err != nil { |
| 779 |
// TODO: Handle error. |
| 780 |
} |
| 781 |
defer c.Close() |
| 782 |
|
| 783 |
req := &longrunningpb.DeleteOperationRequest{ |
| 784 |
// TODO: Fill request struct fields. |
| 785 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest. |
| 786 |
} |
| 787 |
err = c.DeleteOperation(ctx, req) |
| 788 |
if err != nil { |
| 789 |
// TODO: Handle error. |
| 790 |
} |
| 791 |
} |
| 792 |
|
| 793 |
func ExampleStreamsClient_GetOperation() { |
| 794 |
ctx := context.Background() |
| 795 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 796 |
// It will require modifications to work: |
| 797 |
// - It may require correct/in-range values for request initialization. |
| 798 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 799 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 800 |
c, err := visionai.NewStreamsClient(ctx) |
| 801 |
if err != nil { |
| 802 |
// TODO: Handle error. |
| 803 |
} |
| 804 |
defer c.Close() |
| 805 |
|
| 806 |
req := &longrunningpb.GetOperationRequest{ |
| 807 |
// TODO: Fill request struct fields. |
| 808 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. |
| 809 |
} |
| 810 |
resp, err := c.GetOperation(ctx, req) |
| 811 |
if err != nil { |
| 812 |
// TODO: Handle error. |
| 813 |
} |
| 814 |
// TODO: Use resp. |
| 815 |
_ = resp |
| 816 |
} |
| 817 |
|
| 818 |
func ExampleStreamsClient_ListOperations() { |
| 819 |
ctx := context.Background() |
| 820 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 821 |
// It will require modifications to work: |
| 822 |
// - It may require correct/in-range values for request initialization. |
| 823 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 824 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 825 |
c, err := visionai.NewStreamsClient(ctx) |
| 826 |
if err != nil { |
| 827 |
// TODO: Handle error. |
| 828 |
} |
| 829 |
defer c.Close() |
| 830 |
|
| 831 |
req := &longrunningpb.ListOperationsRequest{ |
| 832 |
// TODO: Fill request struct fields. |
| 833 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. |
| 834 |
} |
| 835 |
it := c.ListOperations(ctx, req) |
| 836 |
for { |
| 837 |
resp, err := it.Next() |
| 838 |
if err == iterator.Done { |
| 839 |
break |
| 840 |
} |
| 841 |
if err != nil { |
| 842 |
// TODO: Handle error. |
| 843 |
} |
| 844 |
// TODO: Use resp. |
| 845 |
_ = resp |
| 846 |
|
| 847 |
// If you need to access the underlying RPC response, |
| 848 |
// you can do so by casting the `Response` as below. |
| 849 |
// Otherwise, remove this line. Only populated after |
| 850 |
// first call to Next(). Not safe for concurrent access. |
| 851 |
_ = it.Response.(*longrunningpb.ListOperationsResponse) |
| 852 |
} |
| 853 |
} |