Debian Codegraph @

clouddms/apiv1/data_migration_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 clouddms_test
18
19 import (
20 "context"
21
22 clouddms "cloud.google.com/go/clouddms/apiv1"
23 clouddmspb "cloud.google.com/go/clouddms/apiv1/clouddmspb"
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 ExampleNewDataMigrationClient() {
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 := clouddms.NewDataMigrationClient(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 ExampleDataMigrationClient_ApplyConversionWorkspace() {
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 := clouddms.NewDataMigrationClient(ctx)
55 if err != nil {
56 // TODO: Handle error.
57 }
58 defer c.Close()
59
60 req := &clouddmspb.ApplyConversionWorkspaceRequest{
61 // TODO: Fill request struct fields.
62 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#ApplyConversionWorkspaceRequest.
63 }
64 op, err := c.ApplyConversionWorkspace(ctx, req)
65 if err != nil {
66 // TODO: Handle error.
67 }
68
69 resp, err := op.Wait(ctx)
70 if err != nil {
71 // TODO: Handle error.
72 }
73 // TODO: Use resp.
74 _ = resp
75 }
76
77 func ExampleDataMigrationClient_CommitConversionWorkspace() {
78 ctx := context.Background()
79 // This snippet has been automatically generated and should be regarded as a code template only.
80 // It will require modifications to work:
81 // - It may require correct/in-range values for request initialization.
82 // - It may require specifying regional endpoints when creating the service client as shown in:
83 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
84 c, err := clouddms.NewDataMigrationClient(ctx)
85 if err != nil {
86 // TODO: Handle error.
87 }
88 defer c.Close()
89
90 req := &clouddmspb.CommitConversionWorkspaceRequest{
91 // TODO: Fill request struct fields.
92 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#CommitConversionWorkspaceRequest.
93 }
94 op, err := c.CommitConversionWorkspace(ctx, req)
95 if err != nil {
96 // TODO: Handle error.
97 }
98
99 resp, err := op.Wait(ctx)
100 if err != nil {
101 // TODO: Handle error.
102 }
103 // TODO: Use resp.
104 _ = resp
105 }
106
107 func ExampleDataMigrationClient_ConvertConversionWorkspace() {
108 ctx := context.Background()
109 // This snippet has been automatically generated and should be regarded as a code template only.
110 // It will require modifications to work:
111 // - It may require correct/in-range values for request initialization.
112 // - It may require specifying regional endpoints when creating the service client as shown in:
113 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
114 c, err := clouddms.NewDataMigrationClient(ctx)
115 if err != nil {
116 // TODO: Handle error.
117 }
118 defer c.Close()
119
120 req := &clouddmspb.ConvertConversionWorkspaceRequest{
121 // TODO: Fill request struct fields.
122 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#ConvertConversionWorkspaceRequest.
123 }
124 op, err := c.ConvertConversionWorkspace(ctx, req)
125 if err != nil {
126 // TODO: Handle error.
127 }
128
129 resp, err := op.Wait(ctx)
130 if err != nil {
131 // TODO: Handle error.
132 }
133 // TODO: Use resp.
134 _ = resp
135 }
136
137 func ExampleDataMigrationClient_CreateConnectionProfile() {
138 ctx := context.Background()
139 // This snippet has been automatically generated and should be regarded as a code template only.
140 // It will require modifications to work:
141 // - It may require correct/in-range values for request initialization.
142 // - It may require specifying regional endpoints when creating the service client as shown in:
143 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
144 c, err := clouddms.NewDataMigrationClient(ctx)
145 if err != nil {
146 // TODO: Handle error.
147 }
148 defer c.Close()
149
150 req := &clouddmspb.CreateConnectionProfileRequest{
151 // TODO: Fill request struct fields.
152 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#CreateConnectionProfileRequest.
153 }
154 op, err := c.CreateConnectionProfile(ctx, req)
155 if err != nil {
156 // TODO: Handle error.
157 }
158
159 resp, err := op.Wait(ctx)
160 if err != nil {
161 // TODO: Handle error.
162 }
163 // TODO: Use resp.
164 _ = resp
165 }
166
167 func ExampleDataMigrationClient_CreateConversionWorkspace() {
168 ctx := context.Background()
169 // This snippet has been automatically generated and should be regarded as a code template only.
170 // It will require modifications to work:
171 // - It may require correct/in-range values for request initialization.
172 // - It may require specifying regional endpoints when creating the service client as shown in:
173 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
174 c, err := clouddms.NewDataMigrationClient(ctx)
175 if err != nil {
176 // TODO: Handle error.
177 }
178 defer c.Close()
179
180 req := &clouddmspb.CreateConversionWorkspaceRequest{
181 // TODO: Fill request struct fields.
182 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#CreateConversionWorkspaceRequest.
183 }
184 op, err := c.CreateConversionWorkspace(ctx, req)
185 if err != nil {
186 // TODO: Handle error.
187 }
188
189 resp, err := op.Wait(ctx)
190 if err != nil {
191 // TODO: Handle error.
192 }
193 // TODO: Use resp.
194 _ = resp
195 }
196
197 func ExampleDataMigrationClient_CreateMappingRule() {
198 ctx := context.Background()
199 // This snippet has been automatically generated and should be regarded as a code template only.
200 // It will require modifications to work:
201 // - It may require correct/in-range values for request initialization.
202 // - It may require specifying regional endpoints when creating the service client as shown in:
203 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
204 c, err := clouddms.NewDataMigrationClient(ctx)
205 if err != nil {
206 // TODO: Handle error.
207 }
208 defer c.Close()
209
210 req := &clouddmspb.CreateMappingRuleRequest{
211 // TODO: Fill request struct fields.
212 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#CreateMappingRuleRequest.
213 }
214 resp, err := c.CreateMappingRule(ctx, req)
215 if err != nil {
216 // TODO: Handle error.
217 }
218 // TODO: Use resp.
219 _ = resp
220 }
221
222 func ExampleDataMigrationClient_CreateMigrationJob() {
223 ctx := context.Background()
224 // This snippet has been automatically generated and should be regarded as a code template only.
225 // It will require modifications to work:
226 // - It may require correct/in-range values for request initialization.
227 // - It may require specifying regional endpoints when creating the service client as shown in:
228 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
229 c, err := clouddms.NewDataMigrationClient(ctx)
230 if err != nil {
231 // TODO: Handle error.
232 }
233 defer c.Close()
234
235 req := &clouddmspb.CreateMigrationJobRequest{
236 // TODO: Fill request struct fields.
237 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#CreateMigrationJobRequest.
238 }
239 op, err := c.CreateMigrationJob(ctx, req)
240 if err != nil {
241 // TODO: Handle error.
242 }
243
244 resp, err := op.Wait(ctx)
245 if err != nil {
246 // TODO: Handle error.
247 }
248 // TODO: Use resp.
249 _ = resp
250 }
251
252 func ExampleDataMigrationClient_CreatePrivateConnection() {
253 ctx := context.Background()
254 // This snippet has been automatically generated and should be regarded as a code template only.
255 // It will require modifications to work:
256 // - It may require correct/in-range values for request initialization.
257 // - It may require specifying regional endpoints when creating the service client as shown in:
258 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
259 c, err := clouddms.NewDataMigrationClient(ctx)
260 if err != nil {
261 // TODO: Handle error.
262 }
263 defer c.Close()
264
265 req := &clouddmspb.CreatePrivateConnectionRequest{
266 // TODO: Fill request struct fields.
267 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#CreatePrivateConnectionRequest.
268 }
269 op, err := c.CreatePrivateConnection(ctx, req)
270 if err != nil {
271 // TODO: Handle error.
272 }
273
274 resp, err := op.Wait(ctx)
275 if err != nil {
276 // TODO: Handle error.
277 }
278 // TODO: Use resp.
279 _ = resp
280 }
281
282 func ExampleDataMigrationClient_DeleteConnectionProfile() {
283 ctx := context.Background()
284 // This snippet has been automatically generated and should be regarded as a code template only.
285 // It will require modifications to work:
286 // - It may require correct/in-range values for request initialization.
287 // - It may require specifying regional endpoints when creating the service client as shown in:
288 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
289 c, err := clouddms.NewDataMigrationClient(ctx)
290 if err != nil {
291 // TODO: Handle error.
292 }
293 defer c.Close()
294
295 req := &clouddmspb.DeleteConnectionProfileRequest{
296 // TODO: Fill request struct fields.
297 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#DeleteConnectionProfileRequest.
298 }
299 op, err := c.DeleteConnectionProfile(ctx, req)
300 if err != nil {
301 // TODO: Handle error.
302 }
303
304 err = op.Wait(ctx)
305 if err != nil {
306 // TODO: Handle error.
307 }
308 }
309
310 func ExampleDataMigrationClient_DeleteConversionWorkspace() {
311 ctx := context.Background()
312 // This snippet has been automatically generated and should be regarded as a code template only.
313 // It will require modifications to work:
314 // - It may require correct/in-range values for request initialization.
315 // - It may require specifying regional endpoints when creating the service client as shown in:
316 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
317 c, err := clouddms.NewDataMigrationClient(ctx)
318 if err != nil {
319 // TODO: Handle error.
320 }
321 defer c.Close()
322
323 req := &clouddmspb.DeleteConversionWorkspaceRequest{
324 // TODO: Fill request struct fields.
325 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#DeleteConversionWorkspaceRequest.
326 }
327 op, err := c.DeleteConversionWorkspace(ctx, req)
328 if err != nil {
329 // TODO: Handle error.
330 }
331
332 err = op.Wait(ctx)
333 if err != nil {
334 // TODO: Handle error.
335 }
336 }
337
338 func ExampleDataMigrationClient_DeleteMappingRule() {
339 ctx := context.Background()
340 // This snippet has been automatically generated and should be regarded as a code template only.
341 // It will require modifications to work:
342 // - It may require correct/in-range values for request initialization.
343 // - It may require specifying regional endpoints when creating the service client as shown in:
344 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
345 c, err := clouddms.NewDataMigrationClient(ctx)
346 if err != nil {
347 // TODO: Handle error.
348 }
349 defer c.Close()
350
351 req := &clouddmspb.DeleteMappingRuleRequest{
352 // TODO: Fill request struct fields.
353 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#DeleteMappingRuleRequest.
354 }
355 err = c.DeleteMappingRule(ctx, req)
356 if err != nil {
357 // TODO: Handle error.
358 }
359 }
360
361 func ExampleDataMigrationClient_DeleteMigrationJob() {
362 ctx := context.Background()
363 // This snippet has been automatically generated and should be regarded as a code template only.
364 // It will require modifications to work:
365 // - It may require correct/in-range values for request initialization.
366 // - It may require specifying regional endpoints when creating the service client as shown in:
367 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
368 c, err := clouddms.NewDataMigrationClient(ctx)
369 if err != nil {
370 // TODO: Handle error.
371 }
372 defer c.Close()
373
374 req := &clouddmspb.DeleteMigrationJobRequest{
375 // TODO: Fill request struct fields.
376 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#DeleteMigrationJobRequest.
377 }
378 op, err := c.DeleteMigrationJob(ctx, req)
379 if err != nil {
380 // TODO: Handle error.
381 }
382
383 err = op.Wait(ctx)
384 if err != nil {
385 // TODO: Handle error.
386 }
387 }
388
389 func ExampleDataMigrationClient_DeletePrivateConnection() {
390 ctx := context.Background()
391 // This snippet has been automatically generated and should be regarded as a code template only.
392 // It will require modifications to work:
393 // - It may require correct/in-range values for request initialization.
394 // - It may require specifying regional endpoints when creating the service client as shown in:
395 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
396 c, err := clouddms.NewDataMigrationClient(ctx)
397 if err != nil {
398 // TODO: Handle error.
399 }
400 defer c.Close()
401
402 req := &clouddmspb.DeletePrivateConnectionRequest{
403 // TODO: Fill request struct fields.
404 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#DeletePrivateConnectionRequest.
405 }
406 op, err := c.DeletePrivateConnection(ctx, req)
407 if err != nil {
408 // TODO: Handle error.
409 }
410
411 err = op.Wait(ctx)
412 if err != nil {
413 // TODO: Handle error.
414 }
415 }
416
417 func ExampleDataMigrationClient_DescribeConversionWorkspaceRevisions() {
418 ctx := context.Background()
419 // This snippet has been automatically generated and should be regarded as a code template only.
420 // It will require modifications to work:
421 // - It may require correct/in-range values for request initialization.
422 // - It may require specifying regional endpoints when creating the service client as shown in:
423 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
424 c, err := clouddms.NewDataMigrationClient(ctx)
425 if err != nil {
426 // TODO: Handle error.
427 }
428 defer c.Close()
429
430 req := &clouddmspb.DescribeConversionWorkspaceRevisionsRequest{
431 // TODO: Fill request struct fields.
432 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#DescribeConversionWorkspaceRevisionsRequest.
433 }
434 resp, err := c.DescribeConversionWorkspaceRevisions(ctx, req)
435 if err != nil {
436 // TODO: Handle error.
437 }
438 // TODO: Use resp.
439 _ = resp
440 }
441
442 func ExampleDataMigrationClient_DescribeDatabaseEntities() {
443 ctx := context.Background()
444 // This snippet has been automatically generated and should be regarded as a code template only.
445 // It will require modifications to work:
446 // - It may require correct/in-range values for request initialization.
447 // - It may require specifying regional endpoints when creating the service client as shown in:
448 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
449 c, err := clouddms.NewDataMigrationClient(ctx)
450 if err != nil {
451 // TODO: Handle error.
452 }
453 defer c.Close()
454
455 req := &clouddmspb.DescribeDatabaseEntitiesRequest{
456 // TODO: Fill request struct fields.
457 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#DescribeDatabaseEntitiesRequest.
458 }
459 it := c.DescribeDatabaseEntities(ctx, req)
460 for {
461 resp, err := it.Next()
462 if err == iterator.Done {
463 break
464 }
465 if err != nil {
466 // TODO: Handle error.
467 }
468 // TODO: Use resp.
469 _ = resp
470
471 // If you need to access the underlying RPC response,
472 // you can do so by casting the `Response` as below.
473 // Otherwise, remove this line. Only populated after
474 // first call to Next(). Not safe for concurrent access.
475 _ = it.Response.(*clouddmspb.DescribeDatabaseEntitiesResponse)
476 }
477 }
478
479 func ExampleDataMigrationClient_FetchStaticIps() {
480 ctx := context.Background()
481 // This snippet has been automatically generated and should be regarded as a code template only.
482 // It will require modifications to work:
483 // - It may require correct/in-range values for request initialization.
484 // - It may require specifying regional endpoints when creating the service client as shown in:
485 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
486 c, err := clouddms.NewDataMigrationClient(ctx)
487 if err != nil {
488 // TODO: Handle error.
489 }
490 defer c.Close()
491
492 req := &clouddmspb.FetchStaticIpsRequest{
493 // TODO: Fill request struct fields.
494 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#FetchStaticIpsRequest.
495 }
496 it := c.FetchStaticIps(ctx, req)
497 for {
498 resp, err := it.Next()
499 if err == iterator.Done {
500 break
501 }
502 if err != nil {
503 // TODO: Handle error.
504 }
505 // TODO: Use resp.
506 _ = resp
507
508 // If you need to access the underlying RPC response,
509 // you can do so by casting the `Response` as below.
510 // Otherwise, remove this line. Only populated after
511 // first call to Next(). Not safe for concurrent access.
512 _ = it.Response.(*clouddmspb.FetchStaticIpsResponse)
513 }
514 }
515
516 func ExampleDataMigrationClient_GenerateSshScript() {
517 ctx := context.Background()
518 // This snippet has been automatically generated and should be regarded as a code template only.
519 // It will require modifications to work:
520 // - It may require correct/in-range values for request initialization.
521 // - It may require specifying regional endpoints when creating the service client as shown in:
522 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
523 c, err := clouddms.NewDataMigrationClient(ctx)
524 if err != nil {
525 // TODO: Handle error.
526 }
527 defer c.Close()
528
529 req := &clouddmspb.GenerateSshScriptRequest{
530 // TODO: Fill request struct fields.
531 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#GenerateSshScriptRequest.
532 }
533 resp, err := c.GenerateSshScript(ctx, req)
534 if err != nil {
535 // TODO: Handle error.
536 }
537 // TODO: Use resp.
538 _ = resp
539 }
540
541 func ExampleDataMigrationClient_GenerateTcpProxyScript() {
542 ctx := context.Background()
543 // This snippet has been automatically generated and should be regarded as a code template only.
544 // It will require modifications to work:
545 // - It may require correct/in-range values for request initialization.
546 // - It may require specifying regional endpoints when creating the service client as shown in:
547 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
548 c, err := clouddms.NewDataMigrationClient(ctx)
549 if err != nil {
550 // TODO: Handle error.
551 }
552 defer c.Close()
553
554 req := &clouddmspb.GenerateTcpProxyScriptRequest{
555 // TODO: Fill request struct fields.
556 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#GenerateTcpProxyScriptRequest.
557 }
558 resp, err := c.GenerateTcpProxyScript(ctx, req)
559 if err != nil {
560 // TODO: Handle error.
561 }
562 // TODO: Use resp.
563 _ = resp
564 }
565
566 func ExampleDataMigrationClient_GetConnectionProfile() {
567 ctx := context.Background()
568 // This snippet has been automatically generated and should be regarded as a code template only.
569 // It will require modifications to work:
570 // - It may require correct/in-range values for request initialization.
571 // - It may require specifying regional endpoints when creating the service client as shown in:
572 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
573 c, err := clouddms.NewDataMigrationClient(ctx)
574 if err != nil {
575 // TODO: Handle error.
576 }
577 defer c.Close()
578
579 req := &clouddmspb.GetConnectionProfileRequest{
580 // TODO: Fill request struct fields.
581 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#GetConnectionProfileRequest.
582 }
583 resp, err := c.GetConnectionProfile(ctx, req)
584 if err != nil {
585 // TODO: Handle error.
586 }
587 // TODO: Use resp.
588 _ = resp
589 }
590
591 func ExampleDataMigrationClient_GetConversionWorkspace() {
592 ctx := context.Background()
593 // This snippet has been automatically generated and should be regarded as a code template only.
594 // It will require modifications to work:
595 // - It may require correct/in-range values for request initialization.
596 // - It may require specifying regional endpoints when creating the service client as shown in:
597 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
598 c, err := clouddms.NewDataMigrationClient(ctx)
599 if err != nil {
600 // TODO: Handle error.
601 }
602 defer c.Close()
603
604 req := &clouddmspb.GetConversionWorkspaceRequest{
605 // TODO: Fill request struct fields.
606 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#GetConversionWorkspaceRequest.
607 }
608 resp, err := c.GetConversionWorkspace(ctx, req)
609 if err != nil {
610 // TODO: Handle error.
611 }
612 // TODO: Use resp.
613 _ = resp
614 }
615
616 func ExampleDataMigrationClient_GetMappingRule() {
617 ctx := context.Background()
618 // This snippet has been automatically generated and should be regarded as a code template only.
619 // It will require modifications to work:
620 // - It may require correct/in-range values for request initialization.
621 // - It may require specifying regional endpoints when creating the service client as shown in:
622 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
623 c, err := clouddms.NewDataMigrationClient(ctx)
624 if err != nil {
625 // TODO: Handle error.
626 }
627 defer c.Close()
628
629 req := &clouddmspb.GetMappingRuleRequest{
630 // TODO: Fill request struct fields.
631 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#GetMappingRuleRequest.
632 }
633 resp, err := c.GetMappingRule(ctx, req)
634 if err != nil {
635 // TODO: Handle error.
636 }
637 // TODO: Use resp.
638 _ = resp
639 }
640
641 func ExampleDataMigrationClient_GetMigrationJob() {
642 ctx := context.Background()
643 // This snippet has been automatically generated and should be regarded as a code template only.
644 // It will require modifications to work:
645 // - It may require correct/in-range values for request initialization.
646 // - It may require specifying regional endpoints when creating the service client as shown in:
647 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
648 c, err := clouddms.NewDataMigrationClient(ctx)
649 if err != nil {
650 // TODO: Handle error.
651 }
652 defer c.Close()
653
654 req := &clouddmspb.GetMigrationJobRequest{
655 // TODO: Fill request struct fields.
656 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#GetMigrationJobRequest.
657 }
658 resp, err := c.GetMigrationJob(ctx, req)
659 if err != nil {
660 // TODO: Handle error.
661 }
662 // TODO: Use resp.
663 _ = resp
664 }
665
666 func ExampleDataMigrationClient_GetPrivateConnection() {
667 ctx := context.Background()
668 // This snippet has been automatically generated and should be regarded as a code template only.
669 // It will require modifications to work:
670 // - It may require correct/in-range values for request initialization.
671 // - It may require specifying regional endpoints when creating the service client as shown in:
672 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
673 c, err := clouddms.NewDataMigrationClient(ctx)
674 if err != nil {
675 // TODO: Handle error.
676 }
677 defer c.Close()
678
679 req := &clouddmspb.GetPrivateConnectionRequest{
680 // TODO: Fill request struct fields.
681 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#GetPrivateConnectionRequest.
682 }
683 resp, err := c.GetPrivateConnection(ctx, req)
684 if err != nil {
685 // TODO: Handle error.
686 }
687 // TODO: Use resp.
688 _ = resp
689 }
690
691 func ExampleDataMigrationClient_ImportMappingRules() {
692 ctx := context.Background()
693 // This snippet has been automatically generated and should be regarded as a code template only.
694 // It will require modifications to work:
695 // - It may require correct/in-range values for request initialization.
696 // - It may require specifying regional endpoints when creating the service client as shown in:
697 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
698 c, err := clouddms.NewDataMigrationClient(ctx)
699 if err != nil {
700 // TODO: Handle error.
701 }
702 defer c.Close()
703
704 req := &clouddmspb.ImportMappingRulesRequest{
705 // TODO: Fill request struct fields.
706 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#ImportMappingRulesRequest.
707 }
708 op, err := c.ImportMappingRules(ctx, req)
709 if err != nil {
710 // TODO: Handle error.
711 }
712
713 resp, err := op.Wait(ctx)
714 if err != nil {
715 // TODO: Handle error.
716 }
717 // TODO: Use resp.
718 _ = resp
719 }
720
721 func ExampleDataMigrationClient_ListConnectionProfiles() {
722 ctx := context.Background()
723 // This snippet has been automatically generated and should be regarded as a code template only.
724 // It will require modifications to work:
725 // - It may require correct/in-range values for request initialization.
726 // - It may require specifying regional endpoints when creating the service client as shown in:
727 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
728 c, err := clouddms.NewDataMigrationClient(ctx)
729 if err != nil {
730 // TODO: Handle error.
731 }
732 defer c.Close()
733
734 req := &clouddmspb.ListConnectionProfilesRequest{
735 // TODO: Fill request struct fields.
736 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#ListConnectionProfilesRequest.
737 }
738 it := c.ListConnectionProfiles(ctx, req)
739 for {
740 resp, err := it.Next()
741 if err == iterator.Done {
742 break
743 }
744 if err != nil {
745 // TODO: Handle error.
746 }
747 // TODO: Use resp.
748 _ = resp
749
750 // If you need to access the underlying RPC response,
751 // you can do so by casting the `Response` as below.
752 // Otherwise, remove this line. Only populated after
753 // first call to Next(). Not safe for concurrent access.
754 _ = it.Response.(*clouddmspb.ListConnectionProfilesResponse)
755 }
756 }
757
758 func ExampleDataMigrationClient_ListConversionWorkspaces() {
759 ctx := context.Background()
760 // This snippet has been automatically generated and should be regarded as a code template only.
761 // It will require modifications to work:
762 // - It may require correct/in-range values for request initialization.
763 // - It may require specifying regional endpoints when creating the service client as shown in:
764 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
765 c, err := clouddms.NewDataMigrationClient(ctx)
766 if err != nil {
767 // TODO: Handle error.
768 }
769 defer c.Close()
770
771 req := &clouddmspb.ListConversionWorkspacesRequest{
772 // TODO: Fill request struct fields.
773 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#ListConversionWorkspacesRequest.
774 }
775 it := c.ListConversionWorkspaces(ctx, req)
776 for {
777 resp, err := it.Next()
778 if err == iterator.Done {
779 break
780 }
781 if err != nil {
782 // TODO: Handle error.
783 }
784 // TODO: Use resp.
785 _ = resp
786
787 // If you need to access the underlying RPC response,
788 // you can do so by casting the `Response` as below.
789 // Otherwise, remove this line. Only populated after
790 // first call to Next(). Not safe for concurrent access.
791 _ = it.Response.(*clouddmspb.ListConversionWorkspacesResponse)
792 }
793 }
794
795 func ExampleDataMigrationClient_ListMappingRules() {
796 ctx := context.Background()
797 // This snippet has been automatically generated and should be regarded as a code template only.
798 // It will require modifications to work:
799 // - It may require correct/in-range values for request initialization.
800 // - It may require specifying regional endpoints when creating the service client as shown in:
801 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
802 c, err := clouddms.NewDataMigrationClient(ctx)
803 if err != nil {
804 // TODO: Handle error.
805 }
806 defer c.Close()
807
808 req := &clouddmspb.ListMappingRulesRequest{
809 // TODO: Fill request struct fields.
810 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#ListMappingRulesRequest.
811 }
812 it := c.ListMappingRules(ctx, req)
813 for {
814 resp, err := it.Next()
815 if err == iterator.Done {
816 break
817 }
818 if err != nil {
819 // TODO: Handle error.
820 }
821 // TODO: Use resp.
822 _ = resp
823
824 // If you need to access the underlying RPC response,
825 // you can do so by casting the `Response` as below.
826 // Otherwise, remove this line. Only populated after
827 // first call to Next(). Not safe for concurrent access.
828 _ = it.Response.(*clouddmspb.ListMappingRulesResponse)
829 }
830 }
831
832 func ExampleDataMigrationClient_ListMigrationJobs() {
833 ctx := context.Background()
834 // This snippet has been automatically generated and should be regarded as a code template only.
835 // It will require modifications to work:
836 // - It may require correct/in-range values for request initialization.
837 // - It may require specifying regional endpoints when creating the service client as shown in:
838 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
839 c, err := clouddms.NewDataMigrationClient(ctx)
840 if err != nil {
841 // TODO: Handle error.
842 }
843 defer c.Close()
844
845 req := &clouddmspb.ListMigrationJobsRequest{
846 // TODO: Fill request struct fields.
847 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#ListMigrationJobsRequest.
848 }
849 it := c.ListMigrationJobs(ctx, req)
850 for {
851 resp, err := it.Next()
852 if err == iterator.Done {
853 break
854 }
855 if err != nil {
856 // TODO: Handle error.
857 }
858 // TODO: Use resp.
859 _ = resp
860
861 // If you need to access the underlying RPC response,
862 // you can do so by casting the `Response` as below.
863 // Otherwise, remove this line. Only populated after
864 // first call to Next(). Not safe for concurrent access.
865 _ = it.Response.(*clouddmspb.ListMigrationJobsResponse)
866 }
867 }
868
869 func ExampleDataMigrationClient_ListPrivateConnections() {
870 ctx := context.Background()
871 // This snippet has been automatically generated and should be regarded as a code template only.
872 // It will require modifications to work:
873 // - It may require correct/in-range values for request initialization.
874 // - It may require specifying regional endpoints when creating the service client as shown in:
875 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
876 c, err := clouddms.NewDataMigrationClient(ctx)
877 if err != nil {
878 // TODO: Handle error.
879 }
880 defer c.Close()
881
882 req := &clouddmspb.ListPrivateConnectionsRequest{
883 // TODO: Fill request struct fields.
884 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#ListPrivateConnectionsRequest.
885 }
886 it := c.ListPrivateConnections(ctx, req)
887 for {
888 resp, err := it.Next()
889 if err == iterator.Done {
890 break
891 }
892 if err != nil {
893 // TODO: Handle error.
894 }
895 // TODO: Use resp.
896 _ = resp
897
898 // If you need to access the underlying RPC response,
899 // you can do so by casting the `Response` as below.
900 // Otherwise, remove this line. Only populated after
901 // first call to Next(). Not safe for concurrent access.
902 _ = it.Response.(*clouddmspb.ListPrivateConnectionsResponse)
903 }
904 }
905
906 func ExampleDataMigrationClient_PromoteMigrationJob() {
907 ctx := context.Background()
908 // This snippet has been automatically generated and should be regarded as a code template only.
909 // It will require modifications to work:
910 // - It may require correct/in-range values for request initialization.
911 // - It may require specifying regional endpoints when creating the service client as shown in:
912 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
913 c, err := clouddms.NewDataMigrationClient(ctx)
914 if err != nil {
915 // TODO: Handle error.
916 }
917 defer c.Close()
918
919 req := &clouddmspb.PromoteMigrationJobRequest{
920 // TODO: Fill request struct fields.
921 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#PromoteMigrationJobRequest.
922 }
923 op, err := c.PromoteMigrationJob(ctx, req)
924 if err != nil {
925 // TODO: Handle error.
926 }
927
928 resp, err := op.Wait(ctx)
929 if err != nil {
930 // TODO: Handle error.
931 }
932 // TODO: Use resp.
933 _ = resp
934 }
935
936 func ExampleDataMigrationClient_RestartMigrationJob() {
937 ctx := context.Background()
938 // This snippet has been automatically generated and should be regarded as a code template only.
939 // It will require modifications to work:
940 // - It may require correct/in-range values for request initialization.
941 // - It may require specifying regional endpoints when creating the service client as shown in:
942 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
943 c, err := clouddms.NewDataMigrationClient(ctx)
944 if err != nil {
945 // TODO: Handle error.
946 }
947 defer c.Close()
948
949 req := &clouddmspb.RestartMigrationJobRequest{
950 // TODO: Fill request struct fields.
951 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#RestartMigrationJobRequest.
952 }
953 op, err := c.RestartMigrationJob(ctx, req)
954 if err != nil {
955 // TODO: Handle error.
956 }
957
958 resp, err := op.Wait(ctx)
959 if err != nil {
960 // TODO: Handle error.
961 }
962 // TODO: Use resp.
963 _ = resp
964 }
965
966 func ExampleDataMigrationClient_ResumeMigrationJob() {
967 ctx := context.Background()
968 // This snippet has been automatically generated and should be regarded as a code template only.
969 // It will require modifications to work:
970 // - It may require correct/in-range values for request initialization.
971 // - It may require specifying regional endpoints when creating the service client as shown in:
972 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
973 c, err := clouddms.NewDataMigrationClient(ctx)
974 if err != nil {
975 // TODO: Handle error.
976 }
977 defer c.Close()
978
979 req := &clouddmspb.ResumeMigrationJobRequest{
980 // TODO: Fill request struct fields.
981 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#ResumeMigrationJobRequest.
982 }
983 op, err := c.ResumeMigrationJob(ctx, req)
984 if err != nil {
985 // TODO: Handle error.
986 }
987
988 resp, err := op.Wait(ctx)
989 if err != nil {
990 // TODO: Handle error.
991 }
992 // TODO: Use resp.
993 _ = resp
994 }
995
996 func ExampleDataMigrationClient_RollbackConversionWorkspace() {
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 := clouddms.NewDataMigrationClient(ctx)
1004 if err != nil {
1005 // TODO: Handle error.
1006 }
1007 defer c.Close()
1008
1009 req := &clouddmspb.RollbackConversionWorkspaceRequest{
1010 // TODO: Fill request struct fields.
1011 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#RollbackConversionWorkspaceRequest.
1012 }
1013 op, err := c.RollbackConversionWorkspace(ctx, req)
1014 if err != nil {
1015 // TODO: Handle error.
1016 }
1017
1018 resp, err := op.Wait(ctx)
1019 if err != nil {
1020 // TODO: Handle error.
1021 }
1022 // TODO: Use resp.
1023 _ = resp
1024 }
1025
1026 func ExampleDataMigrationClient_SearchBackgroundJobs() {
1027 ctx := context.Background()
1028 // This snippet has been automatically generated and should be regarded as a code template only.
1029 // It will require modifications to work:
1030 // - It may require correct/in-range values for request initialization.
1031 // - It may require specifying regional endpoints when creating the service client as shown in:
1032 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1033 c, err := clouddms.NewDataMigrationClient(ctx)
1034 if err != nil {
1035 // TODO: Handle error.
1036 }
1037 defer c.Close()
1038
1039 req := &clouddmspb.SearchBackgroundJobsRequest{
1040 // TODO: Fill request struct fields.
1041 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#SearchBackgroundJobsRequest.
1042 }
1043 resp, err := c.SearchBackgroundJobs(ctx, req)
1044 if err != nil {
1045 // TODO: Handle error.
1046 }
1047 // TODO: Use resp.
1048 _ = resp
1049 }
1050
1051 func ExampleDataMigrationClient_SeedConversionWorkspace() {
1052 ctx := context.Background()
1053 // This snippet has been automatically generated and should be regarded as a code template only.
1054 // It will require modifications to work:
1055 // - It may require correct/in-range values for request initialization.
1056 // - It may require specifying regional endpoints when creating the service client as shown in:
1057 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1058 c, err := clouddms.NewDataMigrationClient(ctx)
1059 if err != nil {
1060 // TODO: Handle error.
1061 }
1062 defer c.Close()
1063
1064 req := &clouddmspb.SeedConversionWorkspaceRequest{
1065 // TODO: Fill request struct fields.
1066 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#SeedConversionWorkspaceRequest.
1067 }
1068 op, err := c.SeedConversionWorkspace(ctx, req)
1069 if err != nil {
1070 // TODO: Handle error.
1071 }
1072
1073 resp, err := op.Wait(ctx)
1074 if err != nil {
1075 // TODO: Handle error.
1076 }
1077 // TODO: Use resp.
1078 _ = resp
1079 }
1080
1081 func ExampleDataMigrationClient_StartMigrationJob() {
1082 ctx := context.Background()
1083 // This snippet has been automatically generated and should be regarded as a code template only.
1084 // It will require modifications to work:
1085 // - It may require correct/in-range values for request initialization.
1086 // - It may require specifying regional endpoints when creating the service client as shown in:
1087 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1088 c, err := clouddms.NewDataMigrationClient(ctx)
1089 if err != nil {
1090 // TODO: Handle error.
1091 }
1092 defer c.Close()
1093
1094 req := &clouddmspb.StartMigrationJobRequest{
1095 // TODO: Fill request struct fields.
1096 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#StartMigrationJobRequest.
1097 }
1098 op, err := c.StartMigrationJob(ctx, req)
1099 if err != nil {
1100 // TODO: Handle error.
1101 }
1102
1103 resp, err := op.Wait(ctx)
1104 if err != nil {
1105 // TODO: Handle error.
1106 }
1107 // TODO: Use resp.
1108 _ = resp
1109 }
1110
1111 func ExampleDataMigrationClient_StopMigrationJob() {
1112 ctx := context.Background()
1113 // This snippet has been automatically generated and should be regarded as a code template only.
1114 // It will require modifications to work:
1115 // - It may require correct/in-range values for request initialization.
1116 // - It may require specifying regional endpoints when creating the service client as shown in:
1117 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1118 c, err := clouddms.NewDataMigrationClient(ctx)
1119 if err != nil {
1120 // TODO: Handle error.
1121 }
1122 defer c.Close()
1123
1124 req := &clouddmspb.StopMigrationJobRequest{
1125 // TODO: Fill request struct fields.
1126 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#StopMigrationJobRequest.
1127 }
1128 op, err := c.StopMigrationJob(ctx, req)
1129 if err != nil {
1130 // TODO: Handle error.
1131 }
1132
1133 resp, err := op.Wait(ctx)
1134 if err != nil {
1135 // TODO: Handle error.
1136 }
1137 // TODO: Use resp.
1138 _ = resp
1139 }
1140
1141 func ExampleDataMigrationClient_UpdateConnectionProfile() {
1142 ctx := context.Background()
1143 // This snippet has been automatically generated and should be regarded as a code template only.
1144 // It will require modifications to work:
1145 // - It may require correct/in-range values for request initialization.
1146 // - It may require specifying regional endpoints when creating the service client as shown in:
1147 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1148 c, err := clouddms.NewDataMigrationClient(ctx)
1149 if err != nil {
1150 // TODO: Handle error.
1151 }
1152 defer c.Close()
1153
1154 req := &clouddmspb.UpdateConnectionProfileRequest{
1155 // TODO: Fill request struct fields.
1156 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#UpdateConnectionProfileRequest.
1157 }
1158 op, err := c.UpdateConnectionProfile(ctx, req)
1159 if err != nil {
1160 // TODO: Handle error.
1161 }
1162
1163 resp, err := op.Wait(ctx)
1164 if err != nil {
1165 // TODO: Handle error.
1166 }
1167 // TODO: Use resp.
1168 _ = resp
1169 }
1170
1171 func ExampleDataMigrationClient_UpdateConversionWorkspace() {
1172 ctx := context.Background()
1173 // This snippet has been automatically generated and should be regarded as a code template only.
1174 // It will require modifications to work:
1175 // - It may require correct/in-range values for request initialization.
1176 // - It may require specifying regional endpoints when creating the service client as shown in:
1177 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1178 c, err := clouddms.NewDataMigrationClient(ctx)
1179 if err != nil {
1180 // TODO: Handle error.
1181 }
1182 defer c.Close()
1183
1184 req := &clouddmspb.UpdateConversionWorkspaceRequest{
1185 // TODO: Fill request struct fields.
1186 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#UpdateConversionWorkspaceRequest.
1187 }
1188 op, err := c.UpdateConversionWorkspace(ctx, req)
1189 if err != nil {
1190 // TODO: Handle error.
1191 }
1192
1193 resp, err := op.Wait(ctx)
1194 if err != nil {
1195 // TODO: Handle error.
1196 }
1197 // TODO: Use resp.
1198 _ = resp
1199 }
1200
1201 func ExampleDataMigrationClient_UpdateMigrationJob() {
1202 ctx := context.Background()
1203 // This snippet has been automatically generated and should be regarded as a code template only.
1204 // It will require modifications to work:
1205 // - It may require correct/in-range values for request initialization.
1206 // - It may require specifying regional endpoints when creating the service client as shown in:
1207 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1208 c, err := clouddms.NewDataMigrationClient(ctx)
1209 if err != nil {
1210 // TODO: Handle error.
1211 }
1212 defer c.Close()
1213
1214 req := &clouddmspb.UpdateMigrationJobRequest{
1215 // TODO: Fill request struct fields.
1216 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#UpdateMigrationJobRequest.
1217 }
1218 op, err := c.UpdateMigrationJob(ctx, req)
1219 if err != nil {
1220 // TODO: Handle error.
1221 }
1222
1223 resp, err := op.Wait(ctx)
1224 if err != nil {
1225 // TODO: Handle error.
1226 }
1227 // TODO: Use resp.
1228 _ = resp
1229 }
1230
1231 func ExampleDataMigrationClient_VerifyMigrationJob() {
1232 ctx := context.Background()
1233 // This snippet has been automatically generated and should be regarded as a code template only.
1234 // It will require modifications to work:
1235 // - It may require correct/in-range values for request initialization.
1236 // - It may require specifying regional endpoints when creating the service client as shown in:
1237 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1238 c, err := clouddms.NewDataMigrationClient(ctx)
1239 if err != nil {
1240 // TODO: Handle error.
1241 }
1242 defer c.Close()
1243
1244 req := &clouddmspb.VerifyMigrationJobRequest{
1245 // TODO: Fill request struct fields.
1246 // See https://pkg.go.dev/cloud.google.com/go/clouddms/apiv1/clouddmspb#VerifyMigrationJobRequest.
1247 }
1248 op, err := c.VerifyMigrationJob(ctx, req)
1249 if err != nil {
1250 // TODO: Handle error.
1251 }
1252
1253 resp, err := op.Wait(ctx)
1254 if err != nil {
1255 // TODO: Handle error.
1256 }
1257 // TODO: Use resp.
1258 _ = resp
1259 }
1260
1261 func ExampleDataMigrationClient_GetLocation() {
1262 ctx := context.Background()
1263 // This snippet has been automatically generated and should be regarded as a code template only.
1264 // It will require modifications to work:
1265 // - It may require correct/in-range values for request initialization.
1266 // - It may require specifying regional endpoints when creating the service client as shown in:
1267 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1268 c, err := clouddms.NewDataMigrationClient(ctx)
1269 if err != nil {
1270 // TODO: Handle error.
1271 }
1272 defer c.Close()
1273
1274 req := &locationpb.GetLocationRequest{
1275 // TODO: Fill request struct fields.
1276 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
1277 }
1278 resp, err := c.GetLocation(ctx, req)
1279 if err != nil {
1280 // TODO: Handle error.
1281 }
1282 // TODO: Use resp.
1283 _ = resp
1284 }
1285
1286 func ExampleDataMigrationClient_ListLocations() {
1287 ctx := context.Background()
1288 // This snippet has been automatically generated and should be regarded as a code template only.
1289 // It will require modifications to work:
1290 // - It may require correct/in-range values for request initialization.
1291 // - It may require specifying regional endpoints when creating the service client as shown in:
1292 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1293 c, err := clouddms.NewDataMigrationClient(ctx)
1294 if err != nil {
1295 // TODO: Handle error.
1296 }
1297 defer c.Close()
1298
1299 req := &locationpb.ListLocationsRequest{
1300 // TODO: Fill request struct fields.
1301 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
1302 }
1303 it := c.ListLocations(ctx, req)
1304 for {
1305 resp, err := it.Next()
1306 if err == iterator.Done {
1307 break
1308 }
1309 if err != nil {
1310 // TODO: Handle error.
1311 }
1312 // TODO: Use resp.
1313 _ = resp
1314
1315 // If you need to access the underlying RPC response,
1316 // you can do so by casting the `Response` as below.
1317 // Otherwise, remove this line. Only populated after
1318 // first call to Next(). Not safe for concurrent access.
1319 _ = it.Response.(*locationpb.ListLocationsResponse)
1320 }
1321 }
1322
1323 func ExampleDataMigrationClient_GetIamPolicy() {
1324 ctx := context.Background()
1325 // This snippet has been automatically generated and should be regarded as a code template only.
1326 // It will require modifications to work:
1327 // - It may require correct/in-range values for request initialization.
1328 // - It may require specifying regional endpoints when creating the service client as shown in:
1329 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1330 c, err := clouddms.NewDataMigrationClient(ctx)
1331 if err != nil {
1332 // TODO: Handle error.
1333 }
1334 defer c.Close()
1335
1336 req := &iampb.GetIamPolicyRequest{
1337 // TODO: Fill request struct fields.
1338 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
1339 }
1340 resp, err := c.GetIamPolicy(ctx, req)
1341 if err != nil {
1342 // TODO: Handle error.
1343 }
1344 // TODO: Use resp.
1345 _ = resp
1346 }
1347
1348 func ExampleDataMigrationClient_SetIamPolicy() {
1349 ctx := context.Background()
1350 // This snippet has been automatically generated and should be regarded as a code template only.
1351 // It will require modifications to work:
1352 // - It may require correct/in-range values for request initialization.
1353 // - It may require specifying regional endpoints when creating the service client as shown in:
1354 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1355 c, err := clouddms.NewDataMigrationClient(ctx)
1356 if err != nil {
1357 // TODO: Handle error.
1358 }
1359 defer c.Close()
1360
1361 req := &iampb.SetIamPolicyRequest{
1362 // TODO: Fill request struct fields.
1363 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
1364 }
1365 resp, err := c.SetIamPolicy(ctx, req)
1366 if err != nil {
1367 // TODO: Handle error.
1368 }
1369 // TODO: Use resp.
1370 _ = resp
1371 }
1372
1373 func ExampleDataMigrationClient_TestIamPermissions() {
1374 ctx := context.Background()
1375 // This snippet has been automatically generated and should be regarded as a code template only.
1376 // It will require modifications to work:
1377 // - It may require correct/in-range values for request initialization.
1378 // - It may require specifying regional endpoints when creating the service client as shown in:
1379 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1380 c, err := clouddms.NewDataMigrationClient(ctx)
1381 if err != nil {
1382 // TODO: Handle error.
1383 }
1384 defer c.Close()
1385
1386 req := &iampb.TestIamPermissionsRequest{
1387 // TODO: Fill request struct fields.
1388 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
1389 }
1390 resp, err := c.TestIamPermissions(ctx, req)
1391 if err != nil {
1392 // TODO: Handle error.
1393 }
1394 // TODO: Use resp.
1395 _ = resp
1396 }
1397
1398 func ExampleDataMigrationClient_CancelOperation() {
1399 ctx := context.Background()
1400 // This snippet has been automatically generated and should be regarded as a code template only.
1401 // It will require modifications to work:
1402 // - It may require correct/in-range values for request initialization.
1403 // - It may require specifying regional endpoints when creating the service client as shown in:
1404 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1405 c, err := clouddms.NewDataMigrationClient(ctx)
1406 if err != nil {
1407 // TODO: Handle error.
1408 }
1409 defer c.Close()
1410
1411 req := &longrunningpb.CancelOperationRequest{
1412 // TODO: Fill request struct fields.
1413 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
1414 }
1415 err = c.CancelOperation(ctx, req)
1416 if err != nil {
1417 // TODO: Handle error.
1418 }
1419 }
1420
1421 func ExampleDataMigrationClient_DeleteOperation() {
1422 ctx := context.Background()
1423 // This snippet has been automatically generated and should be regarded as a code template only.
1424 // It will require modifications to work:
1425 // - It may require correct/in-range values for request initialization.
1426 // - It may require specifying regional endpoints when creating the service client as shown in:
1427 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1428 c, err := clouddms.NewDataMigrationClient(ctx)
1429 if err != nil {
1430 // TODO: Handle error.
1431 }
1432 defer c.Close()
1433
1434 req := &longrunningpb.DeleteOperationRequest{
1435 // TODO: Fill request struct fields.
1436 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
1437 }
1438 err = c.DeleteOperation(ctx, req)
1439 if err != nil {
1440 // TODO: Handle error.
1441 }
1442 }
1443
1444 func ExampleDataMigrationClient_GetOperation() {
1445 ctx := context.Background()
1446 // This snippet has been automatically generated and should be regarded as a code template only.
1447 // It will require modifications to work:
1448 // - It may require correct/in-range values for request initialization.
1449 // - It may require specifying regional endpoints when creating the service client as shown in:
1450 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1451 c, err := clouddms.NewDataMigrationClient(ctx)
1452 if err != nil {
1453 // TODO: Handle error.
1454 }
1455 defer c.Close()
1456
1457 req := &longrunningpb.GetOperationRequest{
1458 // TODO: Fill request struct fields.
1459 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
1460 }
1461 resp, err := c.GetOperation(ctx, req)
1462 if err != nil {
1463 // TODO: Handle error.
1464 }
1465 // TODO: Use resp.
1466 _ = resp
1467 }
1468
1469 func ExampleDataMigrationClient_ListOperations() {
1470 ctx := context.Background()
1471 // This snippet has been automatically generated and should be regarded as a code template only.
1472 // It will require modifications to work:
1473 // - It may require correct/in-range values for request initialization.
1474 // - It may require specifying regional endpoints when creating the service client as shown in:
1475 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1476 c, err := clouddms.NewDataMigrationClient(ctx)
1477 if err != nil {
1478 // TODO: Handle error.
1479 }
1480 defer c.Close()
1481
1482 req := &longrunningpb.ListOperationsRequest{
1483 // TODO: Fill request struct fields.
1484 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
1485 }
1486 it := c.ListOperations(ctx, req)
1487 for {
1488 resp, err := it.Next()
1489 if err == iterator.Done {
1490 break
1491 }
1492 if err != nil {
1493 // TODO: Handle error.
1494 }
1495 // TODO: Use resp.
1496 _ = resp
1497
1498 // If you need to access the underlying RPC response,
1499 // you can do so by casting the `Response` as below.
1500 // Otherwise, remove this line. Only populated after
1501 // first call to Next(). Not safe for concurrent access.
1502 _ = it.Response.(*longrunningpb.ListOperationsResponse)
1503 }
1504 }