Debian Codegraph @

certificatemanager/apiv1/certificate_manager_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 certificatemanager_test
18
19 import (
20 "context"
21
22 certificatemanager "cloud.google.com/go/certificatemanager/apiv1"
23 certificatemanagerpb "cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb"
24 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
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 := certificatemanager.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 := certificatemanager.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_CreateCertificate() {
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 := certificatemanager.NewClient(ctx)
71 if err != nil {
72 // TODO: Handle error.
73 }
74 defer c.Close()
75
76 req := &certificatemanagerpb.CreateCertificateRequest{
77 // TODO: Fill request struct fields.
78 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#CreateCertificateRequest.
79 }
80 op, err := c.CreateCertificate(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_CreateCertificateIssuanceConfig() {
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 := certificatemanager.NewClient(ctx)
101 if err != nil {
102 // TODO: Handle error.
103 }
104 defer c.Close()
105
106 req := &certificatemanagerpb.CreateCertificateIssuanceConfigRequest{
107 // TODO: Fill request struct fields.
108 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#CreateCertificateIssuanceConfigRequest.
109 }
110 op, err := c.CreateCertificateIssuanceConfig(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_CreateCertificateMap() {
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 := certificatemanager.NewClient(ctx)
131 if err != nil {
132 // TODO: Handle error.
133 }
134 defer c.Close()
135
136 req := &certificatemanagerpb.CreateCertificateMapRequest{
137 // TODO: Fill request struct fields.
138 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#CreateCertificateMapRequest.
139 }
140 op, err := c.CreateCertificateMap(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_CreateCertificateMapEntry() {
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 := certificatemanager.NewClient(ctx)
161 if err != nil {
162 // TODO: Handle error.
163 }
164 defer c.Close()
165
166 req := &certificatemanagerpb.CreateCertificateMapEntryRequest{
167 // TODO: Fill request struct fields.
168 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#CreateCertificateMapEntryRequest.
169 }
170 op, err := c.CreateCertificateMapEntry(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_CreateDnsAuthorization() {
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 := certificatemanager.NewClient(ctx)
191 if err != nil {
192 // TODO: Handle error.
193 }
194 defer c.Close()
195
196 req := &certificatemanagerpb.CreateDnsAuthorizationRequest{
197 // TODO: Fill request struct fields.
198 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#CreateDnsAuthorizationRequest.
199 }
200 op, err := c.CreateDnsAuthorization(ctx, req)
201 if err != nil {
202 // TODO: Handle error.
203 }
204
205 resp, err := op.Wait(ctx)
206 if err != nil {
207 // TODO: Handle error.
208 }
209 // TODO: Use resp.
210 _ = resp
211 }
212
213 func ExampleClient_CreateTrustConfig() {
214 ctx := context.Background()
215 // This snippet has been automatically generated and should be regarded as a code template only.
216 // It will require modifications to work:
217 // - It may require correct/in-range values for request initialization.
218 // - It may require specifying regional endpoints when creating the service client as shown in:
219 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
220 c, err := certificatemanager.NewClient(ctx)
221 if err != nil {
222 // TODO: Handle error.
223 }
224 defer c.Close()
225
226 req := &certificatemanagerpb.CreateTrustConfigRequest{
227 // TODO: Fill request struct fields.
228 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#CreateTrustConfigRequest.
229 }
230 op, err := c.CreateTrustConfig(ctx, req)
231 if err != nil {
232 // TODO: Handle error.
233 }
234
235 resp, err := op.Wait(ctx)
236 if err != nil {
237 // TODO: Handle error.
238 }
239 // TODO: Use resp.
240 _ = resp
241 }
242
243 func ExampleClient_DeleteCertificate() {
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 := certificatemanager.NewClient(ctx)
251 if err != nil {
252 // TODO: Handle error.
253 }
254 defer c.Close()
255
256 req := &certificatemanagerpb.DeleteCertificateRequest{
257 // TODO: Fill request struct fields.
258 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#DeleteCertificateRequest.
259 }
260 op, err := c.DeleteCertificate(ctx, req)
261 if err != nil {
262 // TODO: Handle error.
263 }
264
265 err = op.Wait(ctx)
266 if err != nil {
267 // TODO: Handle error.
268 }
269 }
270
271 func ExampleClient_DeleteCertificateIssuanceConfig() {
272 ctx := context.Background()
273 // This snippet has been automatically generated and should be regarded as a code template only.
274 // It will require modifications to work:
275 // - It may require correct/in-range values for request initialization.
276 // - It may require specifying regional endpoints when creating the service client as shown in:
277 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
278 c, err := certificatemanager.NewClient(ctx)
279 if err != nil {
280 // TODO: Handle error.
281 }
282 defer c.Close()
283
284 req := &certificatemanagerpb.DeleteCertificateIssuanceConfigRequest{
285 // TODO: Fill request struct fields.
286 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#DeleteCertificateIssuanceConfigRequest.
287 }
288 op, err := c.DeleteCertificateIssuanceConfig(ctx, req)
289 if err != nil {
290 // TODO: Handle error.
291 }
292
293 err = op.Wait(ctx)
294 if err != nil {
295 // TODO: Handle error.
296 }
297 }
298
299 func ExampleClient_DeleteCertificateMap() {
300 ctx := context.Background()
301 // This snippet has been automatically generated and should be regarded as a code template only.
302 // It will require modifications to work:
303 // - It may require correct/in-range values for request initialization.
304 // - It may require specifying regional endpoints when creating the service client as shown in:
305 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
306 c, err := certificatemanager.NewClient(ctx)
307 if err != nil {
308 // TODO: Handle error.
309 }
310 defer c.Close()
311
312 req := &certificatemanagerpb.DeleteCertificateMapRequest{
313 // TODO: Fill request struct fields.
314 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#DeleteCertificateMapRequest.
315 }
316 op, err := c.DeleteCertificateMap(ctx, req)
317 if err != nil {
318 // TODO: Handle error.
319 }
320
321 err = op.Wait(ctx)
322 if err != nil {
323 // TODO: Handle error.
324 }
325 }
326
327 func ExampleClient_DeleteCertificateMapEntry() {
328 ctx := context.Background()
329 // This snippet has been automatically generated and should be regarded as a code template only.
330 // It will require modifications to work:
331 // - It may require correct/in-range values for request initialization.
332 // - It may require specifying regional endpoints when creating the service client as shown in:
333 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
334 c, err := certificatemanager.NewClient(ctx)
335 if err != nil {
336 // TODO: Handle error.
337 }
338 defer c.Close()
339
340 req := &certificatemanagerpb.DeleteCertificateMapEntryRequest{
341 // TODO: Fill request struct fields.
342 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#DeleteCertificateMapEntryRequest.
343 }
344 op, err := c.DeleteCertificateMapEntry(ctx, req)
345 if err != nil {
346 // TODO: Handle error.
347 }
348
349 err = op.Wait(ctx)
350 if err != nil {
351 // TODO: Handle error.
352 }
353 }
354
355 func ExampleClient_DeleteDnsAuthorization() {
356 ctx := context.Background()
357 // This snippet has been automatically generated and should be regarded as a code template only.
358 // It will require modifications to work:
359 // - It may require correct/in-range values for request initialization.
360 // - It may require specifying regional endpoints when creating the service client as shown in:
361 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
362 c, err := certificatemanager.NewClient(ctx)
363 if err != nil {
364 // TODO: Handle error.
365 }
366 defer c.Close()
367
368 req := &certificatemanagerpb.DeleteDnsAuthorizationRequest{
369 // TODO: Fill request struct fields.
370 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#DeleteDnsAuthorizationRequest.
371 }
372 op, err := c.DeleteDnsAuthorization(ctx, req)
373 if err != nil {
374 // TODO: Handle error.
375 }
376
377 err = op.Wait(ctx)
378 if err != nil {
379 // TODO: Handle error.
380 }
381 }
382
383 func ExampleClient_DeleteTrustConfig() {
384 ctx := context.Background()
385 // This snippet has been automatically generated and should be regarded as a code template only.
386 // It will require modifications to work:
387 // - It may require correct/in-range values for request initialization.
388 // - It may require specifying regional endpoints when creating the service client as shown in:
389 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
390 c, err := certificatemanager.NewClient(ctx)
391 if err != nil {
392 // TODO: Handle error.
393 }
394 defer c.Close()
395
396 req := &certificatemanagerpb.DeleteTrustConfigRequest{
397 // TODO: Fill request struct fields.
398 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#DeleteTrustConfigRequest.
399 }
400 op, err := c.DeleteTrustConfig(ctx, req)
401 if err != nil {
402 // TODO: Handle error.
403 }
404
405 err = op.Wait(ctx)
406 if err != nil {
407 // TODO: Handle error.
408 }
409 }
410
411 func ExampleClient_GetCertificate() {
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 := certificatemanager.NewClient(ctx)
419 if err != nil {
420 // TODO: Handle error.
421 }
422 defer c.Close()
423
424 req := &certificatemanagerpb.GetCertificateRequest{
425 // TODO: Fill request struct fields.
426 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#GetCertificateRequest.
427 }
428 resp, err := c.GetCertificate(ctx, req)
429 if err != nil {
430 // TODO: Handle error.
431 }
432 // TODO: Use resp.
433 _ = resp
434 }
435
436 func ExampleClient_GetCertificateIssuanceConfig() {
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 := certificatemanager.NewClient(ctx)
444 if err != nil {
445 // TODO: Handle error.
446 }
447 defer c.Close()
448
449 req := &certificatemanagerpb.GetCertificateIssuanceConfigRequest{
450 // TODO: Fill request struct fields.
451 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#GetCertificateIssuanceConfigRequest.
452 }
453 resp, err := c.GetCertificateIssuanceConfig(ctx, req)
454 if err != nil {
455 // TODO: Handle error.
456 }
457 // TODO: Use resp.
458 _ = resp
459 }
460
461 func ExampleClient_GetCertificateMap() {
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 := certificatemanager.NewClient(ctx)
469 if err != nil {
470 // TODO: Handle error.
471 }
472 defer c.Close()
473
474 req := &certificatemanagerpb.GetCertificateMapRequest{
475 // TODO: Fill request struct fields.
476 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#GetCertificateMapRequest.
477 }
478 resp, err := c.GetCertificateMap(ctx, req)
479 if err != nil {
480 // TODO: Handle error.
481 }
482 // TODO: Use resp.
483 _ = resp
484 }
485
486 func ExampleClient_GetCertificateMapEntry() {
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 := certificatemanager.NewClient(ctx)
494 if err != nil {
495 // TODO: Handle error.
496 }
497 defer c.Close()
498
499 req := &certificatemanagerpb.GetCertificateMapEntryRequest{
500 // TODO: Fill request struct fields.
501 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#GetCertificateMapEntryRequest.
502 }
503 resp, err := c.GetCertificateMapEntry(ctx, req)
504 if err != nil {
505 // TODO: Handle error.
506 }
507 // TODO: Use resp.
508 _ = resp
509 }
510
511 func ExampleClient_GetDnsAuthorization() {
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 := certificatemanager.NewClient(ctx)
519 if err != nil {
520 // TODO: Handle error.
521 }
522 defer c.Close()
523
524 req := &certificatemanagerpb.GetDnsAuthorizationRequest{
525 // TODO: Fill request struct fields.
526 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#GetDnsAuthorizationRequest.
527 }
528 resp, err := c.GetDnsAuthorization(ctx, req)
529 if err != nil {
530 // TODO: Handle error.
531 }
532 // TODO: Use resp.
533 _ = resp
534 }
535
536 func ExampleClient_GetTrustConfig() {
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 := certificatemanager.NewClient(ctx)
544 if err != nil {
545 // TODO: Handle error.
546 }
547 defer c.Close()
548
549 req := &certificatemanagerpb.GetTrustConfigRequest{
550 // TODO: Fill request struct fields.
551 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#GetTrustConfigRequest.
552 }
553 resp, err := c.GetTrustConfig(ctx, req)
554 if err != nil {
555 // TODO: Handle error.
556 }
557 // TODO: Use resp.
558 _ = resp
559 }
560
561 func ExampleClient_ListCertificateIssuanceConfigs() {
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 := certificatemanager.NewClient(ctx)
569 if err != nil {
570 // TODO: Handle error.
571 }
572 defer c.Close()
573
574 req := &certificatemanagerpb.ListCertificateIssuanceConfigsRequest{
575 // TODO: Fill request struct fields.
576 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#ListCertificateIssuanceConfigsRequest.
577 }
578 it := c.ListCertificateIssuanceConfigs(ctx, req)
579 for {
580 resp, err := it.Next()
581 if err == iterator.Done {
582 break
583 }
584 if err != nil {
585 // TODO: Handle error.
586 }
587 // TODO: Use resp.
588 _ = resp
589
590 // If you need to access the underlying RPC response,
591 // you can do so by casting the `Response` as below.
592 // Otherwise, remove this line. Only populated after
593 // first call to Next(). Not safe for concurrent access.
594 _ = it.Response.(*certificatemanagerpb.ListCertificateIssuanceConfigsResponse)
595 }
596 }
597
598 func ExampleClient_ListCertificateMapEntries() {
599 ctx := context.Background()
600 // This snippet has been automatically generated and should be regarded as a code template only.
601 // It will require modifications to work:
602 // - It may require correct/in-range values for request initialization.
603 // - It may require specifying regional endpoints when creating the service client as shown in:
604 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
605 c, err := certificatemanager.NewClient(ctx)
606 if err != nil {
607 // TODO: Handle error.
608 }
609 defer c.Close()
610
611 req := &certificatemanagerpb.ListCertificateMapEntriesRequest{
612 // TODO: Fill request struct fields.
613 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#ListCertificateMapEntriesRequest.
614 }
615 it := c.ListCertificateMapEntries(ctx, req)
616 for {
617 resp, err := it.Next()
618 if err == iterator.Done {
619 break
620 }
621 if err != nil {
622 // TODO: Handle error.
623 }
624 // TODO: Use resp.
625 _ = resp
626
627 // If you need to access the underlying RPC response,
628 // you can do so by casting the `Response` as below.
629 // Otherwise, remove this line. Only populated after
630 // first call to Next(). Not safe for concurrent access.
631 _ = it.Response.(*certificatemanagerpb.ListCertificateMapEntriesResponse)
632 }
633 }
634
635 func ExampleClient_ListCertificateMaps() {
636 ctx := context.Background()
637 // This snippet has been automatically generated and should be regarded as a code template only.
638 // It will require modifications to work:
639 // - It may require correct/in-range values for request initialization.
640 // - It may require specifying regional endpoints when creating the service client as shown in:
641 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
642 c, err := certificatemanager.NewClient(ctx)
643 if err != nil {
644 // TODO: Handle error.
645 }
646 defer c.Close()
647
648 req := &certificatemanagerpb.ListCertificateMapsRequest{
649 // TODO: Fill request struct fields.
650 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#ListCertificateMapsRequest.
651 }
652 it := c.ListCertificateMaps(ctx, req)
653 for {
654 resp, err := it.Next()
655 if err == iterator.Done {
656 break
657 }
658 if err != nil {
659 // TODO: Handle error.
660 }
661 // TODO: Use resp.
662 _ = resp
663
664 // If you need to access the underlying RPC response,
665 // you can do so by casting the `Response` as below.
666 // Otherwise, remove this line. Only populated after
667 // first call to Next(). Not safe for concurrent access.
668 _ = it.Response.(*certificatemanagerpb.ListCertificateMapsResponse)
669 }
670 }
671
672 func ExampleClient_ListCertificates() {
673 ctx := context.Background()
674 // This snippet has been automatically generated and should be regarded as a code template only.
675 // It will require modifications to work:
676 // - It may require correct/in-range values for request initialization.
677 // - It may require specifying regional endpoints when creating the service client as shown in:
678 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
679 c, err := certificatemanager.NewClient(ctx)
680 if err != nil {
681 // TODO: Handle error.
682 }
683 defer c.Close()
684
685 req := &certificatemanagerpb.ListCertificatesRequest{
686 // TODO: Fill request struct fields.
687 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#ListCertificatesRequest.
688 }
689 it := c.ListCertificates(ctx, req)
690 for {
691 resp, err := it.Next()
692 if err == iterator.Done {
693 break
694 }
695 if err != nil {
696 // TODO: Handle error.
697 }
698 // TODO: Use resp.
699 _ = resp
700
701 // If you need to access the underlying RPC response,
702 // you can do so by casting the `Response` as below.
703 // Otherwise, remove this line. Only populated after
704 // first call to Next(). Not safe for concurrent access.
705 _ = it.Response.(*certificatemanagerpb.ListCertificatesResponse)
706 }
707 }
708
709 func ExampleClient_ListDnsAuthorizations() {
710 ctx := context.Background()
711 // This snippet has been automatically generated and should be regarded as a code template only.
712 // It will require modifications to work:
713 // - It may require correct/in-range values for request initialization.
714 // - It may require specifying regional endpoints when creating the service client as shown in:
715 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
716 c, err := certificatemanager.NewClient(ctx)
717 if err != nil {
718 // TODO: Handle error.
719 }
720 defer c.Close()
721
722 req := &certificatemanagerpb.ListDnsAuthorizationsRequest{
723 // TODO: Fill request struct fields.
724 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#ListDnsAuthorizationsRequest.
725 }
726 it := c.ListDnsAuthorizations(ctx, req)
727 for {
728 resp, err := it.Next()
729 if err == iterator.Done {
730 break
731 }
732 if err != nil {
733 // TODO: Handle error.
734 }
735 // TODO: Use resp.
736 _ = resp
737
738 // If you need to access the underlying RPC response,
739 // you can do so by casting the `Response` as below.
740 // Otherwise, remove this line. Only populated after
741 // first call to Next(). Not safe for concurrent access.
742 _ = it.Response.(*certificatemanagerpb.ListDnsAuthorizationsResponse)
743 }
744 }
745
746 func ExampleClient_ListTrustConfigs() {
747 ctx := context.Background()
748 // This snippet has been automatically generated and should be regarded as a code template only.
749 // It will require modifications to work:
750 // - It may require correct/in-range values for request initialization.
751 // - It may require specifying regional endpoints when creating the service client as shown in:
752 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
753 c, err := certificatemanager.NewClient(ctx)
754 if err != nil {
755 // TODO: Handle error.
756 }
757 defer c.Close()
758
759 req := &certificatemanagerpb.ListTrustConfigsRequest{
760 // TODO: Fill request struct fields.
761 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#ListTrustConfigsRequest.
762 }
763 it := c.ListTrustConfigs(ctx, req)
764 for {
765 resp, err := it.Next()
766 if err == iterator.Done {
767 break
768 }
769 if err != nil {
770 // TODO: Handle error.
771 }
772 // TODO: Use resp.
773 _ = resp
774
775 // If you need to access the underlying RPC response,
776 // you can do so by casting the `Response` as below.
777 // Otherwise, remove this line. Only populated after
778 // first call to Next(). Not safe for concurrent access.
779 _ = it.Response.(*certificatemanagerpb.ListTrustConfigsResponse)
780 }
781 }
782
783 func ExampleClient_UpdateCertificate() {
784 ctx := context.Background()
785 // This snippet has been automatically generated and should be regarded as a code template only.
786 // It will require modifications to work:
787 // - It may require correct/in-range values for request initialization.
788 // - It may require specifying regional endpoints when creating the service client as shown in:
789 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
790 c, err := certificatemanager.NewClient(ctx)
791 if err != nil {
792 // TODO: Handle error.
793 }
794 defer c.Close()
795
796 req := &certificatemanagerpb.UpdateCertificateRequest{
797 // TODO: Fill request struct fields.
798 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#UpdateCertificateRequest.
799 }
800 op, err := c.UpdateCertificate(ctx, req)
801 if err != nil {
802 // TODO: Handle error.
803 }
804
805 resp, err := op.Wait(ctx)
806 if err != nil {
807 // TODO: Handle error.
808 }
809 // TODO: Use resp.
810 _ = resp
811 }
812
813 func ExampleClient_UpdateCertificateMap() {
814 ctx := context.Background()
815 // This snippet has been automatically generated and should be regarded as a code template only.
816 // It will require modifications to work:
817 // - It may require correct/in-range values for request initialization.
818 // - It may require specifying regional endpoints when creating the service client as shown in:
819 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
820 c, err := certificatemanager.NewClient(ctx)
821 if err != nil {
822 // TODO: Handle error.
823 }
824 defer c.Close()
825
826 req := &certificatemanagerpb.UpdateCertificateMapRequest{
827 // TODO: Fill request struct fields.
828 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#UpdateCertificateMapRequest.
829 }
830 op, err := c.UpdateCertificateMap(ctx, req)
831 if err != nil {
832 // TODO: Handle error.
833 }
834
835 resp, err := op.Wait(ctx)
836 if err != nil {
837 // TODO: Handle error.
838 }
839 // TODO: Use resp.
840 _ = resp
841 }
842
843 func ExampleClient_UpdateCertificateMapEntry() {
844 ctx := context.Background()
845 // This snippet has been automatically generated and should be regarded as a code template only.
846 // It will require modifications to work:
847 // - It may require correct/in-range values for request initialization.
848 // - It may require specifying regional endpoints when creating the service client as shown in:
849 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
850 c, err := certificatemanager.NewClient(ctx)
851 if err != nil {
852 // TODO: Handle error.
853 }
854 defer c.Close()
855
856 req := &certificatemanagerpb.UpdateCertificateMapEntryRequest{
857 // TODO: Fill request struct fields.
858 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#UpdateCertificateMapEntryRequest.
859 }
860 op, err := c.UpdateCertificateMapEntry(ctx, req)
861 if err != nil {
862 // TODO: Handle error.
863 }
864
865 resp, err := op.Wait(ctx)
866 if err != nil {
867 // TODO: Handle error.
868 }
869 // TODO: Use resp.
870 _ = resp
871 }
872
873 func ExampleClient_UpdateDnsAuthorization() {
874 ctx := context.Background()
875 // This snippet has been automatically generated and should be regarded as a code template only.
876 // It will require modifications to work:
877 // - It may require correct/in-range values for request initialization.
878 // - It may require specifying regional endpoints when creating the service client as shown in:
879 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
880 c, err := certificatemanager.NewClient(ctx)
881 if err != nil {
882 // TODO: Handle error.
883 }
884 defer c.Close()
885
886 req := &certificatemanagerpb.UpdateDnsAuthorizationRequest{
887 // TODO: Fill request struct fields.
888 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#UpdateDnsAuthorizationRequest.
889 }
890 op, err := c.UpdateDnsAuthorization(ctx, req)
891 if err != nil {
892 // TODO: Handle error.
893 }
894
895 resp, err := op.Wait(ctx)
896 if err != nil {
897 // TODO: Handle error.
898 }
899 // TODO: Use resp.
900 _ = resp
901 }
902
903 func ExampleClient_UpdateTrustConfig() {
904 ctx := context.Background()
905 // This snippet has been automatically generated and should be regarded as a code template only.
906 // It will require modifications to work:
907 // - It may require correct/in-range values for request initialization.
908 // - It may require specifying regional endpoints when creating the service client as shown in:
909 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
910 c, err := certificatemanager.NewClient(ctx)
911 if err != nil {
912 // TODO: Handle error.
913 }
914 defer c.Close()
915
916 req := &certificatemanagerpb.UpdateTrustConfigRequest{
917 // TODO: Fill request struct fields.
918 // See https://pkg.go.dev/cloud.google.com/go/certificatemanager/apiv1/certificatemanagerpb#UpdateTrustConfigRequest.
919 }
920 op, err := c.UpdateTrustConfig(ctx, req)
921 if err != nil {
922 // TODO: Handle error.
923 }
924
925 resp, err := op.Wait(ctx)
926 if err != nil {
927 // TODO: Handle error.
928 }
929 // TODO: Use resp.
930 _ = resp
931 }
932
933 func ExampleClient_GetLocation() {
934 ctx := context.Background()
935 // This snippet has been automatically generated and should be regarded as a code template only.
936 // It will require modifications to work:
937 // - It may require correct/in-range values for request initialization.
938 // - It may require specifying regional endpoints when creating the service client as shown in:
939 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
940 c, err := certificatemanager.NewClient(ctx)
941 if err != nil {
942 // TODO: Handle error.
943 }
944 defer c.Close()
945
946 req := &locationpb.GetLocationRequest{
947 // TODO: Fill request struct fields.
948 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
949 }
950 resp, err := c.GetLocation(ctx, req)
951 if err != nil {
952 // TODO: Handle error.
953 }
954 // TODO: Use resp.
955 _ = resp
956 }
957
958 func ExampleClient_ListLocations() {
959 ctx := context.Background()
960 // This snippet has been automatically generated and should be regarded as a code template only.
961 // It will require modifications to work:
962 // - It may require correct/in-range values for request initialization.
963 // - It may require specifying regional endpoints when creating the service client as shown in:
964 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
965 c, err := certificatemanager.NewClient(ctx)
966 if err != nil {
967 // TODO: Handle error.
968 }
969 defer c.Close()
970
971 req := &locationpb.ListLocationsRequest{
972 // TODO: Fill request struct fields.
973 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
974 }
975 it := c.ListLocations(ctx, req)
976 for {
977 resp, err := it.Next()
978 if err == iterator.Done {
979 break
980 }
981 if err != nil {
982 // TODO: Handle error.
983 }
984 // TODO: Use resp.
985 _ = resp
986
987 // If you need to access the underlying RPC response,
988 // you can do so by casting the `Response` as below.
989 // Otherwise, remove this line. Only populated after
990 // first call to Next(). Not safe for concurrent access.
991 _ = it.Response.(*locationpb.ListLocationsResponse)
992 }
993 }
994
995 func ExampleClient_CancelOperation() {
996 ctx := context.Background()
997 // This snippet has been automatically generated and should be regarded as a code template only.
998 // It will require modifications to work:
999 // - It may require correct/in-range values for request initialization.
1000 // - It may require specifying regional endpoints when creating the service client as shown in:
1001 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1002 c, err := certificatemanager.NewClient(ctx)
1003 if err != nil {
1004 // TODO: Handle error.
1005 }
1006 defer c.Close()
1007
1008 req := &longrunningpb.CancelOperationRequest{
1009 // TODO: Fill request struct fields.
1010 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
1011 }
1012 err = c.CancelOperation(ctx, req)
1013 if err != nil {
1014 // TODO: Handle error.
1015 }
1016 }
1017
1018 func ExampleClient_DeleteOperation() {
1019 ctx := context.Background()
1020 // This snippet has been automatically generated and should be regarded as a code template only.
1021 // It will require modifications to work:
1022 // - It may require correct/in-range values for request initialization.
1023 // - It may require specifying regional endpoints when creating the service client as shown in:
1024 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1025 c, err := certificatemanager.NewClient(ctx)
1026 if err != nil {
1027 // TODO: Handle error.
1028 }
1029 defer c.Close()
1030
1031 req := &longrunningpb.DeleteOperationRequest{
1032 // TODO: Fill request struct fields.
1033 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
1034 }
1035 err = c.DeleteOperation(ctx, req)
1036 if err != nil {
1037 // TODO: Handle error.
1038 }
1039 }
1040
1041 func ExampleClient_GetOperation() {
1042 ctx := context.Background()
1043 // This snippet has been automatically generated and should be regarded as a code template only.
1044 // It will require modifications to work:
1045 // - It may require correct/in-range values for request initialization.
1046 // - It may require specifying regional endpoints when creating the service client as shown in:
1047 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1048 c, err := certificatemanager.NewClient(ctx)
1049 if err != nil {
1050 // TODO: Handle error.
1051 }
1052 defer c.Close()
1053
1054 req := &longrunningpb.GetOperationRequest{
1055 // TODO: Fill request struct fields.
1056 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
1057 }
1058 resp, err := c.GetOperation(ctx, req)
1059 if err != nil {
1060 // TODO: Handle error.
1061 }
1062 // TODO: Use resp.
1063 _ = resp
1064 }
1065
1066 func ExampleClient_ListOperations() {
1067 ctx := context.Background()
1068 // This snippet has been automatically generated and should be regarded as a code template only.
1069 // It will require modifications to work:
1070 // - It may require correct/in-range values for request initialization.
1071 // - It may require specifying regional endpoints when creating the service client as shown in:
1072 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1073 c, err := certificatemanager.NewClient(ctx)
1074 if err != nil {
1075 // TODO: Handle error.
1076 }
1077 defer c.Close()
1078
1079 req := &longrunningpb.ListOperationsRequest{
1080 // TODO: Fill request struct fields.
1081 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
1082 }
1083 it := c.ListOperations(ctx, req)
1084 for {
1085 resp, err := it.Next()
1086 if err == iterator.Done {
1087 break
1088 }
1089 if err != nil {
1090 // TODO: Handle error.
1091 }
1092 // TODO: Use resp.
1093 _ = resp
1094
1095 // If you need to access the underlying RPC response,
1096 // you can do so by casting the `Response` as below.
1097 // Otherwise, remove this line. Only populated after
1098 // first call to Next(). Not safe for concurrent access.
1099 _ = it.Response.(*longrunningpb.ListOperationsResponse)
1100 }
1101 }