Debian Codegraph @

domains/apiv1beta1/domains_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 domains_test
18
19 import (
20 "context"
21
22 domains "cloud.google.com/go/domains/apiv1beta1"
23 domainspb "cloud.google.com/go/domains/apiv1beta1/domainspb"
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 := domains.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 ExampleNewRESTClient() {
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 := domains.NewRESTClient(ctx)
52 if err != nil {
53 // TODO: Handle error.
54 }
55 defer c.Close()
56
57 // TODO: Use client.
58 _ = c
59 }
60
61 func ExampleClient_ConfigureContactSettings() {
62 ctx := context.Background()
63 // This snippet has been automatically generated and should be regarded as a code template only.
64 // It will require modifications to work:
65 // - It may require correct/in-range values for request initialization.
66 // - It may require specifying regional endpoints when creating the service client as shown in:
67 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
68 c, err := domains.NewClient(ctx)
69 if err != nil {
70 // TODO: Handle error.
71 }
72 defer c.Close()
73
74 req := &domainspb.ConfigureContactSettingsRequest{
75 // TODO: Fill request struct fields.
76 // See https://pkg.go.dev/cloud.google.com/go/domains/apiv1beta1/domainspb#ConfigureContactSettingsRequest.
77 }
78 op, err := c.ConfigureContactSettings(ctx, req)
79 if err != nil {
80 // TODO: Handle error.
81 }
82
83 resp, err := op.Wait(ctx)
84 if err != nil {
85 // TODO: Handle error.
86 }
87 // TODO: Use resp.
88 _ = resp
89 }
90
91 func ExampleClient_ConfigureDnsSettings() {
92 ctx := context.Background()
93 // This snippet has been automatically generated and should be regarded as a code template only.
94 // It will require modifications to work:
95 // - It may require correct/in-range values for request initialization.
96 // - It may require specifying regional endpoints when creating the service client as shown in:
97 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
98 c, err := domains.NewClient(ctx)
99 if err != nil {
100 // TODO: Handle error.
101 }
102 defer c.Close()
103
104 req := &domainspb.ConfigureDnsSettingsRequest{
105 // TODO: Fill request struct fields.
106 // See https://pkg.go.dev/cloud.google.com/go/domains/apiv1beta1/domainspb#ConfigureDnsSettingsRequest.
107 }
108 op, err := c.ConfigureDnsSettings(ctx, req)
109 if err != nil {
110 // TODO: Handle error.
111 }
112
113 resp, err := op.Wait(ctx)
114 if err != nil {
115 // TODO: Handle error.
116 }
117 // TODO: Use resp.
118 _ = resp
119 }
120
121 func ExampleClient_ConfigureManagementSettings() {
122 ctx := context.Background()
123 // This snippet has been automatically generated and should be regarded as a code template only.
124 // It will require modifications to work:
125 // - It may require correct/in-range values for request initialization.
126 // - It may require specifying regional endpoints when creating the service client as shown in:
127 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
128 c, err := domains.NewClient(ctx)
129 if err != nil {
130 // TODO: Handle error.
131 }
132 defer c.Close()
133
134 req := &domainspb.ConfigureManagementSettingsRequest{
135 // TODO: Fill request struct fields.
136 // See https://pkg.go.dev/cloud.google.com/go/domains/apiv1beta1/domainspb#ConfigureManagementSettingsRequest.
137 }
138 op, err := c.ConfigureManagementSettings(ctx, req)
139 if err != nil {
140 // TODO: Handle error.
141 }
142
143 resp, err := op.Wait(ctx)
144 if err != nil {
145 // TODO: Handle error.
146 }
147 // TODO: Use resp.
148 _ = resp
149 }
150
151 func ExampleClient_DeleteRegistration() {
152 ctx := context.Background()
153 // This snippet has been automatically generated and should be regarded as a code template only.
154 // It will require modifications to work:
155 // - It may require correct/in-range values for request initialization.
156 // - It may require specifying regional endpoints when creating the service client as shown in:
157 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
158 c, err := domains.NewClient(ctx)
159 if err != nil {
160 // TODO: Handle error.
161 }
162 defer c.Close()
163
164 req := &domainspb.DeleteRegistrationRequest{
165 // TODO: Fill request struct fields.
166 // See https://pkg.go.dev/cloud.google.com/go/domains/apiv1beta1/domainspb#DeleteRegistrationRequest.
167 }
168 op, err := c.DeleteRegistration(ctx, req)
169 if err != nil {
170 // TODO: Handle error.
171 }
172
173 err = op.Wait(ctx)
174 if err != nil {
175 // TODO: Handle error.
176 }
177 }
178
179 func ExampleClient_ExportRegistration() {
180 ctx := context.Background()
181 // This snippet has been automatically generated and should be regarded as a code template only.
182 // It will require modifications to work:
183 // - It may require correct/in-range values for request initialization.
184 // - It may require specifying regional endpoints when creating the service client as shown in:
185 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
186 c, err := domains.NewClient(ctx)
187 if err != nil {
188 // TODO: Handle error.
189 }
190 defer c.Close()
191
192 req := &domainspb.ExportRegistrationRequest{
193 // TODO: Fill request struct fields.
194 // See https://pkg.go.dev/cloud.google.com/go/domains/apiv1beta1/domainspb#ExportRegistrationRequest.
195 }
196 op, err := c.ExportRegistration(ctx, req)
197 if err != nil {
198 // TODO: Handle error.
199 }
200
201 resp, err := op.Wait(ctx)
202 if err != nil {
203 // TODO: Handle error.
204 }
205 // TODO: Use resp.
206 _ = resp
207 }
208
209 func ExampleClient_GetRegistration() {
210 ctx := context.Background()
211 // This snippet has been automatically generated and should be regarded as a code template only.
212 // It will require modifications to work:
213 // - It may require correct/in-range values for request initialization.
214 // - It may require specifying regional endpoints when creating the service client as shown in:
215 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
216 c, err := domains.NewClient(ctx)
217 if err != nil {
218 // TODO: Handle error.
219 }
220 defer c.Close()
221
222 req := &domainspb.GetRegistrationRequest{
223 // TODO: Fill request struct fields.
224 // See https://pkg.go.dev/cloud.google.com/go/domains/apiv1beta1/domainspb#GetRegistrationRequest.
225 }
226 resp, err := c.GetRegistration(ctx, req)
227 if err != nil {
228 // TODO: Handle error.
229 }
230 // TODO: Use resp.
231 _ = resp
232 }
233
234 func ExampleClient_ListRegistrations() {
235 ctx := context.Background()
236 // This snippet has been automatically generated and should be regarded as a code template only.
237 // It will require modifications to work:
238 // - It may require correct/in-range values for request initialization.
239 // - It may require specifying regional endpoints when creating the service client as shown in:
240 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
241 c, err := domains.NewClient(ctx)
242 if err != nil {
243 // TODO: Handle error.
244 }
245 defer c.Close()
246
247 req := &domainspb.ListRegistrationsRequest{
248 // TODO: Fill request struct fields.
249 // See https://pkg.go.dev/cloud.google.com/go/domains/apiv1beta1/domainspb#ListRegistrationsRequest.
250 }
251 it := c.ListRegistrations(ctx, req)
252 for {
253 resp, err := it.Next()
254 if err == iterator.Done {
255 break
256 }
257 if err != nil {
258 // TODO: Handle error.
259 }
260 // TODO: Use resp.
261 _ = resp
262
263 // If you need to access the underlying RPC response,
264 // you can do so by casting the `Response` as below.
265 // Otherwise, remove this line. Only populated after
266 // first call to Next(). Not safe for concurrent access.
267 _ = it.Response.(*domainspb.ListRegistrationsResponse)
268 }
269 }
270
271 func ExampleClient_RegisterDomain() {
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 := domains.NewClient(ctx)
279 if err != nil {
280 // TODO: Handle error.
281 }
282 defer c.Close()
283
284 req := &domainspb.RegisterDomainRequest{
285 // TODO: Fill request struct fields.
286 // See https://pkg.go.dev/cloud.google.com/go/domains/apiv1beta1/domainspb#RegisterDomainRequest.
287 }
288 op, err := c.RegisterDomain(ctx, req)
289 if err != nil {
290 // TODO: Handle error.
291 }
292
293 resp, err := op.Wait(ctx)
294 if err != nil {
295 // TODO: Handle error.
296 }
297 // TODO: Use resp.
298 _ = resp
299 }
300
301 func ExampleClient_ResetAuthorizationCode() {
302 ctx := context.Background()
303 // This snippet has been automatically generated and should be regarded as a code template only.
304 // It will require modifications to work:
305 // - It may require correct/in-range values for request initialization.
306 // - It may require specifying regional endpoints when creating the service client as shown in:
307 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
308 c, err := domains.NewClient(ctx)
309 if err != nil {
310 // TODO: Handle error.
311 }
312 defer c.Close()
313
314 req := &domainspb.ResetAuthorizationCodeRequest{
315 // TODO: Fill request struct fields.
316 // See https://pkg.go.dev/cloud.google.com/go/domains/apiv1beta1/domainspb#ResetAuthorizationCodeRequest.
317 }
318 resp, err := c.ResetAuthorizationCode(ctx, req)
319 if err != nil {
320 // TODO: Handle error.
321 }
322 // TODO: Use resp.
323 _ = resp
324 }
325
326 func ExampleClient_RetrieveAuthorizationCode() {
327 ctx := context.Background()
328 // This snippet has been automatically generated and should be regarded as a code template only.
329 // It will require modifications to work:
330 // - It may require correct/in-range values for request initialization.
331 // - It may require specifying regional endpoints when creating the service client as shown in:
332 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
333 c, err := domains.NewClient(ctx)
334 if err != nil {
335 // TODO: Handle error.
336 }
337 defer c.Close()
338
339 req := &domainspb.RetrieveAuthorizationCodeRequest{
340 // TODO: Fill request struct fields.
341 // See https://pkg.go.dev/cloud.google.com/go/domains/apiv1beta1/domainspb#RetrieveAuthorizationCodeRequest.
342 }
343 resp, err := c.RetrieveAuthorizationCode(ctx, req)
344 if err != nil {
345 // TODO: Handle error.
346 }
347 // TODO: Use resp.
348 _ = resp
349 }
350
351 func ExampleClient_RetrieveRegisterParameters() {
352 ctx := context.Background()
353 // This snippet has been automatically generated and should be regarded as a code template only.
354 // It will require modifications to work:
355 // - It may require correct/in-range values for request initialization.
356 // - It may require specifying regional endpoints when creating the service client as shown in:
357 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
358 c, err := domains.NewClient(ctx)
359 if err != nil {
360 // TODO: Handle error.
361 }
362 defer c.Close()
363
364 req := &domainspb.RetrieveRegisterParametersRequest{
365 // TODO: Fill request struct fields.
366 // See https://pkg.go.dev/cloud.google.com/go/domains/apiv1beta1/domainspb#RetrieveRegisterParametersRequest.
367 }
368 resp, err := c.RetrieveRegisterParameters(ctx, req)
369 if err != nil {
370 // TODO: Handle error.
371 }
372 // TODO: Use resp.
373 _ = resp
374 }
375
376 func ExampleClient_RetrieveTransferParameters() {
377 ctx := context.Background()
378 // This snippet has been automatically generated and should be regarded as a code template only.
379 // It will require modifications to work:
380 // - It may require correct/in-range values for request initialization.
381 // - It may require specifying regional endpoints when creating the service client as shown in:
382 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
383 c, err := domains.NewClient(ctx)
384 if err != nil {
385 // TODO: Handle error.
386 }
387 defer c.Close()
388
389 req := &domainspb.RetrieveTransferParametersRequest{
390 // TODO: Fill request struct fields.
391 // See https://pkg.go.dev/cloud.google.com/go/domains/apiv1beta1/domainspb#RetrieveTransferParametersRequest.
392 }
393 resp, err := c.RetrieveTransferParameters(ctx, req)
394 if err != nil {
395 // TODO: Handle error.
396 }
397 // TODO: Use resp.
398 _ = resp
399 }
400
401 func ExampleClient_SearchDomains() {
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 := domains.NewClient(ctx)
409 if err != nil {
410 // TODO: Handle error.
411 }
412 defer c.Close()
413
414 req := &domainspb.SearchDomainsRequest{
415 // TODO: Fill request struct fields.
416 // See https://pkg.go.dev/cloud.google.com/go/domains/apiv1beta1/domainspb#SearchDomainsRequest.
417 }
418 resp, err := c.SearchDomains(ctx, req)
419 if err != nil {
420 // TODO: Handle error.
421 }
422 // TODO: Use resp.
423 _ = resp
424 }
425
426 func ExampleClient_TransferDomain() {
427 ctx := context.Background()
428 // This snippet has been automatically generated and should be regarded as a code template only.
429 // It will require modifications to work:
430 // - It may require correct/in-range values for request initialization.
431 // - It may require specifying regional endpoints when creating the service client as shown in:
432 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
433 c, err := domains.NewClient(ctx)
434 if err != nil {
435 // TODO: Handle error.
436 }
437 defer c.Close()
438
439 req := &domainspb.TransferDomainRequest{
440 // TODO: Fill request struct fields.
441 // See https://pkg.go.dev/cloud.google.com/go/domains/apiv1beta1/domainspb#TransferDomainRequest.
442 }
443 op, err := c.TransferDomain(ctx, req)
444 if err != nil {
445 // TODO: Handle error.
446 }
447
448 resp, err := op.Wait(ctx)
449 if err != nil {
450 // TODO: Handle error.
451 }
452 // TODO: Use resp.
453 _ = resp
454 }
455
456 func ExampleClient_UpdateRegistration() {
457 ctx := context.Background()
458 // This snippet has been automatically generated and should be regarded as a code template only.
459 // It will require modifications to work:
460 // - It may require correct/in-range values for request initialization.
461 // - It may require specifying regional endpoints when creating the service client as shown in:
462 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
463 c, err := domains.NewClient(ctx)
464 if err != nil {
465 // TODO: Handle error.
466 }
467 defer c.Close()
468
469 req := &domainspb.UpdateRegistrationRequest{
470 // TODO: Fill request struct fields.
471 // See https://pkg.go.dev/cloud.google.com/go/domains/apiv1beta1/domainspb#UpdateRegistrationRequest.
472 }
473 op, err := c.UpdateRegistration(ctx, req)
474 if err != nil {
475 // TODO: Handle error.
476 }
477
478 resp, err := op.Wait(ctx)
479 if err != nil {
480 // TODO: Handle error.
481 }
482 // TODO: Use resp.
483 _ = resp
484 }