Debian Codegraph @

video/livestream/apiv1/livestream_client_example_test.go

raw symbols SCIP
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 livestream_test
18
19 import (
20 "context"
21
22 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
23 livestream "cloud.google.com/go/video/livestream/apiv1"
24 livestreampb "cloud.google.com/go/video/livestream/apiv1/livestreampb"
25 "google.golang.org/api/iterator"
26 locationpb "google.golang.org/genproto/googleapis/cloud/location"
27 )
28
29 func ExampleNewClient() {
30 ctx := context.Background()
31 // This snippet has been automatically generated and should be regarded as a code template only.
32 // It will require modifications to work:
33 // - It may require correct/in-range values for request initialization.
34 // - It may require specifying regional endpoints when creating the service client as shown in:
35 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
36 c, err := livestream.NewClient(ctx)
37 if err != nil {
38 // TODO: Handle error.
39 }
40 defer c.Close()
41
42 // TODO: Use client.
43 _ = c
44 }
45
46 func ExampleNewRESTClient() {
47 ctx := context.Background()
48 // This snippet has been automatically generated and should be regarded as a code template only.
49 // It will require modifications to work:
50 // - It may require correct/in-range values for request initialization.
51 // - It may require specifying regional endpoints when creating the service client as shown in:
52 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
53 c, err := livestream.NewRESTClient(ctx)
54 if err != nil {
55 // TODO: Handle error.
56 }
57 defer c.Close()
58
59 // TODO: Use client.
60 _ = c
61 }
62
63 func ExampleClient_CreateAsset() {
64 ctx := context.Background()
65 // This snippet has been automatically generated and should be regarded as a code template only.
66 // It will require modifications to work:
67 // - It may require correct/in-range values for request initialization.
68 // - It may require specifying regional endpoints when creating the service client as shown in:
69 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
70 c, err := livestream.NewClient(ctx)
71 if err != nil {
72 // TODO: Handle error.
73 }
74 defer c.Close()
75
76 req := &livestreampb.CreateAssetRequest{
77 // TODO: Fill request struct fields.
78 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#CreateAssetRequest.
79 }
80 op, err := c.CreateAsset(ctx, req)
81 if err != nil {
82 // TODO: Handle error.
83 }
84
85 resp, err := op.Wait(ctx)
86 if err != nil {
87 // TODO: Handle error.
88 }
89 // TODO: Use resp.
90 _ = resp
91 }
92
93 func ExampleClient_CreateChannel() {
94 ctx := context.Background()
95 // This snippet has been automatically generated and should be regarded as a code template only.
96 // It will require modifications to work:
97 // - It may require correct/in-range values for request initialization.
98 // - It may require specifying regional endpoints when creating the service client as shown in:
99 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
100 c, err := livestream.NewClient(ctx)
101 if err != nil {
102 // TODO: Handle error.
103 }
104 defer c.Close()
105
106 req := &livestreampb.CreateChannelRequest{
107 // TODO: Fill request struct fields.
108 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#CreateChannelRequest.
109 }
110 op, err := c.CreateChannel(ctx, req)
111 if err != nil {
112 // TODO: Handle error.
113 }
114
115 resp, err := op.Wait(ctx)
116 if err != nil {
117 // TODO: Handle error.
118 }
119 // TODO: Use resp.
120 _ = resp
121 }
122
123 func ExampleClient_CreateClip() {
124 ctx := context.Background()
125 // This snippet has been automatically generated and should be regarded as a code template only.
126 // It will require modifications to work:
127 // - It may require correct/in-range values for request initialization.
128 // - It may require specifying regional endpoints when creating the service client as shown in:
129 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
130 c, err := livestream.NewClient(ctx)
131 if err != nil {
132 // TODO: Handle error.
133 }
134 defer c.Close()
135
136 req := &livestreampb.CreateClipRequest{
137 // TODO: Fill request struct fields.
138 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#CreateClipRequest.
139 }
140 op, err := c.CreateClip(ctx, req)
141 if err != nil {
142 // TODO: Handle error.
143 }
144
145 resp, err := op.Wait(ctx)
146 if err != nil {
147 // TODO: Handle error.
148 }
149 // TODO: Use resp.
150 _ = resp
151 }
152
153 func ExampleClient_CreateDvrSession() {
154 ctx := context.Background()
155 // This snippet has been automatically generated and should be regarded as a code template only.
156 // It will require modifications to work:
157 // - It may require correct/in-range values for request initialization.
158 // - It may require specifying regional endpoints when creating the service client as shown in:
159 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
160 c, err := livestream.NewClient(ctx)
161 if err != nil {
162 // TODO: Handle error.
163 }
164 defer c.Close()
165
166 req := &livestreampb.CreateDvrSessionRequest{
167 // TODO: Fill request struct fields.
168 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#CreateDvrSessionRequest.
169 }
170 op, err := c.CreateDvrSession(ctx, req)
171 if err != nil {
172 // TODO: Handle error.
173 }
174
175 resp, err := op.Wait(ctx)
176 if err != nil {
177 // TODO: Handle error.
178 }
179 // TODO: Use resp.
180 _ = resp
181 }
182
183 func ExampleClient_CreateEvent() {
184 ctx := context.Background()
185 // This snippet has been automatically generated and should be regarded as a code template only.
186 // It will require modifications to work:
187 // - It may require correct/in-range values for request initialization.
188 // - It may require specifying regional endpoints when creating the service client as shown in:
189 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
190 c, err := livestream.NewClient(ctx)
191 if err != nil {
192 // TODO: Handle error.
193 }
194 defer c.Close()
195
196 req := &livestreampb.CreateEventRequest{
197 // TODO: Fill request struct fields.
198 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#CreateEventRequest.
199 }
200 resp, err := c.CreateEvent(ctx, req)
201 if err != nil {
202 // TODO: Handle error.
203 }
204 // TODO: Use resp.
205 _ = resp
206 }
207
208 func ExampleClient_CreateInput() {
209 ctx := context.Background()
210 // This snippet has been automatically generated and should be regarded as a code template only.
211 // It will require modifications to work:
212 // - It may require correct/in-range values for request initialization.
213 // - It may require specifying regional endpoints when creating the service client as shown in:
214 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
215 c, err := livestream.NewClient(ctx)
216 if err != nil {
217 // TODO: Handle error.
218 }
219 defer c.Close()
220
221 req := &livestreampb.CreateInputRequest{
222 // TODO: Fill request struct fields.
223 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#CreateInputRequest.
224 }
225 op, err := c.CreateInput(ctx, req)
226 if err != nil {
227 // TODO: Handle error.
228 }
229
230 resp, err := op.Wait(ctx)
231 if err != nil {
232 // TODO: Handle error.
233 }
234 // TODO: Use resp.
235 _ = resp
236 }
237
238 func ExampleClient_DeleteAsset() {
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 := livestream.NewClient(ctx)
246 if err != nil {
247 // TODO: Handle error.
248 }
249 defer c.Close()
250
251 req := &livestreampb.DeleteAssetRequest{
252 // TODO: Fill request struct fields.
253 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#DeleteAssetRequest.
254 }
255 op, err := c.DeleteAsset(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 ExampleClient_DeleteChannel() {
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 := livestream.NewClient(ctx)
274 if err != nil {
275 // TODO: Handle error.
276 }
277 defer c.Close()
278
279 req := &livestreampb.DeleteChannelRequest{
280 // TODO: Fill request struct fields.
281 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#DeleteChannelRequest.
282 }
283 op, err := c.DeleteChannel(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 ExampleClient_DeleteClip() {
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 := livestream.NewClient(ctx)
302 if err != nil {
303 // TODO: Handle error.
304 }
305 defer c.Close()
306
307 req := &livestreampb.DeleteClipRequest{
308 // TODO: Fill request struct fields.
309 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#DeleteClipRequest.
310 }
311 op, err := c.DeleteClip(ctx, req)
312 if err != nil {
313 // TODO: Handle error.
314 }
315
316 err = op.Wait(ctx)
317 if err != nil {
318 // TODO: Handle error.
319 }
320 }
321
322 func ExampleClient_DeleteDvrSession() {
323 ctx := context.Background()
324 // This snippet has been automatically generated and should be regarded as a code template only.
325 // It will require modifications to work:
326 // - It may require correct/in-range values for request initialization.
327 // - It may require specifying regional endpoints when creating the service client as shown in:
328 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
329 c, err := livestream.NewClient(ctx)
330 if err != nil {
331 // TODO: Handle error.
332 }
333 defer c.Close()
334
335 req := &livestreampb.DeleteDvrSessionRequest{
336 // TODO: Fill request struct fields.
337 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#DeleteDvrSessionRequest.
338 }
339 op, err := c.DeleteDvrSession(ctx, req)
340 if err != nil {
341 // TODO: Handle error.
342 }
343
344 err = op.Wait(ctx)
345 if err != nil {
346 // TODO: Handle error.
347 }
348 }
349
350 func ExampleClient_DeleteEvent() {
351 ctx := context.Background()
352 // This snippet has been automatically generated and should be regarded as a code template only.
353 // It will require modifications to work:
354 // - It may require correct/in-range values for request initialization.
355 // - It may require specifying regional endpoints when creating the service client as shown in:
356 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
357 c, err := livestream.NewClient(ctx)
358 if err != nil {
359 // TODO: Handle error.
360 }
361 defer c.Close()
362
363 req := &livestreampb.DeleteEventRequest{
364 // TODO: Fill request struct fields.
365 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#DeleteEventRequest.
366 }
367 err = c.DeleteEvent(ctx, req)
368 if err != nil {
369 // TODO: Handle error.
370 }
371 }
372
373 func ExampleClient_DeleteInput() {
374 ctx := context.Background()
375 // This snippet has been automatically generated and should be regarded as a code template only.
376 // It will require modifications to work:
377 // - It may require correct/in-range values for request initialization.
378 // - It may require specifying regional endpoints when creating the service client as shown in:
379 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
380 c, err := livestream.NewClient(ctx)
381 if err != nil {
382 // TODO: Handle error.
383 }
384 defer c.Close()
385
386 req := &livestreampb.DeleteInputRequest{
387 // TODO: Fill request struct fields.
388 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#DeleteInputRequest.
389 }
390 op, err := c.DeleteInput(ctx, req)
391 if err != nil {
392 // TODO: Handle error.
393 }
394
395 err = op.Wait(ctx)
396 if err != nil {
397 // TODO: Handle error.
398 }
399 }
400
401 func ExampleClient_GetAsset() {
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 := livestream.NewClient(ctx)
409 if err != nil {
410 // TODO: Handle error.
411 }
412 defer c.Close()
413
414 req := &livestreampb.GetAssetRequest{
415 // TODO: Fill request struct fields.
416 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#GetAssetRequest.
417 }
418 resp, err := c.GetAsset(ctx, req)
419 if err != nil {
420 // TODO: Handle error.
421 }
422 // TODO: Use resp.
423 _ = resp
424 }
425
426 func ExampleClient_GetChannel() {
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 := livestream.NewClient(ctx)
434 if err != nil {
435 // TODO: Handle error.
436 }
437 defer c.Close()
438
439 req := &livestreampb.GetChannelRequest{
440 // TODO: Fill request struct fields.
441 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#GetChannelRequest.
442 }
443 resp, err := c.GetChannel(ctx, req)
444 if err != nil {
445 // TODO: Handle error.
446 }
447 // TODO: Use resp.
448 _ = resp
449 }
450
451 func ExampleClient_GetClip() {
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 := livestream.NewClient(ctx)
459 if err != nil {
460 // TODO: Handle error.
461 }
462 defer c.Close()
463
464 req := &livestreampb.GetClipRequest{
465 // TODO: Fill request struct fields.
466 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#GetClipRequest.
467 }
468 resp, err := c.GetClip(ctx, req)
469 if err != nil {
470 // TODO: Handle error.
471 }
472 // TODO: Use resp.
473 _ = resp
474 }
475
476 func ExampleClient_GetDvrSession() {
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 := livestream.NewClient(ctx)
484 if err != nil {
485 // TODO: Handle error.
486 }
487 defer c.Close()
488
489 req := &livestreampb.GetDvrSessionRequest{
490 // TODO: Fill request struct fields.
491 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#GetDvrSessionRequest.
492 }
493 resp, err := c.GetDvrSession(ctx, req)
494 if err != nil {
495 // TODO: Handle error.
496 }
497 // TODO: Use resp.
498 _ = resp
499 }
500
501 func ExampleClient_GetEvent() {
502 ctx := context.Background()
503 // This snippet has been automatically generated and should be regarded as a code template only.
504 // It will require modifications to work:
505 // - It may require correct/in-range values for request initialization.
506 // - It may require specifying regional endpoints when creating the service client as shown in:
507 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
508 c, err := livestream.NewClient(ctx)
509 if err != nil {
510 // TODO: Handle error.
511 }
512 defer c.Close()
513
514 req := &livestreampb.GetEventRequest{
515 // TODO: Fill request struct fields.
516 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#GetEventRequest.
517 }
518 resp, err := c.GetEvent(ctx, req)
519 if err != nil {
520 // TODO: Handle error.
521 }
522 // TODO: Use resp.
523 _ = resp
524 }
525
526 func ExampleClient_GetInput() {
527 ctx := context.Background()
528 // This snippet has been automatically generated and should be regarded as a code template only.
529 // It will require modifications to work:
530 // - It may require correct/in-range values for request initialization.
531 // - It may require specifying regional endpoints when creating the service client as shown in:
532 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
533 c, err := livestream.NewClient(ctx)
534 if err != nil {
535 // TODO: Handle error.
536 }
537 defer c.Close()
538
539 req := &livestreampb.GetInputRequest{
540 // TODO: Fill request struct fields.
541 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#GetInputRequest.
542 }
543 resp, err := c.GetInput(ctx, req)
544 if err != nil {
545 // TODO: Handle error.
546 }
547 // TODO: Use resp.
548 _ = resp
549 }
550
551 func ExampleClient_GetPool() {
552 ctx := context.Background()
553 // This snippet has been automatically generated and should be regarded as a code template only.
554 // It will require modifications to work:
555 // - It may require correct/in-range values for request initialization.
556 // - It may require specifying regional endpoints when creating the service client as shown in:
557 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
558 c, err := livestream.NewClient(ctx)
559 if err != nil {
560 // TODO: Handle error.
561 }
562 defer c.Close()
563
564 req := &livestreampb.GetPoolRequest{
565 // TODO: Fill request struct fields.
566 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#GetPoolRequest.
567 }
568 resp, err := c.GetPool(ctx, req)
569 if err != nil {
570 // TODO: Handle error.
571 }
572 // TODO: Use resp.
573 _ = resp
574 }
575
576 func ExampleClient_ListAssets() {
577 ctx := context.Background()
578 // This snippet has been automatically generated and should be regarded as a code template only.
579 // It will require modifications to work:
580 // - It may require correct/in-range values for request initialization.
581 // - It may require specifying regional endpoints when creating the service client as shown in:
582 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
583 c, err := livestream.NewClient(ctx)
584 if err != nil {
585 // TODO: Handle error.
586 }
587 defer c.Close()
588
589 req := &livestreampb.ListAssetsRequest{
590 // TODO: Fill request struct fields.
591 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#ListAssetsRequest.
592 }
593 it := c.ListAssets(ctx, req)
594 for {
595 resp, err := it.Next()
596 if err == iterator.Done {
597 break
598 }
599 if err != nil {
600 // TODO: Handle error.
601 }
602 // TODO: Use resp.
603 _ = resp
604
605 // If you need to access the underlying RPC response,
606 // you can do so by casting the `Response` as below.
607 // Otherwise, remove this line. Only populated after
608 // first call to Next(). Not safe for concurrent access.
609 _ = it.Response.(*livestreampb.ListAssetsResponse)
610 }
611 }
612
613 func ExampleClient_ListChannels() {
614 ctx := context.Background()
615 // This snippet has been automatically generated and should be regarded as a code template only.
616 // It will require modifications to work:
617 // - It may require correct/in-range values for request initialization.
618 // - It may require specifying regional endpoints when creating the service client as shown in:
619 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
620 c, err := livestream.NewClient(ctx)
621 if err != nil {
622 // TODO: Handle error.
623 }
624 defer c.Close()
625
626 req := &livestreampb.ListChannelsRequest{
627 // TODO: Fill request struct fields.
628 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#ListChannelsRequest.
629 }
630 it := c.ListChannels(ctx, req)
631 for {
632 resp, err := it.Next()
633 if err == iterator.Done {
634 break
635 }
636 if err != nil {
637 // TODO: Handle error.
638 }
639 // TODO: Use resp.
640 _ = resp
641
642 // If you need to access the underlying RPC response,
643 // you can do so by casting the `Response` as below.
644 // Otherwise, remove this line. Only populated after
645 // first call to Next(). Not safe for concurrent access.
646 _ = it.Response.(*livestreampb.ListChannelsResponse)
647 }
648 }
649
650 func ExampleClient_ListClips() {
651 ctx := context.Background()
652 // This snippet has been automatically generated and should be regarded as a code template only.
653 // It will require modifications to work:
654 // - It may require correct/in-range values for request initialization.
655 // - It may require specifying regional endpoints when creating the service client as shown in:
656 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
657 c, err := livestream.NewClient(ctx)
658 if err != nil {
659 // TODO: Handle error.
660 }
661 defer c.Close()
662
663 req := &livestreampb.ListClipsRequest{
664 // TODO: Fill request struct fields.
665 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#ListClipsRequest.
666 }
667 it := c.ListClips(ctx, req)
668 for {
669 resp, err := it.Next()
670 if err == iterator.Done {
671 break
672 }
673 if err != nil {
674 // TODO: Handle error.
675 }
676 // TODO: Use resp.
677 _ = resp
678
679 // If you need to access the underlying RPC response,
680 // you can do so by casting the `Response` as below.
681 // Otherwise, remove this line. Only populated after
682 // first call to Next(). Not safe for concurrent access.
683 _ = it.Response.(*livestreampb.ListClipsResponse)
684 }
685 }
686
687 func ExampleClient_ListDvrSessions() {
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 := livestream.NewClient(ctx)
695 if err != nil {
696 // TODO: Handle error.
697 }
698 defer c.Close()
699
700 req := &livestreampb.ListDvrSessionsRequest{
701 // TODO: Fill request struct fields.
702 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#ListDvrSessionsRequest.
703 }
704 it := c.ListDvrSessions(ctx, req)
705 for {
706 resp, err := it.Next()
707 if err == iterator.Done {
708 break
709 }
710 if err != nil {
711 // TODO: Handle error.
712 }
713 // TODO: Use resp.
714 _ = resp
715
716 // If you need to access the underlying RPC response,
717 // you can do so by casting the `Response` as below.
718 // Otherwise, remove this line. Only populated after
719 // first call to Next(). Not safe for concurrent access.
720 _ = it.Response.(*livestreampb.ListDvrSessionsResponse)
721 }
722 }
723
724 func ExampleClient_ListEvents() {
725 ctx := context.Background()
726 // This snippet has been automatically generated and should be regarded as a code template only.
727 // It will require modifications to work:
728 // - It may require correct/in-range values for request initialization.
729 // - It may require specifying regional endpoints when creating the service client as shown in:
730 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
731 c, err := livestream.NewClient(ctx)
732 if err != nil {
733 // TODO: Handle error.
734 }
735 defer c.Close()
736
737 req := &livestreampb.ListEventsRequest{
738 // TODO: Fill request struct fields.
739 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#ListEventsRequest.
740 }
741 it := c.ListEvents(ctx, req)
742 for {
743 resp, err := it.Next()
744 if err == iterator.Done {
745 break
746 }
747 if err != nil {
748 // TODO: Handle error.
749 }
750 // TODO: Use resp.
751 _ = resp
752
753 // If you need to access the underlying RPC response,
754 // you can do so by casting the `Response` as below.
755 // Otherwise, remove this line. Only populated after
756 // first call to Next(). Not safe for concurrent access.
757 _ = it.Response.(*livestreampb.ListEventsResponse)
758 }
759 }
760
761 func ExampleClient_ListInputs() {
762 ctx := context.Background()
763 // This snippet has been automatically generated and should be regarded as a code template only.
764 // It will require modifications to work:
765 // - It may require correct/in-range values for request initialization.
766 // - It may require specifying regional endpoints when creating the service client as shown in:
767 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
768 c, err := livestream.NewClient(ctx)
769 if err != nil {
770 // TODO: Handle error.
771 }
772 defer c.Close()
773
774 req := &livestreampb.ListInputsRequest{
775 // TODO: Fill request struct fields.
776 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#ListInputsRequest.
777 }
778 it := c.ListInputs(ctx, req)
779 for {
780 resp, err := it.Next()
781 if err == iterator.Done {
782 break
783 }
784 if err != nil {
785 // TODO: Handle error.
786 }
787 // TODO: Use resp.
788 _ = resp
789
790 // If you need to access the underlying RPC response,
791 // you can do so by casting the `Response` as below.
792 // Otherwise, remove this line. Only populated after
793 // first call to Next(). Not safe for concurrent access.
794 _ = it.Response.(*livestreampb.ListInputsResponse)
795 }
796 }
797
798 func ExampleClient_PreviewInput() {
799 ctx := context.Background()
800 // This snippet has been automatically generated and should be regarded as a code template only.
801 // It will require modifications to work:
802 // - It may require correct/in-range values for request initialization.
803 // - It may require specifying regional endpoints when creating the service client as shown in:
804 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
805 c, err := livestream.NewClient(ctx)
806 if err != nil {
807 // TODO: Handle error.
808 }
809 defer c.Close()
810
811 req := &livestreampb.PreviewInputRequest{
812 // TODO: Fill request struct fields.
813 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#PreviewInputRequest.
814 }
815 resp, err := c.PreviewInput(ctx, req)
816 if err != nil {
817 // TODO: Handle error.
818 }
819 // TODO: Use resp.
820 _ = resp
821 }
822
823 func ExampleClient_StartChannel() {
824 ctx := context.Background()
825 // This snippet has been automatically generated and should be regarded as a code template only.
826 // It will require modifications to work:
827 // - It may require correct/in-range values for request initialization.
828 // - It may require specifying regional endpoints when creating the service client as shown in:
829 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
830 c, err := livestream.NewClient(ctx)
831 if err != nil {
832 // TODO: Handle error.
833 }
834 defer c.Close()
835
836 req := &livestreampb.StartChannelRequest{
837 // TODO: Fill request struct fields.
838 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#StartChannelRequest.
839 }
840 op, err := c.StartChannel(ctx, req)
841 if err != nil {
842 // TODO: Handle error.
843 }
844
845 resp, err := op.Wait(ctx)
846 if err != nil {
847 // TODO: Handle error.
848 }
849 // TODO: Use resp.
850 _ = resp
851 }
852
853 func ExampleClient_StartDistribution() {
854 ctx := context.Background()
855 // This snippet has been automatically generated and should be regarded as a code template only.
856 // It will require modifications to work:
857 // - It may require correct/in-range values for request initialization.
858 // - It may require specifying regional endpoints when creating the service client as shown in:
859 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
860 c, err := livestream.NewClient(ctx)
861 if err != nil {
862 // TODO: Handle error.
863 }
864 defer c.Close()
865
866 req := &livestreampb.StartDistributionRequest{
867 // TODO: Fill request struct fields.
868 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#StartDistributionRequest.
869 }
870 op, err := c.StartDistribution(ctx, req)
871 if err != nil {
872 // TODO: Handle error.
873 }
874
875 resp, err := op.Wait(ctx)
876 if err != nil {
877 // TODO: Handle error.
878 }
879 // TODO: Use resp.
880 _ = resp
881 }
882
883 func ExampleClient_StopChannel() {
884 ctx := context.Background()
885 // This snippet has been automatically generated and should be regarded as a code template only.
886 // It will require modifications to work:
887 // - It may require correct/in-range values for request initialization.
888 // - It may require specifying regional endpoints when creating the service client as shown in:
889 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
890 c, err := livestream.NewClient(ctx)
891 if err != nil {
892 // TODO: Handle error.
893 }
894 defer c.Close()
895
896 req := &livestreampb.StopChannelRequest{
897 // TODO: Fill request struct fields.
898 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#StopChannelRequest.
899 }
900 op, err := c.StopChannel(ctx, req)
901 if err != nil {
902 // TODO: Handle error.
903 }
904
905 resp, err := op.Wait(ctx)
906 if err != nil {
907 // TODO: Handle error.
908 }
909 // TODO: Use resp.
910 _ = resp
911 }
912
913 func ExampleClient_StopDistribution() {
914 ctx := context.Background()
915 // This snippet has been automatically generated and should be regarded as a code template only.
916 // It will require modifications to work:
917 // - It may require correct/in-range values for request initialization.
918 // - It may require specifying regional endpoints when creating the service client as shown in:
919 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
920 c, err := livestream.NewClient(ctx)
921 if err != nil {
922 // TODO: Handle error.
923 }
924 defer c.Close()
925
926 req := &livestreampb.StopDistributionRequest{
927 // TODO: Fill request struct fields.
928 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#StopDistributionRequest.
929 }
930 op, err := c.StopDistribution(ctx, req)
931 if err != nil {
932 // TODO: Handle error.
933 }
934
935 resp, err := op.Wait(ctx)
936 if err != nil {
937 // TODO: Handle error.
938 }
939 // TODO: Use resp.
940 _ = resp
941 }
942
943 func ExampleClient_UpdateChannel() {
944 ctx := context.Background()
945 // This snippet has been automatically generated and should be regarded as a code template only.
946 // It will require modifications to work:
947 // - It may require correct/in-range values for request initialization.
948 // - It may require specifying regional endpoints when creating the service client as shown in:
949 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
950 c, err := livestream.NewClient(ctx)
951 if err != nil {
952 // TODO: Handle error.
953 }
954 defer c.Close()
955
956 req := &livestreampb.UpdateChannelRequest{
957 // TODO: Fill request struct fields.
958 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#UpdateChannelRequest.
959 }
960 op, err := c.UpdateChannel(ctx, req)
961 if err != nil {
962 // TODO: Handle error.
963 }
964
965 resp, err := op.Wait(ctx)
966 if err != nil {
967 // TODO: Handle error.
968 }
969 // TODO: Use resp.
970 _ = resp
971 }
972
973 func ExampleClient_UpdateDvrSession() {
974 ctx := context.Background()
975 // This snippet has been automatically generated and should be regarded as a code template only.
976 // It will require modifications to work:
977 // - It may require correct/in-range values for request initialization.
978 // - It may require specifying regional endpoints when creating the service client as shown in:
979 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
980 c, err := livestream.NewClient(ctx)
981 if err != nil {
982 // TODO: Handle error.
983 }
984 defer c.Close()
985
986 req := &livestreampb.UpdateDvrSessionRequest{
987 // TODO: Fill request struct fields.
988 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#UpdateDvrSessionRequest.
989 }
990 op, err := c.UpdateDvrSession(ctx, req)
991 if err != nil {
992 // TODO: Handle error.
993 }
994
995 resp, err := op.Wait(ctx)
996 if err != nil {
997 // TODO: Handle error.
998 }
999 // TODO: Use resp.
1000 _ = resp
1001 }
1002
1003 func ExampleClient_UpdateInput() {
1004 ctx := context.Background()
1005 // This snippet has been automatically generated and should be regarded as a code template only.
1006 // It will require modifications to work:
1007 // - It may require correct/in-range values for request initialization.
1008 // - It may require specifying regional endpoints when creating the service client as shown in:
1009 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1010 c, err := livestream.NewClient(ctx)
1011 if err != nil {
1012 // TODO: Handle error.
1013 }
1014 defer c.Close()
1015
1016 req := &livestreampb.UpdateInputRequest{
1017 // TODO: Fill request struct fields.
1018 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#UpdateInputRequest.
1019 }
1020 op, err := c.UpdateInput(ctx, req)
1021 if err != nil {
1022 // TODO: Handle error.
1023 }
1024
1025 resp, err := op.Wait(ctx)
1026 if err != nil {
1027 // TODO: Handle error.
1028 }
1029 // TODO: Use resp.
1030 _ = resp
1031 }
1032
1033 func ExampleClient_UpdatePool() {
1034 ctx := context.Background()
1035 // This snippet has been automatically generated and should be regarded as a code template only.
1036 // It will require modifications to work:
1037 // - It may require correct/in-range values for request initialization.
1038 // - It may require specifying regional endpoints when creating the service client as shown in:
1039 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1040 c, err := livestream.NewClient(ctx)
1041 if err != nil {
1042 // TODO: Handle error.
1043 }
1044 defer c.Close()
1045
1046 req := &livestreampb.UpdatePoolRequest{
1047 // TODO: Fill request struct fields.
1048 // See https://pkg.go.dev/cloud.google.com/go/video/livestream/apiv1/livestreampb#UpdatePoolRequest.
1049 }
1050 op, err := c.UpdatePool(ctx, req)
1051 if err != nil {
1052 // TODO: Handle error.
1053 }
1054
1055 resp, err := op.Wait(ctx)
1056 if err != nil {
1057 // TODO: Handle error.
1058 }
1059 // TODO: Use resp.
1060 _ = resp
1061 }
1062
1063 func ExampleClient_GetLocation() {
1064 ctx := context.Background()
1065 // This snippet has been automatically generated and should be regarded as a code template only.
1066 // It will require modifications to work:
1067 // - It may require correct/in-range values for request initialization.
1068 // - It may require specifying regional endpoints when creating the service client as shown in:
1069 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1070 c, err := livestream.NewClient(ctx)
1071 if err != nil {
1072 // TODO: Handle error.
1073 }
1074 defer c.Close()
1075
1076 req := &locationpb.GetLocationRequest{
1077 // TODO: Fill request struct fields.
1078 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
1079 }
1080 resp, err := c.GetLocation(ctx, req)
1081 if err != nil {
1082 // TODO: Handle error.
1083 }
1084 // TODO: Use resp.
1085 _ = resp
1086 }
1087
1088 func ExampleClient_ListLocations() {
1089 ctx := context.Background()
1090 // This snippet has been automatically generated and should be regarded as a code template only.
1091 // It will require modifications to work:
1092 // - It may require correct/in-range values for request initialization.
1093 // - It may require specifying regional endpoints when creating the service client as shown in:
1094 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1095 c, err := livestream.NewClient(ctx)
1096 if err != nil {
1097 // TODO: Handle error.
1098 }
1099 defer c.Close()
1100
1101 req := &locationpb.ListLocationsRequest{
1102 // TODO: Fill request struct fields.
1103 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
1104 }
1105 it := c.ListLocations(ctx, req)
1106 for {
1107 resp, err := it.Next()
1108 if err == iterator.Done {
1109 break
1110 }
1111 if err != nil {
1112 // TODO: Handle error.
1113 }
1114 // TODO: Use resp.
1115 _ = resp
1116
1117 // If you need to access the underlying RPC response,
1118 // you can do so by casting the `Response` as below.
1119 // Otherwise, remove this line. Only populated after
1120 // first call to Next(). Not safe for concurrent access.
1121 _ = it.Response.(*locationpb.ListLocationsResponse)
1122 }
1123 }
1124
1125 func ExampleClient_CancelOperation() {
1126 ctx := context.Background()
1127 // This snippet has been automatically generated and should be regarded as a code template only.
1128 // It will require modifications to work:
1129 // - It may require correct/in-range values for request initialization.
1130 // - It may require specifying regional endpoints when creating the service client as shown in:
1131 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1132 c, err := livestream.NewClient(ctx)
1133 if err != nil {
1134 // TODO: Handle error.
1135 }
1136 defer c.Close()
1137
1138 req := &longrunningpb.CancelOperationRequest{
1139 // TODO: Fill request struct fields.
1140 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
1141 }
1142 err = c.CancelOperation(ctx, req)
1143 if err != nil {
1144 // TODO: Handle error.
1145 }
1146 }
1147
1148 func ExampleClient_DeleteOperation() {
1149 ctx := context.Background()
1150 // This snippet has been automatically generated and should be regarded as a code template only.
1151 // It will require modifications to work:
1152 // - It may require correct/in-range values for request initialization.
1153 // - It may require specifying regional endpoints when creating the service client as shown in:
1154 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1155 c, err := livestream.NewClient(ctx)
1156 if err != nil {
1157 // TODO: Handle error.
1158 }
1159 defer c.Close()
1160
1161 req := &longrunningpb.DeleteOperationRequest{
1162 // TODO: Fill request struct fields.
1163 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
1164 }
1165 err = c.DeleteOperation(ctx, req)
1166 if err != nil {
1167 // TODO: Handle error.
1168 }
1169 }
1170
1171 func ExampleClient_GetOperation() {
1172 ctx := context.Background()
1173 // This snippet has been automatically generated and should be regarded as a code template only.
1174 // It will require modifications to work:
1175 // - It may require correct/in-range values for request initialization.
1176 // - It may require specifying regional endpoints when creating the service client as shown in:
1177 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1178 c, err := livestream.NewClient(ctx)
1179 if err != nil {
1180 // TODO: Handle error.
1181 }
1182 defer c.Close()
1183
1184 req := &longrunningpb.GetOperationRequest{
1185 // TODO: Fill request struct fields.
1186 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
1187 }
1188 resp, err := c.GetOperation(ctx, req)
1189 if err != nil {
1190 // TODO: Handle error.
1191 }
1192 // TODO: Use resp.
1193 _ = resp
1194 }
1195
1196 func ExampleClient_ListOperations() {
1197 ctx := context.Background()
1198 // This snippet has been automatically generated and should be regarded as a code template only.
1199 // It will require modifications to work:
1200 // - It may require correct/in-range values for request initialization.
1201 // - It may require specifying regional endpoints when creating the service client as shown in:
1202 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1203 c, err := livestream.NewClient(ctx)
1204 if err != nil {
1205 // TODO: Handle error.
1206 }
1207 defer c.Close()
1208
1209 req := &longrunningpb.ListOperationsRequest{
1210 // TODO: Fill request struct fields.
1211 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
1212 }
1213 it := c.ListOperations(ctx, req)
1214 for {
1215 resp, err := it.Next()
1216 if err == iterator.Done {
1217 break
1218 }
1219 if err != nil {
1220 // TODO: Handle error.
1221 }
1222 // TODO: Use resp.
1223 _ = resp
1224
1225 // If you need to access the underlying RPC response,
1226 // you can do so by casting the `Response` as below.
1227 // Otherwise, remove this line. Only populated after
1228 // first call to Next(). Not safe for concurrent access.
1229 _ = it.Response.(*longrunningpb.ListOperationsResponse)
1230 }
1231 }