Debian Codegraph @

managedkafka/schemaregistry/apiv1/managed_schema_registry_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 schemaregistry_test
18
19 import (
20 "context"
21
22 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
23 schemaregistry "cloud.google.com/go/managedkafka/schemaregistry/apiv1"
24 schemaregistrypb "cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb"
25 "google.golang.org/api/iterator"
26 locationpb "google.golang.org/genproto/googleapis/cloud/location"
27 )
28
29 func ExampleNewManagedSchemaRegistryClient() {
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 := schemaregistry.NewManagedSchemaRegistryClient(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 ExampleNewManagedSchemaRegistryRESTClient() {
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 := schemaregistry.NewManagedSchemaRegistryRESTClient(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 ExampleManagedSchemaRegistryClient_CheckCompatibility() {
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 := schemaregistry.NewManagedSchemaRegistryClient(ctx)
71 if err != nil {
72 // TODO: Handle error.
73 }
74 defer c.Close()
75
76 req := &schemaregistrypb.CheckCompatibilityRequest{
77 // TODO: Fill request struct fields.
78 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#CheckCompatibilityRequest.
79 }
80 resp, err := c.CheckCompatibility(ctx, req)
81 if err != nil {
82 // TODO: Handle error.
83 }
84 // TODO: Use resp.
85 _ = resp
86 }
87
88 func ExampleManagedSchemaRegistryClient_CreateSchemaRegistry() {
89 ctx := context.Background()
90 // This snippet has been automatically generated and should be regarded as a code template only.
91 // It will require modifications to work:
92 // - It may require correct/in-range values for request initialization.
93 // - It may require specifying regional endpoints when creating the service client as shown in:
94 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
95 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
96 if err != nil {
97 // TODO: Handle error.
98 }
99 defer c.Close()
100
101 req := &schemaregistrypb.CreateSchemaRegistryRequest{
102 // TODO: Fill request struct fields.
103 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#CreateSchemaRegistryRequest.
104 }
105 resp, err := c.CreateSchemaRegistry(ctx, req)
106 if err != nil {
107 // TODO: Handle error.
108 }
109 // TODO: Use resp.
110 _ = resp
111 }
112
113 func ExampleManagedSchemaRegistryClient_CreateVersion() {
114 ctx := context.Background()
115 // This snippet has been automatically generated and should be regarded as a code template only.
116 // It will require modifications to work:
117 // - It may require correct/in-range values for request initialization.
118 // - It may require specifying regional endpoints when creating the service client as shown in:
119 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
120 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
121 if err != nil {
122 // TODO: Handle error.
123 }
124 defer c.Close()
125
126 req := &schemaregistrypb.CreateVersionRequest{
127 // TODO: Fill request struct fields.
128 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#CreateVersionRequest.
129 }
130 resp, err := c.CreateVersion(ctx, req)
131 if err != nil {
132 // TODO: Handle error.
133 }
134 // TODO: Use resp.
135 _ = resp
136 }
137
138 func ExampleManagedSchemaRegistryClient_DeleteSchemaConfig() {
139 ctx := context.Background()
140 // This snippet has been automatically generated and should be regarded as a code template only.
141 // It will require modifications to work:
142 // - It may require correct/in-range values for request initialization.
143 // - It may require specifying regional endpoints when creating the service client as shown in:
144 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
145 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
146 if err != nil {
147 // TODO: Handle error.
148 }
149 defer c.Close()
150
151 req := &schemaregistrypb.DeleteSchemaConfigRequest{
152 // TODO: Fill request struct fields.
153 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#DeleteSchemaConfigRequest.
154 }
155 resp, err := c.DeleteSchemaConfig(ctx, req)
156 if err != nil {
157 // TODO: Handle error.
158 }
159 // TODO: Use resp.
160 _ = resp
161 }
162
163 func ExampleManagedSchemaRegistryClient_DeleteSchemaMode() {
164 ctx := context.Background()
165 // This snippet has been automatically generated and should be regarded as a code template only.
166 // It will require modifications to work:
167 // - It may require correct/in-range values for request initialization.
168 // - It may require specifying regional endpoints when creating the service client as shown in:
169 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
170 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
171 if err != nil {
172 // TODO: Handle error.
173 }
174 defer c.Close()
175
176 req := &schemaregistrypb.DeleteSchemaModeRequest{
177 // TODO: Fill request struct fields.
178 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#DeleteSchemaModeRequest.
179 }
180 resp, err := c.DeleteSchemaMode(ctx, req)
181 if err != nil {
182 // TODO: Handle error.
183 }
184 // TODO: Use resp.
185 _ = resp
186 }
187
188 func ExampleManagedSchemaRegistryClient_DeleteSchemaRegistry() {
189 ctx := context.Background()
190 // This snippet has been automatically generated and should be regarded as a code template only.
191 // It will require modifications to work:
192 // - It may require correct/in-range values for request initialization.
193 // - It may require specifying regional endpoints when creating the service client as shown in:
194 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
195 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
196 if err != nil {
197 // TODO: Handle error.
198 }
199 defer c.Close()
200
201 req := &schemaregistrypb.DeleteSchemaRegistryRequest{
202 // TODO: Fill request struct fields.
203 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#DeleteSchemaRegistryRequest.
204 }
205 err = c.DeleteSchemaRegistry(ctx, req)
206 if err != nil {
207 // TODO: Handle error.
208 }
209 }
210
211 func ExampleManagedSchemaRegistryClient_DeleteSubject() {
212 ctx := context.Background()
213 // This snippet has been automatically generated and should be regarded as a code template only.
214 // It will require modifications to work:
215 // - It may require correct/in-range values for request initialization.
216 // - It may require specifying regional endpoints when creating the service client as shown in:
217 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
218 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
219 if err != nil {
220 // TODO: Handle error.
221 }
222 defer c.Close()
223
224 req := &schemaregistrypb.DeleteSubjectRequest{
225 // TODO: Fill request struct fields.
226 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#DeleteSubjectRequest.
227 }
228 resp, err := c.DeleteSubject(ctx, req)
229 if err != nil {
230 // TODO: Handle error.
231 }
232 // TODO: Use resp.
233 _ = resp
234 }
235
236 func ExampleManagedSchemaRegistryClient_DeleteVersion() {
237 ctx := context.Background()
238 // This snippet has been automatically generated and should be regarded as a code template only.
239 // It will require modifications to work:
240 // - It may require correct/in-range values for request initialization.
241 // - It may require specifying regional endpoints when creating the service client as shown in:
242 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
243 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
244 if err != nil {
245 // TODO: Handle error.
246 }
247 defer c.Close()
248
249 req := &schemaregistrypb.DeleteVersionRequest{
250 // TODO: Fill request struct fields.
251 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#DeleteVersionRequest.
252 }
253 resp, err := c.DeleteVersion(ctx, req)
254 if err != nil {
255 // TODO: Handle error.
256 }
257 // TODO: Use resp.
258 _ = resp
259 }
260
261 func ExampleManagedSchemaRegistryClient_GetContext() {
262 ctx := context.Background()
263 // This snippet has been automatically generated and should be regarded as a code template only.
264 // It will require modifications to work:
265 // - It may require correct/in-range values for request initialization.
266 // - It may require specifying regional endpoints when creating the service client as shown in:
267 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
268 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
269 if err != nil {
270 // TODO: Handle error.
271 }
272 defer c.Close()
273
274 req := &schemaregistrypb.GetContextRequest{
275 // TODO: Fill request struct fields.
276 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#GetContextRequest.
277 }
278 resp, err := c.GetContext(ctx, req)
279 if err != nil {
280 // TODO: Handle error.
281 }
282 // TODO: Use resp.
283 _ = resp
284 }
285
286 func ExampleManagedSchemaRegistryClient_GetRawSchema() {
287 ctx := context.Background()
288 // This snippet has been automatically generated and should be regarded as a code template only.
289 // It will require modifications to work:
290 // - It may require correct/in-range values for request initialization.
291 // - It may require specifying regional endpoints when creating the service client as shown in:
292 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
293 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
294 if err != nil {
295 // TODO: Handle error.
296 }
297 defer c.Close()
298
299 req := &schemaregistrypb.GetSchemaRequest{
300 // TODO: Fill request struct fields.
301 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#GetSchemaRequest.
302 }
303 resp, err := c.GetRawSchema(ctx, req)
304 if err != nil {
305 // TODO: Handle error.
306 }
307 // TODO: Use resp.
308 _ = resp
309 }
310
311 func ExampleManagedSchemaRegistryClient_GetRawSchemaVersion() {
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 := schemaregistry.NewManagedSchemaRegistryClient(ctx)
319 if err != nil {
320 // TODO: Handle error.
321 }
322 defer c.Close()
323
324 req := &schemaregistrypb.GetVersionRequest{
325 // TODO: Fill request struct fields.
326 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#GetVersionRequest.
327 }
328 resp, err := c.GetRawSchemaVersion(ctx, req)
329 if err != nil {
330 // TODO: Handle error.
331 }
332 // TODO: Use resp.
333 _ = resp
334 }
335
336 func ExampleManagedSchemaRegistryClient_GetSchema() {
337 ctx := context.Background()
338 // This snippet has been automatically generated and should be regarded as a code template only.
339 // It will require modifications to work:
340 // - It may require correct/in-range values for request initialization.
341 // - It may require specifying regional endpoints when creating the service client as shown in:
342 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
343 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
344 if err != nil {
345 // TODO: Handle error.
346 }
347 defer c.Close()
348
349 req := &schemaregistrypb.GetSchemaRequest{
350 // TODO: Fill request struct fields.
351 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#GetSchemaRequest.
352 }
353 resp, err := c.GetSchema(ctx, req)
354 if err != nil {
355 // TODO: Handle error.
356 }
357 // TODO: Use resp.
358 _ = resp
359 }
360
361 func ExampleManagedSchemaRegistryClient_GetSchemaConfig() {
362 ctx := context.Background()
363 // This snippet has been automatically generated and should be regarded as a code template only.
364 // It will require modifications to work:
365 // - It may require correct/in-range values for request initialization.
366 // - It may require specifying regional endpoints when creating the service client as shown in:
367 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
368 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
369 if err != nil {
370 // TODO: Handle error.
371 }
372 defer c.Close()
373
374 req := &schemaregistrypb.GetSchemaConfigRequest{
375 // TODO: Fill request struct fields.
376 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#GetSchemaConfigRequest.
377 }
378 resp, err := c.GetSchemaConfig(ctx, req)
379 if err != nil {
380 // TODO: Handle error.
381 }
382 // TODO: Use resp.
383 _ = resp
384 }
385
386 func ExampleManagedSchemaRegistryClient_GetSchemaMode() {
387 ctx := context.Background()
388 // This snippet has been automatically generated and should be regarded as a code template only.
389 // It will require modifications to work:
390 // - It may require correct/in-range values for request initialization.
391 // - It may require specifying regional endpoints when creating the service client as shown in:
392 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
393 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
394 if err != nil {
395 // TODO: Handle error.
396 }
397 defer c.Close()
398
399 req := &schemaregistrypb.GetSchemaModeRequest{
400 // TODO: Fill request struct fields.
401 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#GetSchemaModeRequest.
402 }
403 resp, err := c.GetSchemaMode(ctx, req)
404 if err != nil {
405 // TODO: Handle error.
406 }
407 // TODO: Use resp.
408 _ = resp
409 }
410
411 func ExampleManagedSchemaRegistryClient_GetSchemaRegistry() {
412 ctx := context.Background()
413 // This snippet has been automatically generated and should be regarded as a code template only.
414 // It will require modifications to work:
415 // - It may require correct/in-range values for request initialization.
416 // - It may require specifying regional endpoints when creating the service client as shown in:
417 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
418 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
419 if err != nil {
420 // TODO: Handle error.
421 }
422 defer c.Close()
423
424 req := &schemaregistrypb.GetSchemaRegistryRequest{
425 // TODO: Fill request struct fields.
426 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#GetSchemaRegistryRequest.
427 }
428 resp, err := c.GetSchemaRegistry(ctx, req)
429 if err != nil {
430 // TODO: Handle error.
431 }
432 // TODO: Use resp.
433 _ = resp
434 }
435
436 func ExampleManagedSchemaRegistryClient_GetVersion() {
437 ctx := context.Background()
438 // This snippet has been automatically generated and should be regarded as a code template only.
439 // It will require modifications to work:
440 // - It may require correct/in-range values for request initialization.
441 // - It may require specifying regional endpoints when creating the service client as shown in:
442 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
443 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
444 if err != nil {
445 // TODO: Handle error.
446 }
447 defer c.Close()
448
449 req := &schemaregistrypb.GetVersionRequest{
450 // TODO: Fill request struct fields.
451 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#GetVersionRequest.
452 }
453 resp, err := c.GetVersion(ctx, req)
454 if err != nil {
455 // TODO: Handle error.
456 }
457 // TODO: Use resp.
458 _ = resp
459 }
460
461 func ExampleManagedSchemaRegistryClient_ListContexts() {
462 ctx := context.Background()
463 // This snippet has been automatically generated and should be regarded as a code template only.
464 // It will require modifications to work:
465 // - It may require correct/in-range values for request initialization.
466 // - It may require specifying regional endpoints when creating the service client as shown in:
467 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
468 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
469 if err != nil {
470 // TODO: Handle error.
471 }
472 defer c.Close()
473
474 req := &schemaregistrypb.ListContextsRequest{
475 // TODO: Fill request struct fields.
476 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#ListContextsRequest.
477 }
478 resp, err := c.ListContexts(ctx, req)
479 if err != nil {
480 // TODO: Handle error.
481 }
482 // TODO: Use resp.
483 _ = resp
484 }
485
486 func ExampleManagedSchemaRegistryClient_ListReferencedSchemas() {
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 := schemaregistry.NewManagedSchemaRegistryClient(ctx)
494 if err != nil {
495 // TODO: Handle error.
496 }
497 defer c.Close()
498
499 req := &schemaregistrypb.ListReferencedSchemasRequest{
500 // TODO: Fill request struct fields.
501 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#ListReferencedSchemasRequest.
502 }
503 resp, err := c.ListReferencedSchemas(ctx, req)
504 if err != nil {
505 // TODO: Handle error.
506 }
507 // TODO: Use resp.
508 _ = resp
509 }
510
511 func ExampleManagedSchemaRegistryClient_ListSchemaRegistries() {
512 ctx := context.Background()
513 // This snippet has been automatically generated and should be regarded as a code template only.
514 // It will require modifications to work:
515 // - It may require correct/in-range values for request initialization.
516 // - It may require specifying regional endpoints when creating the service client as shown in:
517 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
518 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
519 if err != nil {
520 // TODO: Handle error.
521 }
522 defer c.Close()
523
524 req := &schemaregistrypb.ListSchemaRegistriesRequest{
525 // TODO: Fill request struct fields.
526 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#ListSchemaRegistriesRequest.
527 }
528 resp, err := c.ListSchemaRegistries(ctx, req)
529 if err != nil {
530 // TODO: Handle error.
531 }
532 // TODO: Use resp.
533 _ = resp
534 }
535
536 func ExampleManagedSchemaRegistryClient_ListSchemaTypes() {
537 ctx := context.Background()
538 // This snippet has been automatically generated and should be regarded as a code template only.
539 // It will require modifications to work:
540 // - It may require correct/in-range values for request initialization.
541 // - It may require specifying regional endpoints when creating the service client as shown in:
542 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
543 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
544 if err != nil {
545 // TODO: Handle error.
546 }
547 defer c.Close()
548
549 req := &schemaregistrypb.ListSchemaTypesRequest{
550 // TODO: Fill request struct fields.
551 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#ListSchemaTypesRequest.
552 }
553 resp, err := c.ListSchemaTypes(ctx, req)
554 if err != nil {
555 // TODO: Handle error.
556 }
557 // TODO: Use resp.
558 _ = resp
559 }
560
561 func ExampleManagedSchemaRegistryClient_ListSchemaVersions() {
562 ctx := context.Background()
563 // This snippet has been automatically generated and should be regarded as a code template only.
564 // It will require modifications to work:
565 // - It may require correct/in-range values for request initialization.
566 // - It may require specifying regional endpoints when creating the service client as shown in:
567 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
568 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
569 if err != nil {
570 // TODO: Handle error.
571 }
572 defer c.Close()
573
574 req := &schemaregistrypb.ListSchemaVersionsRequest{
575 // TODO: Fill request struct fields.
576 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#ListSchemaVersionsRequest.
577 }
578 resp, err := c.ListSchemaVersions(ctx, req)
579 if err != nil {
580 // TODO: Handle error.
581 }
582 // TODO: Use resp.
583 _ = resp
584 }
585
586 func ExampleManagedSchemaRegistryClient_ListSubjects() {
587 ctx := context.Background()
588 // This snippet has been automatically generated and should be regarded as a code template only.
589 // It will require modifications to work:
590 // - It may require correct/in-range values for request initialization.
591 // - It may require specifying regional endpoints when creating the service client as shown in:
592 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
593 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
594 if err != nil {
595 // TODO: Handle error.
596 }
597 defer c.Close()
598
599 req := &schemaregistrypb.ListSubjectsRequest{
600 // TODO: Fill request struct fields.
601 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#ListSubjectsRequest.
602 }
603 resp, err := c.ListSubjects(ctx, req)
604 if err != nil {
605 // TODO: Handle error.
606 }
607 // TODO: Use resp.
608 _ = resp
609 }
610
611 func ExampleManagedSchemaRegistryClient_ListSubjectsBySchemaId() {
612 ctx := context.Background()
613 // This snippet has been automatically generated and should be regarded as a code template only.
614 // It will require modifications to work:
615 // - It may require correct/in-range values for request initialization.
616 // - It may require specifying regional endpoints when creating the service client as shown in:
617 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
618 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
619 if err != nil {
620 // TODO: Handle error.
621 }
622 defer c.Close()
623
624 req := &schemaregistrypb.ListSubjectsBySchemaIdRequest{
625 // TODO: Fill request struct fields.
626 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#ListSubjectsBySchemaIdRequest.
627 }
628 resp, err := c.ListSubjectsBySchemaId(ctx, req)
629 if err != nil {
630 // TODO: Handle error.
631 }
632 // TODO: Use resp.
633 _ = resp
634 }
635
636 func ExampleManagedSchemaRegistryClient_ListVersions() {
637 ctx := context.Background()
638 // This snippet has been automatically generated and should be regarded as a code template only.
639 // It will require modifications to work:
640 // - It may require correct/in-range values for request initialization.
641 // - It may require specifying regional endpoints when creating the service client as shown in:
642 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
643 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
644 if err != nil {
645 // TODO: Handle error.
646 }
647 defer c.Close()
648
649 req := &schemaregistrypb.ListVersionsRequest{
650 // TODO: Fill request struct fields.
651 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#ListVersionsRequest.
652 }
653 resp, err := c.ListVersions(ctx, req)
654 if err != nil {
655 // TODO: Handle error.
656 }
657 // TODO: Use resp.
658 _ = resp
659 }
660
661 func ExampleManagedSchemaRegistryClient_LookupVersion() {
662 ctx := context.Background()
663 // This snippet has been automatically generated and should be regarded as a code template only.
664 // It will require modifications to work:
665 // - It may require correct/in-range values for request initialization.
666 // - It may require specifying regional endpoints when creating the service client as shown in:
667 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
668 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
669 if err != nil {
670 // TODO: Handle error.
671 }
672 defer c.Close()
673
674 req := &schemaregistrypb.LookupVersionRequest{
675 // TODO: Fill request struct fields.
676 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#LookupVersionRequest.
677 }
678 resp, err := c.LookupVersion(ctx, req)
679 if err != nil {
680 // TODO: Handle error.
681 }
682 // TODO: Use resp.
683 _ = resp
684 }
685
686 func ExampleManagedSchemaRegistryClient_UpdateSchemaConfig() {
687 ctx := context.Background()
688 // This snippet has been automatically generated and should be regarded as a code template only.
689 // It will require modifications to work:
690 // - It may require correct/in-range values for request initialization.
691 // - It may require specifying regional endpoints when creating the service client as shown in:
692 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
693 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
694 if err != nil {
695 // TODO: Handle error.
696 }
697 defer c.Close()
698
699 req := &schemaregistrypb.UpdateSchemaConfigRequest{
700 // TODO: Fill request struct fields.
701 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#UpdateSchemaConfigRequest.
702 }
703 resp, err := c.UpdateSchemaConfig(ctx, req)
704 if err != nil {
705 // TODO: Handle error.
706 }
707 // TODO: Use resp.
708 _ = resp
709 }
710
711 func ExampleManagedSchemaRegistryClient_UpdateSchemaMode() {
712 ctx := context.Background()
713 // This snippet has been automatically generated and should be regarded as a code template only.
714 // It will require modifications to work:
715 // - It may require correct/in-range values for request initialization.
716 // - It may require specifying regional endpoints when creating the service client as shown in:
717 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
718 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
719 if err != nil {
720 // TODO: Handle error.
721 }
722 defer c.Close()
723
724 req := &schemaregistrypb.UpdateSchemaModeRequest{
725 // TODO: Fill request struct fields.
726 // See https://pkg.go.dev/cloud.google.com/go/managedkafka/schemaregistry/apiv1/schemaregistrypb#UpdateSchemaModeRequest.
727 }
728 resp, err := c.UpdateSchemaMode(ctx, req)
729 if err != nil {
730 // TODO: Handle error.
731 }
732 // TODO: Use resp.
733 _ = resp
734 }
735
736 func ExampleManagedSchemaRegistryClient_GetLocation() {
737 ctx := context.Background()
738 // This snippet has been automatically generated and should be regarded as a code template only.
739 // It will require modifications to work:
740 // - It may require correct/in-range values for request initialization.
741 // - It may require specifying regional endpoints when creating the service client as shown in:
742 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
743 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
744 if err != nil {
745 // TODO: Handle error.
746 }
747 defer c.Close()
748
749 req := &locationpb.GetLocationRequest{
750 // TODO: Fill request struct fields.
751 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
752 }
753 resp, err := c.GetLocation(ctx, req)
754 if err != nil {
755 // TODO: Handle error.
756 }
757 // TODO: Use resp.
758 _ = resp
759 }
760
761 func ExampleManagedSchemaRegistryClient_ListLocations() {
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 := schemaregistry.NewManagedSchemaRegistryClient(ctx)
769 if err != nil {
770 // TODO: Handle error.
771 }
772 defer c.Close()
773
774 req := &locationpb.ListLocationsRequest{
775 // TODO: Fill request struct fields.
776 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
777 }
778 it := c.ListLocations(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.(*locationpb.ListLocationsResponse)
795 }
796 }
797
798 func ExampleManagedSchemaRegistryClient_CancelOperation() {
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 := schemaregistry.NewManagedSchemaRegistryClient(ctx)
806 if err != nil {
807 // TODO: Handle error.
808 }
809 defer c.Close()
810
811 req := &longrunningpb.CancelOperationRequest{
812 // TODO: Fill request struct fields.
813 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
814 }
815 err = c.CancelOperation(ctx, req)
816 if err != nil {
817 // TODO: Handle error.
818 }
819 }
820
821 func ExampleManagedSchemaRegistryClient_DeleteOperation() {
822 ctx := context.Background()
823 // This snippet has been automatically generated and should be regarded as a code template only.
824 // It will require modifications to work:
825 // - It may require correct/in-range values for request initialization.
826 // - It may require specifying regional endpoints when creating the service client as shown in:
827 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
828 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
829 if err != nil {
830 // TODO: Handle error.
831 }
832 defer c.Close()
833
834 req := &longrunningpb.DeleteOperationRequest{
835 // TODO: Fill request struct fields.
836 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
837 }
838 err = c.DeleteOperation(ctx, req)
839 if err != nil {
840 // TODO: Handle error.
841 }
842 }
843
844 func ExampleManagedSchemaRegistryClient_GetOperation() {
845 ctx := context.Background()
846 // This snippet has been automatically generated and should be regarded as a code template only.
847 // It will require modifications to work:
848 // - It may require correct/in-range values for request initialization.
849 // - It may require specifying regional endpoints when creating the service client as shown in:
850 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
851 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
852 if err != nil {
853 // TODO: Handle error.
854 }
855 defer c.Close()
856
857 req := &longrunningpb.GetOperationRequest{
858 // TODO: Fill request struct fields.
859 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
860 }
861 resp, err := c.GetOperation(ctx, req)
862 if err != nil {
863 // TODO: Handle error.
864 }
865 // TODO: Use resp.
866 _ = resp
867 }
868
869 func ExampleManagedSchemaRegistryClient_ListOperations() {
870 ctx := context.Background()
871 // This snippet has been automatically generated and should be regarded as a code template only.
872 // It will require modifications to work:
873 // - It may require correct/in-range values for request initialization.
874 // - It may require specifying regional endpoints when creating the service client as shown in:
875 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
876 c, err := schemaregistry.NewManagedSchemaRegistryClient(ctx)
877 if err != nil {
878 // TODO: Handle error.
879 }
880 defer c.Close()
881
882 req := &longrunningpb.ListOperationsRequest{
883 // TODO: Fill request struct fields.
884 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
885 }
886 it := c.ListOperations(ctx, req)
887 for {
888 resp, err := it.Next()
889 if err == iterator.Done {
890 break
891 }
892 if err != nil {
893 // TODO: Handle error.
894 }
895 // TODO: Use resp.
896 _ = resp
897
898 // If you need to access the underlying RPC response,
899 // you can do so by casting the `Response` as below.
900 // Otherwise, remove this line. Only populated after
901 // first call to Next(). Not safe for concurrent access.
902 _ = it.Response.(*longrunningpb.ListOperationsResponse)
903 }
904 }