Debian Codegraph @

apigeeregistry/apiv1/registry_client_example_test.go

raw
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 apigeeregistry_test
18
19 import (
20 "context"
21
22 apigeeregistry "cloud.google.com/go/apigeeregistry/apiv1"
23 apigeeregistrypb "cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb"
24 iampb "cloud.google.com/go/iam/apiv1/iampb"
25 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
26 "google.golang.org/api/iterator"
27 locationpb "google.golang.org/genproto/googleapis/cloud/location"
28 )
29
30 func ExampleNewRegistryClient() {
31 ctx := context.Background()
32 // This snippet has been automatically generated and should be regarded as a code template only.
33 // It will require modifications to work:
34 // - It may require correct/in-range values for request initialization.
35 // - It may require specifying regional endpoints when creating the service client as shown in:
36 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
37 c, err := apigeeregistry.NewRegistryClient(ctx)
38 if err != nil {
39 // TODO: Handle error.
40 }
41 defer c.Close()
42
43 // TODO: Use client.
44 _ = c
45 }
46
47 func ExampleRegistryClient_CreateApi() {
48 ctx := context.Background()
49 // This snippet has been automatically generated and should be regarded as a code template only.
50 // It will require modifications to work:
51 // - It may require correct/in-range values for request initialization.
52 // - It may require specifying regional endpoints when creating the service client as shown in:
53 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
54 c, err := apigeeregistry.NewRegistryClient(ctx)
55 if err != nil {
56 // TODO: Handle error.
57 }
58 defer c.Close()
59
60 req := &apigeeregistrypb.CreateApiRequest{
61 // TODO: Fill request struct fields.
62 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#CreateApiRequest.
63 }
64 resp, err := c.CreateApi(ctx, req)
65 if err != nil {
66 // TODO: Handle error.
67 }
68 // TODO: Use resp.
69 _ = resp
70 }
71
72 func ExampleRegistryClient_CreateApiDeployment() {
73 ctx := context.Background()
74 // This snippet has been automatically generated and should be regarded as a code template only.
75 // It will require modifications to work:
76 // - It may require correct/in-range values for request initialization.
77 // - It may require specifying regional endpoints when creating the service client as shown in:
78 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
79 c, err := apigeeregistry.NewRegistryClient(ctx)
80 if err != nil {
81 // TODO: Handle error.
82 }
83 defer c.Close()
84
85 req := &apigeeregistrypb.CreateApiDeploymentRequest{
86 // TODO: Fill request struct fields.
87 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#CreateApiDeploymentRequest.
88 }
89 resp, err := c.CreateApiDeployment(ctx, req)
90 if err != nil {
91 // TODO: Handle error.
92 }
93 // TODO: Use resp.
94 _ = resp
95 }
96
97 func ExampleRegistryClient_CreateApiSpec() {
98 ctx := context.Background()
99 // This snippet has been automatically generated and should be regarded as a code template only.
100 // It will require modifications to work:
101 // - It may require correct/in-range values for request initialization.
102 // - It may require specifying regional endpoints when creating the service client as shown in:
103 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
104 c, err := apigeeregistry.NewRegistryClient(ctx)
105 if err != nil {
106 // TODO: Handle error.
107 }
108 defer c.Close()
109
110 req := &apigeeregistrypb.CreateApiSpecRequest{
111 // TODO: Fill request struct fields.
112 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#CreateApiSpecRequest.
113 }
114 resp, err := c.CreateApiSpec(ctx, req)
115 if err != nil {
116 // TODO: Handle error.
117 }
118 // TODO: Use resp.
119 _ = resp
120 }
121
122 func ExampleRegistryClient_CreateApiVersion() {
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 := apigeeregistry.NewRegistryClient(ctx)
130 if err != nil {
131 // TODO: Handle error.
132 }
133 defer c.Close()
134
135 req := &apigeeregistrypb.CreateApiVersionRequest{
136 // TODO: Fill request struct fields.
137 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#CreateApiVersionRequest.
138 }
139 resp, err := c.CreateApiVersion(ctx, req)
140 if err != nil {
141 // TODO: Handle error.
142 }
143 // TODO: Use resp.
144 _ = resp
145 }
146
147 func ExampleRegistryClient_CreateArtifact() {
148 ctx := context.Background()
149 // This snippet has been automatically generated and should be regarded as a code template only.
150 // It will require modifications to work:
151 // - It may require correct/in-range values for request initialization.
152 // - It may require specifying regional endpoints when creating the service client as shown in:
153 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
154 c, err := apigeeregistry.NewRegistryClient(ctx)
155 if err != nil {
156 // TODO: Handle error.
157 }
158 defer c.Close()
159
160 req := &apigeeregistrypb.CreateArtifactRequest{
161 // TODO: Fill request struct fields.
162 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#CreateArtifactRequest.
163 }
164 resp, err := c.CreateArtifact(ctx, req)
165 if err != nil {
166 // TODO: Handle error.
167 }
168 // TODO: Use resp.
169 _ = resp
170 }
171
172 func ExampleRegistryClient_DeleteApi() {
173 ctx := context.Background()
174 // This snippet has been automatically generated and should be regarded as a code template only.
175 // It will require modifications to work:
176 // - It may require correct/in-range values for request initialization.
177 // - It may require specifying regional endpoints when creating the service client as shown in:
178 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
179 c, err := apigeeregistry.NewRegistryClient(ctx)
180 if err != nil {
181 // TODO: Handle error.
182 }
183 defer c.Close()
184
185 req := &apigeeregistrypb.DeleteApiRequest{
186 // TODO: Fill request struct fields.
187 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#DeleteApiRequest.
188 }
189 err = c.DeleteApi(ctx, req)
190 if err != nil {
191 // TODO: Handle error.
192 }
193 }
194
195 func ExampleRegistryClient_DeleteApiDeployment() {
196 ctx := context.Background()
197 // This snippet has been automatically generated and should be regarded as a code template only.
198 // It will require modifications to work:
199 // - It may require correct/in-range values for request initialization.
200 // - It may require specifying regional endpoints when creating the service client as shown in:
201 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
202 c, err := apigeeregistry.NewRegistryClient(ctx)
203 if err != nil {
204 // TODO: Handle error.
205 }
206 defer c.Close()
207
208 req := &apigeeregistrypb.DeleteApiDeploymentRequest{
209 // TODO: Fill request struct fields.
210 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#DeleteApiDeploymentRequest.
211 }
212 err = c.DeleteApiDeployment(ctx, req)
213 if err != nil {
214 // TODO: Handle error.
215 }
216 }
217
218 func ExampleRegistryClient_DeleteApiDeploymentRevision() {
219 ctx := context.Background()
220 // This snippet has been automatically generated and should be regarded as a code template only.
221 // It will require modifications to work:
222 // - It may require correct/in-range values for request initialization.
223 // - It may require specifying regional endpoints when creating the service client as shown in:
224 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
225 c, err := apigeeregistry.NewRegistryClient(ctx)
226 if err != nil {
227 // TODO: Handle error.
228 }
229 defer c.Close()
230
231 req := &apigeeregistrypb.DeleteApiDeploymentRevisionRequest{
232 // TODO: Fill request struct fields.
233 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#DeleteApiDeploymentRevisionRequest.
234 }
235 resp, err := c.DeleteApiDeploymentRevision(ctx, req)
236 if err != nil {
237 // TODO: Handle error.
238 }
239 // TODO: Use resp.
240 _ = resp
241 }
242
243 func ExampleRegistryClient_DeleteApiSpec() {
244 ctx := context.Background()
245 // This snippet has been automatically generated and should be regarded as a code template only.
246 // It will require modifications to work:
247 // - It may require correct/in-range values for request initialization.
248 // - It may require specifying regional endpoints when creating the service client as shown in:
249 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
250 c, err := apigeeregistry.NewRegistryClient(ctx)
251 if err != nil {
252 // TODO: Handle error.
253 }
254 defer c.Close()
255
256 req := &apigeeregistrypb.DeleteApiSpecRequest{
257 // TODO: Fill request struct fields.
258 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#DeleteApiSpecRequest.
259 }
260 err = c.DeleteApiSpec(ctx, req)
261 if err != nil {
262 // TODO: Handle error.
263 }
264 }
265
266 func ExampleRegistryClient_DeleteApiSpecRevision() {
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 := apigeeregistry.NewRegistryClient(ctx)
274 if err != nil {
275 // TODO: Handle error.
276 }
277 defer c.Close()
278
279 req := &apigeeregistrypb.DeleteApiSpecRevisionRequest{
280 // TODO: Fill request struct fields.
281 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#DeleteApiSpecRevisionRequest.
282 }
283 resp, err := c.DeleteApiSpecRevision(ctx, req)
284 if err != nil {
285 // TODO: Handle error.
286 }
287 // TODO: Use resp.
288 _ = resp
289 }
290
291 func ExampleRegistryClient_DeleteApiVersion() {
292 ctx := context.Background()
293 // This snippet has been automatically generated and should be regarded as a code template only.
294 // It will require modifications to work:
295 // - It may require correct/in-range values for request initialization.
296 // - It may require specifying regional endpoints when creating the service client as shown in:
297 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
298 c, err := apigeeregistry.NewRegistryClient(ctx)
299 if err != nil {
300 // TODO: Handle error.
301 }
302 defer c.Close()
303
304 req := &apigeeregistrypb.DeleteApiVersionRequest{
305 // TODO: Fill request struct fields.
306 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#DeleteApiVersionRequest.
307 }
308 err = c.DeleteApiVersion(ctx, req)
309 if err != nil {
310 // TODO: Handle error.
311 }
312 }
313
314 func ExampleRegistryClient_DeleteArtifact() {
315 ctx := context.Background()
316 // This snippet has been automatically generated and should be regarded as a code template only.
317 // It will require modifications to work:
318 // - It may require correct/in-range values for request initialization.
319 // - It may require specifying regional endpoints when creating the service client as shown in:
320 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
321 c, err := apigeeregistry.NewRegistryClient(ctx)
322 if err != nil {
323 // TODO: Handle error.
324 }
325 defer c.Close()
326
327 req := &apigeeregistrypb.DeleteArtifactRequest{
328 // TODO: Fill request struct fields.
329 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#DeleteArtifactRequest.
330 }
331 err = c.DeleteArtifact(ctx, req)
332 if err != nil {
333 // TODO: Handle error.
334 }
335 }
336
337 func ExampleRegistryClient_GetApi() {
338 ctx := context.Background()
339 // This snippet has been automatically generated and should be regarded as a code template only.
340 // It will require modifications to work:
341 // - It may require correct/in-range values for request initialization.
342 // - It may require specifying regional endpoints when creating the service client as shown in:
343 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
344 c, err := apigeeregistry.NewRegistryClient(ctx)
345 if err != nil {
346 // TODO: Handle error.
347 }
348 defer c.Close()
349
350 req := &apigeeregistrypb.GetApiRequest{
351 // TODO: Fill request struct fields.
352 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#GetApiRequest.
353 }
354 resp, err := c.GetApi(ctx, req)
355 if err != nil {
356 // TODO: Handle error.
357 }
358 // TODO: Use resp.
359 _ = resp
360 }
361
362 func ExampleRegistryClient_GetApiDeployment() {
363 ctx := context.Background()
364 // This snippet has been automatically generated and should be regarded as a code template only.
365 // It will require modifications to work:
366 // - It may require correct/in-range values for request initialization.
367 // - It may require specifying regional endpoints when creating the service client as shown in:
368 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
369 c, err := apigeeregistry.NewRegistryClient(ctx)
370 if err != nil {
371 // TODO: Handle error.
372 }
373 defer c.Close()
374
375 req := &apigeeregistrypb.GetApiDeploymentRequest{
376 // TODO: Fill request struct fields.
377 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#GetApiDeploymentRequest.
378 }
379 resp, err := c.GetApiDeployment(ctx, req)
380 if err != nil {
381 // TODO: Handle error.
382 }
383 // TODO: Use resp.
384 _ = resp
385 }
386
387 func ExampleRegistryClient_GetApiSpec() {
388 ctx := context.Background()
389 // This snippet has been automatically generated and should be regarded as a code template only.
390 // It will require modifications to work:
391 // - It may require correct/in-range values for request initialization.
392 // - It may require specifying regional endpoints when creating the service client as shown in:
393 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
394 c, err := apigeeregistry.NewRegistryClient(ctx)
395 if err != nil {
396 // TODO: Handle error.
397 }
398 defer c.Close()
399
400 req := &apigeeregistrypb.GetApiSpecRequest{
401 // TODO: Fill request struct fields.
402 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#GetApiSpecRequest.
403 }
404 resp, err := c.GetApiSpec(ctx, req)
405 if err != nil {
406 // TODO: Handle error.
407 }
408 // TODO: Use resp.
409 _ = resp
410 }
411
412 func ExampleRegistryClient_GetApiSpecContents() {
413 ctx := context.Background()
414 // This snippet has been automatically generated and should be regarded as a code template only.
415 // It will require modifications to work:
416 // - It may require correct/in-range values for request initialization.
417 // - It may require specifying regional endpoints when creating the service client as shown in:
418 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
419 c, err := apigeeregistry.NewRegistryClient(ctx)
420 if err != nil {
421 // TODO: Handle error.
422 }
423 defer c.Close()
424
425 req := &apigeeregistrypb.GetApiSpecContentsRequest{
426 // TODO: Fill request struct fields.
427 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#GetApiSpecContentsRequest.
428 }
429 resp, err := c.GetApiSpecContents(ctx, req)
430 if err != nil {
431 // TODO: Handle error.
432 }
433 // TODO: Use resp.
434 _ = resp
435 }
436
437 func ExampleRegistryClient_GetApiVersion() {
438 ctx := context.Background()
439 // This snippet has been automatically generated and should be regarded as a code template only.
440 // It will require modifications to work:
441 // - It may require correct/in-range values for request initialization.
442 // - It may require specifying regional endpoints when creating the service client as shown in:
443 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
444 c, err := apigeeregistry.NewRegistryClient(ctx)
445 if err != nil {
446 // TODO: Handle error.
447 }
448 defer c.Close()
449
450 req := &apigeeregistrypb.GetApiVersionRequest{
451 // TODO: Fill request struct fields.
452 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#GetApiVersionRequest.
453 }
454 resp, err := c.GetApiVersion(ctx, req)
455 if err != nil {
456 // TODO: Handle error.
457 }
458 // TODO: Use resp.
459 _ = resp
460 }
461
462 func ExampleRegistryClient_GetArtifact() {
463 ctx := context.Background()
464 // This snippet has been automatically generated and should be regarded as a code template only.
465 // It will require modifications to work:
466 // - It may require correct/in-range values for request initialization.
467 // - It may require specifying regional endpoints when creating the service client as shown in:
468 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
469 c, err := apigeeregistry.NewRegistryClient(ctx)
470 if err != nil {
471 // TODO: Handle error.
472 }
473 defer c.Close()
474
475 req := &apigeeregistrypb.GetArtifactRequest{
476 // TODO: Fill request struct fields.
477 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#GetArtifactRequest.
478 }
479 resp, err := c.GetArtifact(ctx, req)
480 if err != nil {
481 // TODO: Handle error.
482 }
483 // TODO: Use resp.
484 _ = resp
485 }
486
487 func ExampleRegistryClient_GetArtifactContents() {
488 ctx := context.Background()
489 // This snippet has been automatically generated and should be regarded as a code template only.
490 // It will require modifications to work:
491 // - It may require correct/in-range values for request initialization.
492 // - It may require specifying regional endpoints when creating the service client as shown in:
493 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
494 c, err := apigeeregistry.NewRegistryClient(ctx)
495 if err != nil {
496 // TODO: Handle error.
497 }
498 defer c.Close()
499
500 req := &apigeeregistrypb.GetArtifactContentsRequest{
501 // TODO: Fill request struct fields.
502 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#GetArtifactContentsRequest.
503 }
504 resp, err := c.GetArtifactContents(ctx, req)
505 if err != nil {
506 // TODO: Handle error.
507 }
508 // TODO: Use resp.
509 _ = resp
510 }
511
512 func ExampleRegistryClient_ListApiDeploymentRevisions() {
513 ctx := context.Background()
514 // This snippet has been automatically generated and should be regarded as a code template only.
515 // It will require modifications to work:
516 // - It may require correct/in-range values for request initialization.
517 // - It may require specifying regional endpoints when creating the service client as shown in:
518 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
519 c, err := apigeeregistry.NewRegistryClient(ctx)
520 if err != nil {
521 // TODO: Handle error.
522 }
523 defer c.Close()
524
525 req := &apigeeregistrypb.ListApiDeploymentRevisionsRequest{
526 // TODO: Fill request struct fields.
527 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#ListApiDeploymentRevisionsRequest.
528 }
529 it := c.ListApiDeploymentRevisions(ctx, req)
530 for {
531 resp, err := it.Next()
532 if err == iterator.Done {
533 break
534 }
535 if err != nil {
536 // TODO: Handle error.
537 }
538 // TODO: Use resp.
539 _ = resp
540
541 // If you need to access the underlying RPC response,
542 // you can do so by casting the `Response` as below.
543 // Otherwise, remove this line. Only populated after
544 // first call to Next(). Not safe for concurrent access.
545 _ = it.Response.(*apigeeregistrypb.ListApiDeploymentRevisionsResponse)
546 }
547 }
548
549 func ExampleRegistryClient_ListApiDeployments() {
550 ctx := context.Background()
551 // This snippet has been automatically generated and should be regarded as a code template only.
552 // It will require modifications to work:
553 // - It may require correct/in-range values for request initialization.
554 // - It may require specifying regional endpoints when creating the service client as shown in:
555 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
556 c, err := apigeeregistry.NewRegistryClient(ctx)
557 if err != nil {
558 // TODO: Handle error.
559 }
560 defer c.Close()
561
562 req := &apigeeregistrypb.ListApiDeploymentsRequest{
563 // TODO: Fill request struct fields.
564 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#ListApiDeploymentsRequest.
565 }
566 it := c.ListApiDeployments(ctx, req)
567 for {
568 resp, err := it.Next()
569 if err == iterator.Done {
570 break
571 }
572 if err != nil {
573 // TODO: Handle error.
574 }
575 // TODO: Use resp.
576 _ = resp
577
578 // If you need to access the underlying RPC response,
579 // you can do so by casting the `Response` as below.
580 // Otherwise, remove this line. Only populated after
581 // first call to Next(). Not safe for concurrent access.
582 _ = it.Response.(*apigeeregistrypb.ListApiDeploymentsResponse)
583 }
584 }
585
586 func ExampleRegistryClient_ListApiSpecRevisions() {
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 := apigeeregistry.NewRegistryClient(ctx)
594 if err != nil {
595 // TODO: Handle error.
596 }
597 defer c.Close()
598
599 req := &apigeeregistrypb.ListApiSpecRevisionsRequest{
600 // TODO: Fill request struct fields.
601 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#ListApiSpecRevisionsRequest.
602 }
603 it := c.ListApiSpecRevisions(ctx, req)
604 for {
605 resp, err := it.Next()
606 if err == iterator.Done {
607 break
608 }
609 if err != nil {
610 // TODO: Handle error.
611 }
612 // TODO: Use resp.
613 _ = resp
614
615 // If you need to access the underlying RPC response,
616 // you can do so by casting the `Response` as below.
617 // Otherwise, remove this line. Only populated after
618 // first call to Next(). Not safe for concurrent access.
619 _ = it.Response.(*apigeeregistrypb.ListApiSpecRevisionsResponse)
620 }
621 }
622
623 func ExampleRegistryClient_ListApiSpecs() {
624 ctx := context.Background()
625 // This snippet has been automatically generated and should be regarded as a code template only.
626 // It will require modifications to work:
627 // - It may require correct/in-range values for request initialization.
628 // - It may require specifying regional endpoints when creating the service client as shown in:
629 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
630 c, err := apigeeregistry.NewRegistryClient(ctx)
631 if err != nil {
632 // TODO: Handle error.
633 }
634 defer c.Close()
635
636 req := &apigeeregistrypb.ListApiSpecsRequest{
637 // TODO: Fill request struct fields.
638 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#ListApiSpecsRequest.
639 }
640 it := c.ListApiSpecs(ctx, req)
641 for {
642 resp, err := it.Next()
643 if err == iterator.Done {
644 break
645 }
646 if err != nil {
647 // TODO: Handle error.
648 }
649 // TODO: Use resp.
650 _ = resp
651
652 // If you need to access the underlying RPC response,
653 // you can do so by casting the `Response` as below.
654 // Otherwise, remove this line. Only populated after
655 // first call to Next(). Not safe for concurrent access.
656 _ = it.Response.(*apigeeregistrypb.ListApiSpecsResponse)
657 }
658 }
659
660 func ExampleRegistryClient_ListApiVersions() {
661 ctx := context.Background()
662 // This snippet has been automatically generated and should be regarded as a code template only.
663 // It will require modifications to work:
664 // - It may require correct/in-range values for request initialization.
665 // - It may require specifying regional endpoints when creating the service client as shown in:
666 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
667 c, err := apigeeregistry.NewRegistryClient(ctx)
668 if err != nil {
669 // TODO: Handle error.
670 }
671 defer c.Close()
672
673 req := &apigeeregistrypb.ListApiVersionsRequest{
674 // TODO: Fill request struct fields.
675 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#ListApiVersionsRequest.
676 }
677 it := c.ListApiVersions(ctx, req)
678 for {
679 resp, err := it.Next()
680 if err == iterator.Done {
681 break
682 }
683 if err != nil {
684 // TODO: Handle error.
685 }
686 // TODO: Use resp.
687 _ = resp
688
689 // If you need to access the underlying RPC response,
690 // you can do so by casting the `Response` as below.
691 // Otherwise, remove this line. Only populated after
692 // first call to Next(). Not safe for concurrent access.
693 _ = it.Response.(*apigeeregistrypb.ListApiVersionsResponse)
694 }
695 }
696
697 func ExampleRegistryClient_ListApis() {
698 ctx := context.Background()
699 // This snippet has been automatically generated and should be regarded as a code template only.
700 // It will require modifications to work:
701 // - It may require correct/in-range values for request initialization.
702 // - It may require specifying regional endpoints when creating the service client as shown in:
703 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
704 c, err := apigeeregistry.NewRegistryClient(ctx)
705 if err != nil {
706 // TODO: Handle error.
707 }
708 defer c.Close()
709
710 req := &apigeeregistrypb.ListApisRequest{
711 // TODO: Fill request struct fields.
712 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#ListApisRequest.
713 }
714 it := c.ListApis(ctx, req)
715 for {
716 resp, err := it.Next()
717 if err == iterator.Done {
718 break
719 }
720 if err != nil {
721 // TODO: Handle error.
722 }
723 // TODO: Use resp.
724 _ = resp
725
726 // If you need to access the underlying RPC response,
727 // you can do so by casting the `Response` as below.
728 // Otherwise, remove this line. Only populated after
729 // first call to Next(). Not safe for concurrent access.
730 _ = it.Response.(*apigeeregistrypb.ListApisResponse)
731 }
732 }
733
734 func ExampleRegistryClient_ListArtifacts() {
735 ctx := context.Background()
736 // This snippet has been automatically generated and should be regarded as a code template only.
737 // It will require modifications to work:
738 // - It may require correct/in-range values for request initialization.
739 // - It may require specifying regional endpoints when creating the service client as shown in:
740 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
741 c, err := apigeeregistry.NewRegistryClient(ctx)
742 if err != nil {
743 // TODO: Handle error.
744 }
745 defer c.Close()
746
747 req := &apigeeregistrypb.ListArtifactsRequest{
748 // TODO: Fill request struct fields.
749 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#ListArtifactsRequest.
750 }
751 it := c.ListArtifacts(ctx, req)
752 for {
753 resp, err := it.Next()
754 if err == iterator.Done {
755 break
756 }
757 if err != nil {
758 // TODO: Handle error.
759 }
760 // TODO: Use resp.
761 _ = resp
762
763 // If you need to access the underlying RPC response,
764 // you can do so by casting the `Response` as below.
765 // Otherwise, remove this line. Only populated after
766 // first call to Next(). Not safe for concurrent access.
767 _ = it.Response.(*apigeeregistrypb.ListArtifactsResponse)
768 }
769 }
770
771 func ExampleRegistryClient_ReplaceArtifact() {
772 ctx := context.Background()
773 // This snippet has been automatically generated and should be regarded as a code template only.
774 // It will require modifications to work:
775 // - It may require correct/in-range values for request initialization.
776 // - It may require specifying regional endpoints when creating the service client as shown in:
777 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
778 c, err := apigeeregistry.NewRegistryClient(ctx)
779 if err != nil {
780 // TODO: Handle error.
781 }
782 defer c.Close()
783
784 req := &apigeeregistrypb.ReplaceArtifactRequest{
785 // TODO: Fill request struct fields.
786 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#ReplaceArtifactRequest.
787 }
788 resp, err := c.ReplaceArtifact(ctx, req)
789 if err != nil {
790 // TODO: Handle error.
791 }
792 // TODO: Use resp.
793 _ = resp
794 }
795
796 func ExampleRegistryClient_RollbackApiDeployment() {
797 ctx := context.Background()
798 // This snippet has been automatically generated and should be regarded as a code template only.
799 // It will require modifications to work:
800 // - It may require correct/in-range values for request initialization.
801 // - It may require specifying regional endpoints when creating the service client as shown in:
802 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
803 c, err := apigeeregistry.NewRegistryClient(ctx)
804 if err != nil {
805 // TODO: Handle error.
806 }
807 defer c.Close()
808
809 req := &apigeeregistrypb.RollbackApiDeploymentRequest{
810 // TODO: Fill request struct fields.
811 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#RollbackApiDeploymentRequest.
812 }
813 resp, err := c.RollbackApiDeployment(ctx, req)
814 if err != nil {
815 // TODO: Handle error.
816 }
817 // TODO: Use resp.
818 _ = resp
819 }
820
821 func ExampleRegistryClient_RollbackApiSpec() {
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 := apigeeregistry.NewRegistryClient(ctx)
829 if err != nil {
830 // TODO: Handle error.
831 }
832 defer c.Close()
833
834 req := &apigeeregistrypb.RollbackApiSpecRequest{
835 // TODO: Fill request struct fields.
836 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#RollbackApiSpecRequest.
837 }
838 resp, err := c.RollbackApiSpec(ctx, req)
839 if err != nil {
840 // TODO: Handle error.
841 }
842 // TODO: Use resp.
843 _ = resp
844 }
845
846 func ExampleRegistryClient_TagApiDeploymentRevision() {
847 ctx := context.Background()
848 // This snippet has been automatically generated and should be regarded as a code template only.
849 // It will require modifications to work:
850 // - It may require correct/in-range values for request initialization.
851 // - It may require specifying regional endpoints when creating the service client as shown in:
852 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
853 c, err := apigeeregistry.NewRegistryClient(ctx)
854 if err != nil {
855 // TODO: Handle error.
856 }
857 defer c.Close()
858
859 req := &apigeeregistrypb.TagApiDeploymentRevisionRequest{
860 // TODO: Fill request struct fields.
861 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#TagApiDeploymentRevisionRequest.
862 }
863 resp, err := c.TagApiDeploymentRevision(ctx, req)
864 if err != nil {
865 // TODO: Handle error.
866 }
867 // TODO: Use resp.
868 _ = resp
869 }
870
871 func ExampleRegistryClient_TagApiSpecRevision() {
872 ctx := context.Background()
873 // This snippet has been automatically generated and should be regarded as a code template only.
874 // It will require modifications to work:
875 // - It may require correct/in-range values for request initialization.
876 // - It may require specifying regional endpoints when creating the service client as shown in:
877 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
878 c, err := apigeeregistry.NewRegistryClient(ctx)
879 if err != nil {
880 // TODO: Handle error.
881 }
882 defer c.Close()
883
884 req := &apigeeregistrypb.TagApiSpecRevisionRequest{
885 // TODO: Fill request struct fields.
886 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#TagApiSpecRevisionRequest.
887 }
888 resp, err := c.TagApiSpecRevision(ctx, req)
889 if err != nil {
890 // TODO: Handle error.
891 }
892 // TODO: Use resp.
893 _ = resp
894 }
895
896 func ExampleRegistryClient_UpdateApi() {
897 ctx := context.Background()
898 // This snippet has been automatically generated and should be regarded as a code template only.
899 // It will require modifications to work:
900 // - It may require correct/in-range values for request initialization.
901 // - It may require specifying regional endpoints when creating the service client as shown in:
902 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
903 c, err := apigeeregistry.NewRegistryClient(ctx)
904 if err != nil {
905 // TODO: Handle error.
906 }
907 defer c.Close()
908
909 req := &apigeeregistrypb.UpdateApiRequest{
910 // TODO: Fill request struct fields.
911 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#UpdateApiRequest.
912 }
913 resp, err := c.UpdateApi(ctx, req)
914 if err != nil {
915 // TODO: Handle error.
916 }
917 // TODO: Use resp.
918 _ = resp
919 }
920
921 func ExampleRegistryClient_UpdateApiDeployment() {
922 ctx := context.Background()
923 // This snippet has been automatically generated and should be regarded as a code template only.
924 // It will require modifications to work:
925 // - It may require correct/in-range values for request initialization.
926 // - It may require specifying regional endpoints when creating the service client as shown in:
927 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
928 c, err := apigeeregistry.NewRegistryClient(ctx)
929 if err != nil {
930 // TODO: Handle error.
931 }
932 defer c.Close()
933
934 req := &apigeeregistrypb.UpdateApiDeploymentRequest{
935 // TODO: Fill request struct fields.
936 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#UpdateApiDeploymentRequest.
937 }
938 resp, err := c.UpdateApiDeployment(ctx, req)
939 if err != nil {
940 // TODO: Handle error.
941 }
942 // TODO: Use resp.
943 _ = resp
944 }
945
946 func ExampleRegistryClient_UpdateApiSpec() {
947 ctx := context.Background()
948 // This snippet has been automatically generated and should be regarded as a code template only.
949 // It will require modifications to work:
950 // - It may require correct/in-range values for request initialization.
951 // - It may require specifying regional endpoints when creating the service client as shown in:
952 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
953 c, err := apigeeregistry.NewRegistryClient(ctx)
954 if err != nil {
955 // TODO: Handle error.
956 }
957 defer c.Close()
958
959 req := &apigeeregistrypb.UpdateApiSpecRequest{
960 // TODO: Fill request struct fields.
961 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#UpdateApiSpecRequest.
962 }
963 resp, err := c.UpdateApiSpec(ctx, req)
964 if err != nil {
965 // TODO: Handle error.
966 }
967 // TODO: Use resp.
968 _ = resp
969 }
970
971 func ExampleRegistryClient_UpdateApiVersion() {
972 ctx := context.Background()
973 // This snippet has been automatically generated and should be regarded as a code template only.
974 // It will require modifications to work:
975 // - It may require correct/in-range values for request initialization.
976 // - It may require specifying regional endpoints when creating the service client as shown in:
977 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
978 c, err := apigeeregistry.NewRegistryClient(ctx)
979 if err != nil {
980 // TODO: Handle error.
981 }
982 defer c.Close()
983
984 req := &apigeeregistrypb.UpdateApiVersionRequest{
985 // TODO: Fill request struct fields.
986 // See https://pkg.go.dev/cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb#UpdateApiVersionRequest.
987 }
988 resp, err := c.UpdateApiVersion(ctx, req)
989 if err != nil {
990 // TODO: Handle error.
991 }
992 // TODO: Use resp.
993 _ = resp
994 }
995
996 func ExampleRegistryClient_GetLocation() {
997 ctx := context.Background()
998 // This snippet has been automatically generated and should be regarded as a code template only.
999 // It will require modifications to work:
1000 // - It may require correct/in-range values for request initialization.
1001 // - It may require specifying regional endpoints when creating the service client as shown in:
1002 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1003 c, err := apigeeregistry.NewRegistryClient(ctx)
1004 if err != nil {
1005 // TODO: Handle error.
1006 }
1007 defer c.Close()
1008
1009 req := &locationpb.GetLocationRequest{
1010 // TODO: Fill request struct fields.
1011 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
1012 }
1013 resp, err := c.GetLocation(ctx, req)
1014 if err != nil {
1015 // TODO: Handle error.
1016 }
1017 // TODO: Use resp.
1018 _ = resp
1019 }
1020
1021 func ExampleRegistryClient_ListLocations() {
1022 ctx := context.Background()
1023 // This snippet has been automatically generated and should be regarded as a code template only.
1024 // It will require modifications to work:
1025 // - It may require correct/in-range values for request initialization.
1026 // - It may require specifying regional endpoints when creating the service client as shown in:
1027 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1028 c, err := apigeeregistry.NewRegistryClient(ctx)
1029 if err != nil {
1030 // TODO: Handle error.
1031 }
1032 defer c.Close()
1033
1034 req := &locationpb.ListLocationsRequest{
1035 // TODO: Fill request struct fields.
1036 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
1037 }
1038 it := c.ListLocations(ctx, req)
1039 for {
1040 resp, err := it.Next()
1041 if err == iterator.Done {
1042 break
1043 }
1044 if err != nil {
1045 // TODO: Handle error.
1046 }
1047 // TODO: Use resp.
1048 _ = resp
1049
1050 // If you need to access the underlying RPC response,
1051 // you can do so by casting the `Response` as below.
1052 // Otherwise, remove this line. Only populated after
1053 // first call to Next(). Not safe for concurrent access.
1054 _ = it.Response.(*locationpb.ListLocationsResponse)
1055 }
1056 }
1057
1058 func ExampleRegistryClient_GetIamPolicy() {
1059 ctx := context.Background()
1060 // This snippet has been automatically generated and should be regarded as a code template only.
1061 // It will require modifications to work:
1062 // - It may require correct/in-range values for request initialization.
1063 // - It may require specifying regional endpoints when creating the service client as shown in:
1064 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1065 c, err := apigeeregistry.NewRegistryClient(ctx)
1066 if err != nil {
1067 // TODO: Handle error.
1068 }
1069 defer c.Close()
1070
1071 req := &iampb.GetIamPolicyRequest{
1072 // TODO: Fill request struct fields.
1073 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
1074 }
1075 resp, err := c.GetIamPolicy(ctx, req)
1076 if err != nil {
1077 // TODO: Handle error.
1078 }
1079 // TODO: Use resp.
1080 _ = resp
1081 }
1082
1083 func ExampleRegistryClient_SetIamPolicy() {
1084 ctx := context.Background()
1085 // This snippet has been automatically generated and should be regarded as a code template only.
1086 // It will require modifications to work:
1087 // - It may require correct/in-range values for request initialization.
1088 // - It may require specifying regional endpoints when creating the service client as shown in:
1089 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1090 c, err := apigeeregistry.NewRegistryClient(ctx)
1091 if err != nil {
1092 // TODO: Handle error.
1093 }
1094 defer c.Close()
1095
1096 req := &iampb.SetIamPolicyRequest{
1097 // TODO: Fill request struct fields.
1098 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
1099 }
1100 resp, err := c.SetIamPolicy(ctx, req)
1101 if err != nil {
1102 // TODO: Handle error.
1103 }
1104 // TODO: Use resp.
1105 _ = resp
1106 }
1107
1108 func ExampleRegistryClient_TestIamPermissions() {
1109 ctx := context.Background()
1110 // This snippet has been automatically generated and should be regarded as a code template only.
1111 // It will require modifications to work:
1112 // - It may require correct/in-range values for request initialization.
1113 // - It may require specifying regional endpoints when creating the service client as shown in:
1114 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1115 c, err := apigeeregistry.NewRegistryClient(ctx)
1116 if err != nil {
1117 // TODO: Handle error.
1118 }
1119 defer c.Close()
1120
1121 req := &iampb.TestIamPermissionsRequest{
1122 // TODO: Fill request struct fields.
1123 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
1124 }
1125 resp, err := c.TestIamPermissions(ctx, req)
1126 if err != nil {
1127 // TODO: Handle error.
1128 }
1129 // TODO: Use resp.
1130 _ = resp
1131 }
1132
1133 func ExampleRegistryClient_CancelOperation() {
1134 ctx := context.Background()
1135 // This snippet has been automatically generated and should be regarded as a code template only.
1136 // It will require modifications to work:
1137 // - It may require correct/in-range values for request initialization.
1138 // - It may require specifying regional endpoints when creating the service client as shown in:
1139 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1140 c, err := apigeeregistry.NewRegistryClient(ctx)
1141 if err != nil {
1142 // TODO: Handle error.
1143 }
1144 defer c.Close()
1145
1146 req := &longrunningpb.CancelOperationRequest{
1147 // TODO: Fill request struct fields.
1148 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
1149 }
1150 err = c.CancelOperation(ctx, req)
1151 if err != nil {
1152 // TODO: Handle error.
1153 }
1154 }
1155
1156 func ExampleRegistryClient_DeleteOperation() {
1157 ctx := context.Background()
1158 // This snippet has been automatically generated and should be regarded as a code template only.
1159 // It will require modifications to work:
1160 // - It may require correct/in-range values for request initialization.
1161 // - It may require specifying regional endpoints when creating the service client as shown in:
1162 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1163 c, err := apigeeregistry.NewRegistryClient(ctx)
1164 if err != nil {
1165 // TODO: Handle error.
1166 }
1167 defer c.Close()
1168
1169 req := &longrunningpb.DeleteOperationRequest{
1170 // TODO: Fill request struct fields.
1171 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
1172 }
1173 err = c.DeleteOperation(ctx, req)
1174 if err != nil {
1175 // TODO: Handle error.
1176 }
1177 }
1178
1179 func ExampleRegistryClient_GetOperation() {
1180 ctx := context.Background()
1181 // This snippet has been automatically generated and should be regarded as a code template only.
1182 // It will require modifications to work:
1183 // - It may require correct/in-range values for request initialization.
1184 // - It may require specifying regional endpoints when creating the service client as shown in:
1185 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1186 c, err := apigeeregistry.NewRegistryClient(ctx)
1187 if err != nil {
1188 // TODO: Handle error.
1189 }
1190 defer c.Close()
1191
1192 req := &longrunningpb.GetOperationRequest{
1193 // TODO: Fill request struct fields.
1194 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
1195 }
1196 resp, err := c.GetOperation(ctx, req)
1197 if err != nil {
1198 // TODO: Handle error.
1199 }
1200 // TODO: Use resp.
1201 _ = resp
1202 }
1203
1204 func ExampleRegistryClient_ListOperations() {
1205 ctx := context.Background()
1206 // This snippet has been automatically generated and should be regarded as a code template only.
1207 // It will require modifications to work:
1208 // - It may require correct/in-range values for request initialization.
1209 // - It may require specifying regional endpoints when creating the service client as shown in:
1210 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1211 c, err := apigeeregistry.NewRegistryClient(ctx)
1212 if err != nil {
1213 // TODO: Handle error.
1214 }
1215 defer c.Close()
1216
1217 req := &longrunningpb.ListOperationsRequest{
1218 // TODO: Fill request struct fields.
1219 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
1220 }
1221 it := c.ListOperations(ctx, req)
1222 for {
1223 resp, err := it.Next()
1224 if err == iterator.Done {
1225 break
1226 }
1227 if err != nil {
1228 // TODO: Handle error.
1229 }
1230 // TODO: Use resp.
1231 _ = resp
1232
1233 // If you need to access the underlying RPC response,
1234 // you can do so by casting the `Response` as below.
1235 // Otherwise, remove this line. Only populated after
1236 // first call to Next(). Not safe for concurrent access.
1237 _ = it.Response.(*longrunningpb.ListOperationsResponse)
1238 }
1239 }