Debian Codegraph @

recaptchaenterprise/apiv1/recaptcha_enterprise_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 recaptchaenterprise_test
18
19 import (
20 "context"
21
22 recaptchaenterprise "cloud.google.com/go/recaptchaenterprise/v2/apiv1"
23 recaptchaenterprisepb "cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb"
24 "google.golang.org/api/iterator"
25 )
26
27 func ExampleNewClient() {
28 ctx := context.Background()
29 // This snippet has been automatically generated and should be regarded as a code template only.
30 // It will require modifications to work:
31 // - It may require correct/in-range values for request initialization.
32 // - It may require specifying regional endpoints when creating the service client as shown in:
33 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
34 c, err := recaptchaenterprise.NewClient(ctx)
35 if err != nil {
36 // TODO: Handle error.
37 }
38 defer c.Close()
39
40 // TODO: Use client.
41 _ = c
42 }
43
44 func ExampleClient_AddIpOverride() {
45 ctx := context.Background()
46 // This snippet has been automatically generated and should be regarded as a code template only.
47 // It will require modifications to work:
48 // - It may require correct/in-range values for request initialization.
49 // - It may require specifying regional endpoints when creating the service client as shown in:
50 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
51 c, err := recaptchaenterprise.NewClient(ctx)
52 if err != nil {
53 // TODO: Handle error.
54 }
55 defer c.Close()
56
57 req := &recaptchaenterprisepb.AddIpOverrideRequest{
58 // TODO: Fill request struct fields.
59 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#AddIpOverrideRequest.
60 }
61 resp, err := c.AddIpOverride(ctx, req)
62 if err != nil {
63 // TODO: Handle error.
64 }
65 // TODO: Use resp.
66 _ = resp
67 }
68
69 func ExampleClient_AnnotateAssessment() {
70 ctx := context.Background()
71 // This snippet has been automatically generated and should be regarded as a code template only.
72 // It will require modifications to work:
73 // - It may require correct/in-range values for request initialization.
74 // - It may require specifying regional endpoints when creating the service client as shown in:
75 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
76 c, err := recaptchaenterprise.NewClient(ctx)
77 if err != nil {
78 // TODO: Handle error.
79 }
80 defer c.Close()
81
82 req := &recaptchaenterprisepb.AnnotateAssessmentRequest{
83 // TODO: Fill request struct fields.
84 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#AnnotateAssessmentRequest.
85 }
86 resp, err := c.AnnotateAssessment(ctx, req)
87 if err != nil {
88 // TODO: Handle error.
89 }
90 // TODO: Use resp.
91 _ = resp
92 }
93
94 func ExampleClient_CreateAssessment() {
95 ctx := context.Background()
96 // This snippet has been automatically generated and should be regarded as a code template only.
97 // It will require modifications to work:
98 // - It may require correct/in-range values for request initialization.
99 // - It may require specifying regional endpoints when creating the service client as shown in:
100 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
101 c, err := recaptchaenterprise.NewClient(ctx)
102 if err != nil {
103 // TODO: Handle error.
104 }
105 defer c.Close()
106
107 req := &recaptchaenterprisepb.CreateAssessmentRequest{
108 // TODO: Fill request struct fields.
109 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#CreateAssessmentRequest.
110 }
111 resp, err := c.CreateAssessment(ctx, req)
112 if err != nil {
113 // TODO: Handle error.
114 }
115 // TODO: Use resp.
116 _ = resp
117 }
118
119 func ExampleClient_CreateFirewallPolicy() {
120 ctx := context.Background()
121 // This snippet has been automatically generated and should be regarded as a code template only.
122 // It will require modifications to work:
123 // - It may require correct/in-range values for request initialization.
124 // - It may require specifying regional endpoints when creating the service client as shown in:
125 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
126 c, err := recaptchaenterprise.NewClient(ctx)
127 if err != nil {
128 // TODO: Handle error.
129 }
130 defer c.Close()
131
132 req := &recaptchaenterprisepb.CreateFirewallPolicyRequest{
133 // TODO: Fill request struct fields.
134 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#CreateFirewallPolicyRequest.
135 }
136 resp, err := c.CreateFirewallPolicy(ctx, req)
137 if err != nil {
138 // TODO: Handle error.
139 }
140 // TODO: Use resp.
141 _ = resp
142 }
143
144 func ExampleClient_CreateKey() {
145 ctx := context.Background()
146 // This snippet has been automatically generated and should be regarded as a code template only.
147 // It will require modifications to work:
148 // - It may require correct/in-range values for request initialization.
149 // - It may require specifying regional endpoints when creating the service client as shown in:
150 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
151 c, err := recaptchaenterprise.NewClient(ctx)
152 if err != nil {
153 // TODO: Handle error.
154 }
155 defer c.Close()
156
157 req := &recaptchaenterprisepb.CreateKeyRequest{
158 // TODO: Fill request struct fields.
159 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#CreateKeyRequest.
160 }
161 resp, err := c.CreateKey(ctx, req)
162 if err != nil {
163 // TODO: Handle error.
164 }
165 // TODO: Use resp.
166 _ = resp
167 }
168
169 func ExampleClient_DeleteFirewallPolicy() {
170 ctx := context.Background()
171 // This snippet has been automatically generated and should be regarded as a code template only.
172 // It will require modifications to work:
173 // - It may require correct/in-range values for request initialization.
174 // - It may require specifying regional endpoints when creating the service client as shown in:
175 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
176 c, err := recaptchaenterprise.NewClient(ctx)
177 if err != nil {
178 // TODO: Handle error.
179 }
180 defer c.Close()
181
182 req := &recaptchaenterprisepb.DeleteFirewallPolicyRequest{
183 // TODO: Fill request struct fields.
184 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#DeleteFirewallPolicyRequest.
185 }
186 err = c.DeleteFirewallPolicy(ctx, req)
187 if err != nil {
188 // TODO: Handle error.
189 }
190 }
191
192 func ExampleClient_DeleteKey() {
193 ctx := context.Background()
194 // This snippet has been automatically generated and should be regarded as a code template only.
195 // It will require modifications to work:
196 // - It may require correct/in-range values for request initialization.
197 // - It may require specifying regional endpoints when creating the service client as shown in:
198 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
199 c, err := recaptchaenterprise.NewClient(ctx)
200 if err != nil {
201 // TODO: Handle error.
202 }
203 defer c.Close()
204
205 req := &recaptchaenterprisepb.DeleteKeyRequest{
206 // TODO: Fill request struct fields.
207 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#DeleteKeyRequest.
208 }
209 err = c.DeleteKey(ctx, req)
210 if err != nil {
211 // TODO: Handle error.
212 }
213 }
214
215 func ExampleClient_GetFirewallPolicy() {
216 ctx := context.Background()
217 // This snippet has been automatically generated and should be regarded as a code template only.
218 // It will require modifications to work:
219 // - It may require correct/in-range values for request initialization.
220 // - It may require specifying regional endpoints when creating the service client as shown in:
221 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
222 c, err := recaptchaenterprise.NewClient(ctx)
223 if err != nil {
224 // TODO: Handle error.
225 }
226 defer c.Close()
227
228 req := &recaptchaenterprisepb.GetFirewallPolicyRequest{
229 // TODO: Fill request struct fields.
230 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#GetFirewallPolicyRequest.
231 }
232 resp, err := c.GetFirewallPolicy(ctx, req)
233 if err != nil {
234 // TODO: Handle error.
235 }
236 // TODO: Use resp.
237 _ = resp
238 }
239
240 func ExampleClient_GetKey() {
241 ctx := context.Background()
242 // This snippet has been automatically generated and should be regarded as a code template only.
243 // It will require modifications to work:
244 // - It may require correct/in-range values for request initialization.
245 // - It may require specifying regional endpoints when creating the service client as shown in:
246 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
247 c, err := recaptchaenterprise.NewClient(ctx)
248 if err != nil {
249 // TODO: Handle error.
250 }
251 defer c.Close()
252
253 req := &recaptchaenterprisepb.GetKeyRequest{
254 // TODO: Fill request struct fields.
255 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#GetKeyRequest.
256 }
257 resp, err := c.GetKey(ctx, req)
258 if err != nil {
259 // TODO: Handle error.
260 }
261 // TODO: Use resp.
262 _ = resp
263 }
264
265 func ExampleClient_GetMetrics() {
266 ctx := context.Background()
267 // This snippet has been automatically generated and should be regarded as a code template only.
268 // It will require modifications to work:
269 // - It may require correct/in-range values for request initialization.
270 // - It may require specifying regional endpoints when creating the service client as shown in:
271 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
272 c, err := recaptchaenterprise.NewClient(ctx)
273 if err != nil {
274 // TODO: Handle error.
275 }
276 defer c.Close()
277
278 req := &recaptchaenterprisepb.GetMetricsRequest{
279 // TODO: Fill request struct fields.
280 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#GetMetricsRequest.
281 }
282 resp, err := c.GetMetrics(ctx, req)
283 if err != nil {
284 // TODO: Handle error.
285 }
286 // TODO: Use resp.
287 _ = resp
288 }
289
290 func ExampleClient_ListFirewallPolicies() {
291 ctx := context.Background()
292 // This snippet has been automatically generated and should be regarded as a code template only.
293 // It will require modifications to work:
294 // - It may require correct/in-range values for request initialization.
295 // - It may require specifying regional endpoints when creating the service client as shown in:
296 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
297 c, err := recaptchaenterprise.NewClient(ctx)
298 if err != nil {
299 // TODO: Handle error.
300 }
301 defer c.Close()
302
303 req := &recaptchaenterprisepb.ListFirewallPoliciesRequest{
304 // TODO: Fill request struct fields.
305 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#ListFirewallPoliciesRequest.
306 }
307 it := c.ListFirewallPolicies(ctx, req)
308 for {
309 resp, err := it.Next()
310 if err == iterator.Done {
311 break
312 }
313 if err != nil {
314 // TODO: Handle error.
315 }
316 // TODO: Use resp.
317 _ = resp
318
319 // If you need to access the underlying RPC response,
320 // you can do so by casting the `Response` as below.
321 // Otherwise, remove this line. Only populated after
322 // first call to Next(). Not safe for concurrent access.
323 _ = it.Response.(*recaptchaenterprisepb.ListFirewallPoliciesResponse)
324 }
325 }
326
327 func ExampleClient_ListIpOverrides() {
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 := recaptchaenterprise.NewClient(ctx)
335 if err != nil {
336 // TODO: Handle error.
337 }
338 defer c.Close()
339
340 req := &recaptchaenterprisepb.ListIpOverridesRequest{
341 // TODO: Fill request struct fields.
342 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#ListIpOverridesRequest.
343 }
344 it := c.ListIpOverrides(ctx, req)
345 for {
346 resp, err := it.Next()
347 if err == iterator.Done {
348 break
349 }
350 if err != nil {
351 // TODO: Handle error.
352 }
353 // TODO: Use resp.
354 _ = resp
355
356 // If you need to access the underlying RPC response,
357 // you can do so by casting the `Response` as below.
358 // Otherwise, remove this line. Only populated after
359 // first call to Next(). Not safe for concurrent access.
360 _ = it.Response.(*recaptchaenterprisepb.ListIpOverridesResponse)
361 }
362 }
363
364 func ExampleClient_ListKeys() {
365 ctx := context.Background()
366 // This snippet has been automatically generated and should be regarded as a code template only.
367 // It will require modifications to work:
368 // - It may require correct/in-range values for request initialization.
369 // - It may require specifying regional endpoints when creating the service client as shown in:
370 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
371 c, err := recaptchaenterprise.NewClient(ctx)
372 if err != nil {
373 // TODO: Handle error.
374 }
375 defer c.Close()
376
377 req := &recaptchaenterprisepb.ListKeysRequest{
378 // TODO: Fill request struct fields.
379 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#ListKeysRequest.
380 }
381 it := c.ListKeys(ctx, req)
382 for {
383 resp, err := it.Next()
384 if err == iterator.Done {
385 break
386 }
387 if err != nil {
388 // TODO: Handle error.
389 }
390 // TODO: Use resp.
391 _ = resp
392
393 // If you need to access the underlying RPC response,
394 // you can do so by casting the `Response` as below.
395 // Otherwise, remove this line. Only populated after
396 // first call to Next(). Not safe for concurrent access.
397 _ = it.Response.(*recaptchaenterprisepb.ListKeysResponse)
398 }
399 }
400
401 func ExampleClient_ListRelatedAccountGroupMemberships() {
402 ctx := context.Background()
403 // This snippet has been automatically generated and should be regarded as a code template only.
404 // It will require modifications to work:
405 // - It may require correct/in-range values for request initialization.
406 // - It may require specifying regional endpoints when creating the service client as shown in:
407 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
408 c, err := recaptchaenterprise.NewClient(ctx)
409 if err != nil {
410 // TODO: Handle error.
411 }
412 defer c.Close()
413
414 req := &recaptchaenterprisepb.ListRelatedAccountGroupMembershipsRequest{
415 // TODO: Fill request struct fields.
416 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#ListRelatedAccountGroupMembershipsRequest.
417 }
418 it := c.ListRelatedAccountGroupMemberships(ctx, req)
419 for {
420 resp, err := it.Next()
421 if err == iterator.Done {
422 break
423 }
424 if err != nil {
425 // TODO: Handle error.
426 }
427 // TODO: Use resp.
428 _ = resp
429
430 // If you need to access the underlying RPC response,
431 // you can do so by casting the `Response` as below.
432 // Otherwise, remove this line. Only populated after
433 // first call to Next(). Not safe for concurrent access.
434 _ = it.Response.(*recaptchaenterprisepb.ListRelatedAccountGroupMembershipsResponse)
435 }
436 }
437
438 func ExampleClient_ListRelatedAccountGroups() {
439 ctx := context.Background()
440 // This snippet has been automatically generated and should be regarded as a code template only.
441 // It will require modifications to work:
442 // - It may require correct/in-range values for request initialization.
443 // - It may require specifying regional endpoints when creating the service client as shown in:
444 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
445 c, err := recaptchaenterprise.NewClient(ctx)
446 if err != nil {
447 // TODO: Handle error.
448 }
449 defer c.Close()
450
451 req := &recaptchaenterprisepb.ListRelatedAccountGroupsRequest{
452 // TODO: Fill request struct fields.
453 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#ListRelatedAccountGroupsRequest.
454 }
455 it := c.ListRelatedAccountGroups(ctx, req)
456 for {
457 resp, err := it.Next()
458 if err == iterator.Done {
459 break
460 }
461 if err != nil {
462 // TODO: Handle error.
463 }
464 // TODO: Use resp.
465 _ = resp
466
467 // If you need to access the underlying RPC response,
468 // you can do so by casting the `Response` as below.
469 // Otherwise, remove this line. Only populated after
470 // first call to Next(). Not safe for concurrent access.
471 _ = it.Response.(*recaptchaenterprisepb.ListRelatedAccountGroupsResponse)
472 }
473 }
474
475 func ExampleClient_MigrateKey() {
476 ctx := context.Background()
477 // This snippet has been automatically generated and should be regarded as a code template only.
478 // It will require modifications to work:
479 // - It may require correct/in-range values for request initialization.
480 // - It may require specifying regional endpoints when creating the service client as shown in:
481 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
482 c, err := recaptchaenterprise.NewClient(ctx)
483 if err != nil {
484 // TODO: Handle error.
485 }
486 defer c.Close()
487
488 req := &recaptchaenterprisepb.MigrateKeyRequest{
489 // TODO: Fill request struct fields.
490 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#MigrateKeyRequest.
491 }
492 resp, err := c.MigrateKey(ctx, req)
493 if err != nil {
494 // TODO: Handle error.
495 }
496 // TODO: Use resp.
497 _ = resp
498 }
499
500 func ExampleClient_RemoveIpOverride() {
501 ctx := context.Background()
502 // This snippet has been automatically generated and should be regarded as a code template only.
503 // It will require modifications to work:
504 // - It may require correct/in-range values for request initialization.
505 // - It may require specifying regional endpoints when creating the service client as shown in:
506 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
507 c, err := recaptchaenterprise.NewClient(ctx)
508 if err != nil {
509 // TODO: Handle error.
510 }
511 defer c.Close()
512
513 req := &recaptchaenterprisepb.RemoveIpOverrideRequest{
514 // TODO: Fill request struct fields.
515 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#RemoveIpOverrideRequest.
516 }
517 resp, err := c.RemoveIpOverride(ctx, req)
518 if err != nil {
519 // TODO: Handle error.
520 }
521 // TODO: Use resp.
522 _ = resp
523 }
524
525 func ExampleClient_ReorderFirewallPolicies() {
526 ctx := context.Background()
527 // This snippet has been automatically generated and should be regarded as a code template only.
528 // It will require modifications to work:
529 // - It may require correct/in-range values for request initialization.
530 // - It may require specifying regional endpoints when creating the service client as shown in:
531 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
532 c, err := recaptchaenterprise.NewClient(ctx)
533 if err != nil {
534 // TODO: Handle error.
535 }
536 defer c.Close()
537
538 req := &recaptchaenterprisepb.ReorderFirewallPoliciesRequest{
539 // TODO: Fill request struct fields.
540 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#ReorderFirewallPoliciesRequest.
541 }
542 resp, err := c.ReorderFirewallPolicies(ctx, req)
543 if err != nil {
544 // TODO: Handle error.
545 }
546 // TODO: Use resp.
547 _ = resp
548 }
549
550 func ExampleClient_RetrieveLegacySecretKey() {
551 ctx := context.Background()
552 // This snippet has been automatically generated and should be regarded as a code template only.
553 // It will require modifications to work:
554 // - It may require correct/in-range values for request initialization.
555 // - It may require specifying regional endpoints when creating the service client as shown in:
556 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
557 c, err := recaptchaenterprise.NewClient(ctx)
558 if err != nil {
559 // TODO: Handle error.
560 }
561 defer c.Close()
562
563 req := &recaptchaenterprisepb.RetrieveLegacySecretKeyRequest{
564 // TODO: Fill request struct fields.
565 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#RetrieveLegacySecretKeyRequest.
566 }
567 resp, err := c.RetrieveLegacySecretKey(ctx, req)
568 if err != nil {
569 // TODO: Handle error.
570 }
571 // TODO: Use resp.
572 _ = resp
573 }
574
575 func ExampleClient_SearchRelatedAccountGroupMemberships() {
576 ctx := context.Background()
577 // This snippet has been automatically generated and should be regarded as a code template only.
578 // It will require modifications to work:
579 // - It may require correct/in-range values for request initialization.
580 // - It may require specifying regional endpoints when creating the service client as shown in:
581 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
582 c, err := recaptchaenterprise.NewClient(ctx)
583 if err != nil {
584 // TODO: Handle error.
585 }
586 defer c.Close()
587
588 req := &recaptchaenterprisepb.SearchRelatedAccountGroupMembershipsRequest{
589 // TODO: Fill request struct fields.
590 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#SearchRelatedAccountGroupMembershipsRequest.
591 }
592 it := c.SearchRelatedAccountGroupMemberships(ctx, req)
593 for {
594 resp, err := it.Next()
595 if err == iterator.Done {
596 break
597 }
598 if err != nil {
599 // TODO: Handle error.
600 }
601 // TODO: Use resp.
602 _ = resp
603
604 // If you need to access the underlying RPC response,
605 // you can do so by casting the `Response` as below.
606 // Otherwise, remove this line. Only populated after
607 // first call to Next(). Not safe for concurrent access.
608 _ = it.Response.(*recaptchaenterprisepb.SearchRelatedAccountGroupMembershipsResponse)
609 }
610 }
611
612 func ExampleClient_UpdateFirewallPolicy() {
613 ctx := context.Background()
614 // This snippet has been automatically generated and should be regarded as a code template only.
615 // It will require modifications to work:
616 // - It may require correct/in-range values for request initialization.
617 // - It may require specifying regional endpoints when creating the service client as shown in:
618 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
619 c, err := recaptchaenterprise.NewClient(ctx)
620 if err != nil {
621 // TODO: Handle error.
622 }
623 defer c.Close()
624
625 req := &recaptchaenterprisepb.UpdateFirewallPolicyRequest{
626 // TODO: Fill request struct fields.
627 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#UpdateFirewallPolicyRequest.
628 }
629 resp, err := c.UpdateFirewallPolicy(ctx, req)
630 if err != nil {
631 // TODO: Handle error.
632 }
633 // TODO: Use resp.
634 _ = resp
635 }
636
637 func ExampleClient_UpdateKey() {
638 ctx := context.Background()
639 // This snippet has been automatically generated and should be regarded as a code template only.
640 // It will require modifications to work:
641 // - It may require correct/in-range values for request initialization.
642 // - It may require specifying regional endpoints when creating the service client as shown in:
643 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
644 c, err := recaptchaenterprise.NewClient(ctx)
645 if err != nil {
646 // TODO: Handle error.
647 }
648 defer c.Close()
649
650 req := &recaptchaenterprisepb.UpdateKeyRequest{
651 // TODO: Fill request struct fields.
652 // See https://pkg.go.dev/cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb#UpdateKeyRequest.
653 }
654 resp, err := c.UpdateKey(ctx, req)
655 if err != nil {
656 // TODO: Handle error.
657 }
658 // TODO: Use resp.
659 _ = resp
660 }