1 // Copyright 2024 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 biglake_test 18 19 import ( 20 "context" 21 22 biglake "cloud.google.com/go/bigquery/biglake/apiv1" 23 biglakepb "cloud.google.com/go/bigquery/biglake/apiv1/biglakepb" 24 "google.golang.org/api/iterator" 25 ) 26 27 func ExampleNewMetastoreClient() { 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 := biglake.NewMetastoreClient(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 ExampleNewMetastoreRESTClient() { 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 := biglake.NewMetastoreRESTClient(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 ExampleMetastoreClient_CreateCatalog() { 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 := biglake.NewMetastoreClient(ctx) 69 if err != nil { 70 // TODO: Handle error. 71 } 72 defer c.Close() 73 74 req := &biglakepb.CreateCatalogRequest{ 75 // TODO: Fill request struct fields. 76 // See https://pkg.go.dev/cloud.google.com/go/bigquery/biglake/apiv1/biglakepb#CreateCatalogRequest. 77 } 78 resp, err := c.CreateCatalog(ctx, req) 79 if err != nil { 80 // TODO: Handle error. 81 } 82 // TODO: Use resp. 83 _ = resp 84 } 85 86 func ExampleMetastoreClient_CreateDatabase() { 87 ctx := context.Background() 88 // This snippet has been automatically generated and should be regarded as a code template only. 89 // It will require modifications to work: 90 // - It may require correct/in-range values for request initialization. 91 // - It may require specifying regional endpoints when creating the service client as shown in: 92 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 93 c, err := biglake.NewMetastoreClient(ctx) 94 if err != nil { 95 // TODO: Handle error. 96 } 97 defer c.Close() 98 99 req := &biglakepb.CreateDatabaseRequest{ 100 // TODO: Fill request struct fields. 101 // See https://pkg.go.dev/cloud.google.com/go/bigquery/biglake/apiv1/biglakepb#CreateDatabaseRequest. 102 } 103 resp, err := c.CreateDatabase(ctx, req) 104 if err != nil { 105 // TODO: Handle error. 106 } 107 // TODO: Use resp. 108 _ = resp 109 } 110 111 func ExampleMetastoreClient_CreateTable() { 112 ctx := context.Background() 113 // This snippet has been automatically generated and should be regarded as a code template only. 114 // It will require modifications to work: 115 // - It may require correct/in-range values for request initialization. 116 // - It may require specifying regional endpoints when creating the service client as shown in: 117 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 118 c, err := biglake.NewMetastoreClient(ctx) 119 if err != nil { 120 // TODO: Handle error. 121 } 122 defer c.Close() 123 124 req := &biglakepb.CreateTableRequest{ 125 // TODO: Fill request struct fields. 126 // See https://pkg.go.dev/cloud.google.com/go/bigquery/biglake/apiv1/biglakepb#CreateTableRequest. 127 } 128 resp, err := c.CreateTable(ctx, req) 129 if err != nil { 130 // TODO: Handle error. 131 } 132 // TODO: Use resp. 133 _ = resp 134 } 135 136 func ExampleMetastoreClient_DeleteCatalog() { 137 ctx := context.Background() 138 // This snippet has been automatically generated and should be regarded as a code template only. 139 // It will require modifications to work: 140 // - It may require correct/in-range values for request initialization. 141 // - It may require specifying regional endpoints when creating the service client as shown in: 142 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 143 c, err := biglake.NewMetastoreClient(ctx) 144 if err != nil { 145 // TODO: Handle error. 146 } 147 defer c.Close() 148 149 req := &biglakepb.DeleteCatalogRequest{ 150 // TODO: Fill request struct fields. 151 // See https://pkg.go.dev/cloud.google.com/go/bigquery/biglake/apiv1/biglakepb#DeleteCatalogRequest. 152 } 153 resp, err := c.DeleteCatalog(ctx, req) 154 if err != nil { 155 // TODO: Handle error. 156 } 157 // TODO: Use resp. 158 _ = resp 159 } 160 161 func ExampleMetastoreClient_DeleteDatabase() { 162 ctx := context.Background() 163 // This snippet has been automatically generated and should be regarded as a code template only. 164 // It will require modifications to work: 165 // - It may require correct/in-range values for request initialization. 166 // - It may require specifying regional endpoints when creating the service client as shown in: 167 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 168 c, err := biglake.NewMetastoreClient(ctx) 169 if err != nil { 170 // TODO: Handle error. 171 } 172 defer c.Close() 173 174 req := &biglakepb.DeleteDatabaseRequest{ 175 // TODO: Fill request struct fields. 176 // See https://pkg.go.dev/cloud.google.com/go/bigquery/biglake/apiv1/biglakepb#DeleteDatabaseRequest. 177 } 178 resp, err := c.DeleteDatabase(ctx, req) 179 if err != nil { 180 // TODO: Handle error. 181 } 182 // TODO: Use resp. 183 _ = resp 184 } 185 186 func ExampleMetastoreClient_DeleteTable() { 187 ctx := context.Background() 188 // This snippet has been automatically generated and should be regarded as a code template only. 189 // It will require modifications to work: 190 // - It may require correct/in-range values for request initialization. 191 // - It may require specifying regional endpoints when creating the service client as shown in: 192 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 193 c, err := biglake.NewMetastoreClient(ctx) 194 if err != nil { 195 // TODO: Handle error. 196 } 197 defer c.Close() 198 199 req := &biglakepb.DeleteTableRequest{ 200 // TODO: Fill request struct fields. 201 // See https://pkg.go.dev/cloud.google.com/go/bigquery/biglake/apiv1/biglakepb#DeleteTableRequest. 202 } 203 resp, err := c.DeleteTable(ctx, req) 204 if err != nil { 205 // TODO: Handle error. 206 } 207 // TODO: Use resp. 208 _ = resp 209 } 210 211 func ExampleMetastoreClient_GetCatalog() { 212 ctx := context.Background() 213 // This snippet has been automatically generated and should be regarded as a code template only. 214 // It will require modifications to work: 215 // - It may require correct/in-range values for request initialization. 216 // - It may require specifying regional endpoints when creating the service client as shown in: 217 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 218 c, err := biglake.NewMetastoreClient(ctx) 219 if err != nil { 220 // TODO: Handle error. 221 } 222 defer c.Close() 223 224 req := &biglakepb.GetCatalogRequest{ 225 // TODO: Fill request struct fields. 226 // See https://pkg.go.dev/cloud.google.com/go/bigquery/biglake/apiv1/biglakepb#GetCatalogRequest. 227 } 228 resp, err := c.GetCatalog(ctx, req) 229 if err != nil { 230 // TODO: Handle error. 231 } 232 // TODO: Use resp. 233 _ = resp 234 } 235 236 func ExampleMetastoreClient_GetDatabase() { 237 ctx := context.Background() 238 // This snippet has been automatically generated and should be regarded as a code template only. 239 // It will require modifications to work: 240 // - It may require correct/in-range values for request initialization. 241 // - It may require specifying regional endpoints when creating the service client as shown in: 242 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 243 c, err := biglake.NewMetastoreClient(ctx) 244 if err != nil { 245 // TODO: Handle error. 246 } 247 defer c.Close() 248 249 req := &biglakepb.GetDatabaseRequest{ 250 // TODO: Fill request struct fields. 251 // See https://pkg.go.dev/cloud.google.com/go/bigquery/biglake/apiv1/biglakepb#GetDatabaseRequest. 252 } 253 resp, err := c.GetDatabase(ctx, req) 254 if err != nil { 255 // TODO: Handle error. 256 } 257 // TODO: Use resp. 258 _ = resp 259 } 260 261 func ExampleMetastoreClient_GetTable() { 262 ctx := context.Background() 263 // This snippet has been automatically generated and should be regarded as a code template only. 264 // It will require modifications to work: 265 // - It may require correct/in-range values for request initialization. 266 // - It may require specifying regional endpoints when creating the service client as shown in: 267 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 268 c, err := biglake.NewMetastoreClient(ctx) 269 if err != nil { 270 // TODO: Handle error. 271 } 272 defer c.Close() 273 274 req := &biglakepb.GetTableRequest{ 275 // TODO: Fill request struct fields. 276 // See https://pkg.go.dev/cloud.google.com/go/bigquery/biglake/apiv1/biglakepb#GetTableRequest. 277 } 278 resp, err := c.GetTable(ctx, req) 279 if err != nil { 280 // TODO: Handle error. 281 } 282 // TODO: Use resp. 283 _ = resp 284 } 285 286 func ExampleMetastoreClient_ListCatalogs() { 287 ctx := context.Background() 288 // This snippet has been automatically generated and should be regarded as a code template only. 289 // It will require modifications to work: 290 // - It may require correct/in-range values for request initialization. 291 // - It may require specifying regional endpoints when creating the service client as shown in: 292 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 293 c, err := biglake.NewMetastoreClient(ctx) 294 if err != nil { 295 // TODO: Handle error. 296 } 297 defer c.Close() 298 299 req := &biglakepb.ListCatalogsRequest{ 300 // TODO: Fill request struct fields. 301 // See https://pkg.go.dev/cloud.google.com/go/bigquery/biglake/apiv1/biglakepb#ListCatalogsRequest. 302 } 303 it := c.ListCatalogs(ctx, req) 304 for { 305 resp, err := it.Next() 306 if err == iterator.Done { 307 break 308 } 309 if err != nil { 310 // TODO: Handle error. 311 } 312 // TODO: Use resp. 313 _ = resp 314 315 // If you need to access the underlying RPC response, 316 // you can do so by casting the `Response` as below. 317 // Otherwise, remove this line. Only populated after 318 // first call to Next(). Not safe for concurrent access. 319 _ = it.Response.(*biglakepb.ListCatalogsResponse) 320 } 321 } 322 323 func ExampleMetastoreClient_ListDatabases() { 324 ctx := context.Background() 325 // This snippet has been automatically generated and should be regarded as a code template only. 326 // It will require modifications to work: 327 // - It may require correct/in-range values for request initialization. 328 // - It may require specifying regional endpoints when creating the service client as shown in: 329 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 330 c, err := biglake.NewMetastoreClient(ctx) 331 if err != nil { 332 // TODO: Handle error. 333 } 334 defer c.Close() 335 336 req := &biglakepb.ListDatabasesRequest{ 337 // TODO: Fill request struct fields. 338 // See https://pkg.go.dev/cloud.google.com/go/bigquery/biglake/apiv1/biglakepb#ListDatabasesRequest. 339 } 340 it := c.ListDatabases(ctx, req) 341 for { 342 resp, err := it.Next() 343 if err == iterator.Done { 344 break 345 } 346 if err != nil { 347 // TODO: Handle error. 348 } 349 // TODO: Use resp. 350 _ = resp 351 352 // If you need to access the underlying RPC response, 353 // you can do so by casting the `Response` as below. 354 // Otherwise, remove this line. Only populated after 355 // first call to Next(). Not safe for concurrent access. 356 _ = it.Response.(*biglakepb.ListDatabasesResponse) 357 } 358 } 359 360 func ExampleMetastoreClient_ListTables() { 361 ctx := context.Background() 362 // This snippet has been automatically generated and should be regarded as a code template only. 363 // It will require modifications to work: 364 // - It may require correct/in-range values for request initialization. 365 // - It may require specifying regional endpoints when creating the service client as shown in: 366 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 367 c, err := biglake.NewMetastoreClient(ctx) 368 if err != nil { 369 // TODO: Handle error. 370 } 371 defer c.Close() 372 373 req := &biglakepb.ListTablesRequest{ 374 // TODO: Fill request struct fields. 375 // See https://pkg.go.dev/cloud.google.com/go/bigquery/biglake/apiv1/biglakepb#ListTablesRequest. 376 } 377 it := c.ListTables(ctx, req) 378 for { 379 resp, err := it.Next() 380 if err == iterator.Done { 381 break 382 } 383 if err != nil { 384 // TODO: Handle error. 385 } 386 // TODO: Use resp. 387 _ = resp 388 389 // If you need to access the underlying RPC response, 390 // you can do so by casting the `Response` as below. 391 // Otherwise, remove this line. Only populated after 392 // first call to Next(). Not safe for concurrent access. 393 _ = it.Response.(*biglakepb.ListTablesResponse) 394 } 395 } 396 397 func ExampleMetastoreClient_RenameTable() { 398 ctx := context.Background() 399 // This snippet has been automatically generated and should be regarded as a code template only. 400 // It will require modifications to work: 401 // - It may require correct/in-range values for request initialization. 402 // - It may require specifying regional endpoints when creating the service client as shown in: 403 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 404 c, err := biglake.NewMetastoreClient(ctx) 405 if err != nil { 406 // TODO: Handle error. 407 } 408 defer c.Close() 409 410 req := &biglakepb.RenameTableRequest{ 411 // TODO: Fill request struct fields. 412 // See https://pkg.go.dev/cloud.google.com/go/bigquery/biglake/apiv1/biglakepb#RenameTableRequest. 413 } 414 resp, err := c.RenameTable(ctx, req) 415 if err != nil { 416 // TODO: Handle error. 417 } 418 // TODO: Use resp. 419 _ = resp 420 } 421 422 func ExampleMetastoreClient_UpdateDatabase() { 423 ctx := context.Background() 424 // This snippet has been automatically generated and should be regarded as a code template only. 425 // It will require modifications to work: 426 // - It may require correct/in-range values for request initialization. 427 // - It may require specifying regional endpoints when creating the service client as shown in: 428 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 429 c, err := biglake.NewMetastoreClient(ctx) 430 if err != nil { 431 // TODO: Handle error. 432 } 433 defer c.Close() 434 435 req := &biglakepb.UpdateDatabaseRequest{ 436 // TODO: Fill request struct fields. 437 // See https://pkg.go.dev/cloud.google.com/go/bigquery/biglake/apiv1/biglakepb#UpdateDatabaseRequest. 438 } 439 resp, err := c.UpdateDatabase(ctx, req) 440 if err != nil { 441 // TODO: Handle error. 442 } 443 // TODO: Use resp. 444 _ = resp 445 } 446 447 func ExampleMetastoreClient_UpdateTable() { 448 ctx := context.Background() 449 // This snippet has been automatically generated and should be regarded as a code template only. 450 // It will require modifications to work: 451 // - It may require correct/in-range values for request initialization. 452 // - It may require specifying regional endpoints when creating the service client as shown in: 453 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 454 c, err := biglake.NewMetastoreClient(ctx) 455 if err != nil { 456 // TODO: Handle error. 457 } 458 defer c.Close() 459 460 req := &biglakepb.UpdateTableRequest{ 461 // TODO: Fill request struct fields. 462 // See https://pkg.go.dev/cloud.google.com/go/bigquery/biglake/apiv1/biglakepb#UpdateTableRequest. 463 } 464 resp, err := c.UpdateTable(ctx, req) 465 if err != nil { 466 // TODO: Handle error. 467 } 468 // TODO: Use resp. 469 _ = resp 470 } 471