1// Copyright 2021 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 17package migration_test 18 19import ( 20 "context" 21 22 migration "cloud.google.com/go/bigquery/migration/apiv2alpha" 23 "google.golang.org/api/iterator" 24 migrationpb "google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2alpha" 25) 26 27func ExampleNewClient() { 28 ctx := context.Background() 29 c, err := migration.NewClient(ctx) 30 if err != nil { 31 // TODO: Handle error. 32 } 33 defer c.Close() 34 35 // TODO: Use client. 36 _ = c 37} 38 39func ExampleClient_CreateMigrationWorkflow() { 40 ctx := context.Background() 41 c, err := migration.NewClient(ctx) 42 if err != nil { 43 // TODO: Handle error. 44 } 45 defer c.Close() 46 47 req := &migrationpb.CreateMigrationWorkflowRequest{ 48 // TODO: Fill request struct fields. 49 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2alpha#CreateMigrationWorkflowRequest. 50 } 51 resp, err := c.CreateMigrationWorkflow(ctx, req) 52 if err != nil { 53 // TODO: Handle error. 54 } 55 // TODO: Use resp. 56 _ = resp 57} 58 59func ExampleClient_GetMigrationWorkflow() { 60 ctx := context.Background() 61 c, err := migration.NewClient(ctx) 62 if err != nil { 63 // TODO: Handle error. 64 } 65 defer c.Close() 66 67 req := &migrationpb.GetMigrationWorkflowRequest{ 68 // TODO: Fill request struct fields. 69 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2alpha#GetMigrationWorkflowRequest. 70 } 71 resp, err := c.GetMigrationWorkflow(ctx, req) 72 if err != nil { 73 // TODO: Handle error. 74 } 75 // TODO: Use resp. 76 _ = resp 77} 78 79func ExampleClient_ListMigrationWorkflows() { 80 ctx := context.Background() 81 c, err := migration.NewClient(ctx) 82 if err != nil { 83 // TODO: Handle error. 84 } 85 defer c.Close() 86 87 req := &migrationpb.ListMigrationWorkflowsRequest{ 88 // TODO: Fill request struct fields. 89 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2alpha#ListMigrationWorkflowsRequest. 90 } 91 it := c.ListMigrationWorkflows(ctx, req) 92 for { 93 resp, err := it.Next() 94 if err == iterator.Done { 95 break 96 } 97 if err != nil { 98 // TODO: Handle error. 99 } 100 // TODO: Use resp. 101 _ = resp 102 } 103} 104 105func ExampleClient_DeleteMigrationWorkflow() { 106 ctx := context.Background() 107 c, err := migration.NewClient(ctx) 108 if err != nil { 109 // TODO: Handle error. 110 } 111 defer c.Close() 112 113 req := &migrationpb.DeleteMigrationWorkflowRequest{ 114 // TODO: Fill request struct fields. 115 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2alpha#DeleteMigrationWorkflowRequest. 116 } 117 err = c.DeleteMigrationWorkflow(ctx, req) 118 if err != nil { 119 // TODO: Handle error. 120 } 121} 122 123func ExampleClient_StartMigrationWorkflow() { 124 ctx := context.Background() 125 c, err := migration.NewClient(ctx) 126 if err != nil { 127 // TODO: Handle error. 128 } 129 defer c.Close() 130 131 req := &migrationpb.StartMigrationWorkflowRequest{ 132 // TODO: Fill request struct fields. 133 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2alpha#StartMigrationWorkflowRequest. 134 } 135 err = c.StartMigrationWorkflow(ctx, req) 136 if err != nil { 137 // TODO: Handle error. 138 } 139} 140 141func ExampleClient_GetMigrationSubtask() { 142 ctx := context.Background() 143 c, err := migration.NewClient(ctx) 144 if err != nil { 145 // TODO: Handle error. 146 } 147 defer c.Close() 148 149 req := &migrationpb.GetMigrationSubtaskRequest{ 150 // TODO: Fill request struct fields. 151 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2alpha#GetMigrationSubtaskRequest. 152 } 153 resp, err := c.GetMigrationSubtask(ctx, req) 154 if err != nil { 155 // TODO: Handle error. 156 } 157 // TODO: Use resp. 158 _ = resp 159} 160 161func ExampleClient_ListMigrationSubtasks() { 162 ctx := context.Background() 163 c, err := migration.NewClient(ctx) 164 if err != nil { 165 // TODO: Handle error. 166 } 167 defer c.Close() 168 169 req := &migrationpb.ListMigrationSubtasksRequest{ 170 // TODO: Fill request struct fields. 171 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2alpha#ListMigrationSubtasksRequest. 172 } 173 it := c.ListMigrationSubtasks(ctx, req) 174 for { 175 resp, err := it.Next() 176 if err == iterator.Done { 177 break 178 } 179 if err != nil { 180 // TODO: Handle error. 181 } 182 // TODO: Use resp. 183 _ = resp 184 } 185} 186