| 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 apiv1_test |
| 18 |
|
| 19 |
import ( |
| 20 |
"context" |
| 21 |
|
| 22 |
apiv1 "cloud.google.com/go/firestore/apiv1/admin" |
| 23 |
adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" |
| 24 |
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 25 |
"google.golang.org/api/iterator" |
| 26 |
) |
| 27 |
|
| 28 |
func ExampleNewFirestoreAdminClient() { |
| 29 |
ctx := context.Background() |
| 30 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 31 |
// It will require modifications to work: |
| 32 |
// - It may require correct/in-range values for request initialization. |
| 33 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 34 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 35 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 36 |
if err != nil { |
| 37 |
// TODO: Handle error. |
| 38 |
} |
| 39 |
defer c.Close() |
| 40 |
|
| 41 |
// TODO: Use client. |
| 42 |
_ = c |
| 43 |
} |
| 44 |
|
| 45 |
func ExampleNewFirestoreAdminRESTClient() { |
| 46 |
ctx := context.Background() |
| 47 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 48 |
// It will require modifications to work: |
| 49 |
// - It may require correct/in-range values for request initialization. |
| 50 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 51 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 52 |
c, err := apiv1.NewFirestoreAdminRESTClient(ctx) |
| 53 |
if err != nil { |
| 54 |
// TODO: Handle error. |
| 55 |
} |
| 56 |
defer c.Close() |
| 57 |
|
| 58 |
// TODO: Use client. |
| 59 |
_ = c |
| 60 |
} |
| 61 |
|
| 62 |
func ExampleFirestoreAdminClient_BulkDeleteDocuments() { |
| 63 |
ctx := context.Background() |
| 64 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 65 |
// It will require modifications to work: |
| 66 |
// - It may require correct/in-range values for request initialization. |
| 67 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 68 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 69 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 70 |
if err != nil { |
| 71 |
// TODO: Handle error. |
| 72 |
} |
| 73 |
defer c.Close() |
| 74 |
|
| 75 |
req := &adminpb.BulkDeleteDocumentsRequest{ |
| 76 |
// TODO: Fill request struct fields. |
| 77 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#BulkDeleteDocumentsRequest. |
| 78 |
} |
| 79 |
op, err := c.BulkDeleteDocuments(ctx, req) |
| 80 |
if err != nil { |
| 81 |
// TODO: Handle error. |
| 82 |
} |
| 83 |
|
| 84 |
resp, err := op.Wait(ctx) |
| 85 |
if err != nil { |
| 86 |
// TODO: Handle error. |
| 87 |
} |
| 88 |
// TODO: Use resp. |
| 89 |
_ = resp |
| 90 |
} |
| 91 |
|
| 92 |
func ExampleFirestoreAdminClient_CloneDatabase() { |
| 93 |
ctx := context.Background() |
| 94 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 95 |
// It will require modifications to work: |
| 96 |
// - It may require correct/in-range values for request initialization. |
| 97 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 98 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 99 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 100 |
if err != nil { |
| 101 |
// TODO: Handle error. |
| 102 |
} |
| 103 |
defer c.Close() |
| 104 |
|
| 105 |
req := &adminpb.CloneDatabaseRequest{ |
| 106 |
// TODO: Fill request struct fields. |
| 107 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#CloneDatabaseRequest. |
| 108 |
} |
| 109 |
op, err := c.CloneDatabase(ctx, req) |
| 110 |
if err != nil { |
| 111 |
// TODO: Handle error. |
| 112 |
} |
| 113 |
|
| 114 |
resp, err := op.Wait(ctx) |
| 115 |
if err != nil { |
| 116 |
// TODO: Handle error. |
| 117 |
} |
| 118 |
// TODO: Use resp. |
| 119 |
_ = resp |
| 120 |
} |
| 121 |
|
| 122 |
func ExampleFirestoreAdminClient_CreateBackupSchedule() { |
| 123 |
ctx := context.Background() |
| 124 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 125 |
// It will require modifications to work: |
| 126 |
// - It may require correct/in-range values for request initialization. |
| 127 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 128 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 129 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 130 |
if err != nil { |
| 131 |
// TODO: Handle error. |
| 132 |
} |
| 133 |
defer c.Close() |
| 134 |
|
| 135 |
req := &adminpb.CreateBackupScheduleRequest{ |
| 136 |
// TODO: Fill request struct fields. |
| 137 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#CreateBackupScheduleRequest. |
| 138 |
} |
| 139 |
resp, err := c.CreateBackupSchedule(ctx, req) |
| 140 |
if err != nil { |
| 141 |
// TODO: Handle error. |
| 142 |
} |
| 143 |
// TODO: Use resp. |
| 144 |
_ = resp |
| 145 |
} |
| 146 |
|
| 147 |
func ExampleFirestoreAdminClient_CreateDatabase() { |
| 148 |
ctx := context.Background() |
| 149 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 150 |
// It will require modifications to work: |
| 151 |
// - It may require correct/in-range values for request initialization. |
| 152 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 153 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 154 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 155 |
if err != nil { |
| 156 |
// TODO: Handle error. |
| 157 |
} |
| 158 |
defer c.Close() |
| 159 |
|
| 160 |
req := &adminpb.CreateDatabaseRequest{ |
| 161 |
// TODO: Fill request struct fields. |
| 162 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#CreateDatabaseRequest. |
| 163 |
} |
| 164 |
op, err := c.CreateDatabase(ctx, req) |
| 165 |
if err != nil { |
| 166 |
// TODO: Handle error. |
| 167 |
} |
| 168 |
|
| 169 |
resp, err := op.Wait(ctx) |
| 170 |
if err != nil { |
| 171 |
// TODO: Handle error. |
| 172 |
} |
| 173 |
// TODO: Use resp. |
| 174 |
_ = resp |
| 175 |
} |
| 176 |
|
| 177 |
func ExampleFirestoreAdminClient_CreateIndex() { |
| 178 |
ctx := context.Background() |
| 179 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 180 |
// It will require modifications to work: |
| 181 |
// - It may require correct/in-range values for request initialization. |
| 182 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 183 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 184 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 185 |
if err != nil { |
| 186 |
// TODO: Handle error. |
| 187 |
} |
| 188 |
defer c.Close() |
| 189 |
|
| 190 |
req := &adminpb.CreateIndexRequest{ |
| 191 |
// TODO: Fill request struct fields. |
| 192 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#CreateIndexRequest. |
| 193 |
} |
| 194 |
op, err := c.CreateIndex(ctx, req) |
| 195 |
if err != nil { |
| 196 |
// TODO: Handle error. |
| 197 |
} |
| 198 |
|
| 199 |
resp, err := op.Wait(ctx) |
| 200 |
if err != nil { |
| 201 |
// TODO: Handle error. |
| 202 |
} |
| 203 |
// TODO: Use resp. |
| 204 |
_ = resp |
| 205 |
} |
| 206 |
|
| 207 |
func ExampleFirestoreAdminClient_CreateUserCreds() { |
| 208 |
ctx := context.Background() |
| 209 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 210 |
// It will require modifications to work: |
| 211 |
// - It may require correct/in-range values for request initialization. |
| 212 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 213 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 214 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 215 |
if err != nil { |
| 216 |
// TODO: Handle error. |
| 217 |
} |
| 218 |
defer c.Close() |
| 219 |
|
| 220 |
req := &adminpb.CreateUserCredsRequest{ |
| 221 |
// TODO: Fill request struct fields. |
| 222 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#CreateUserCredsRequest. |
| 223 |
} |
| 224 |
resp, err := c.CreateUserCreds(ctx, req) |
| 225 |
if err != nil { |
| 226 |
// TODO: Handle error. |
| 227 |
} |
| 228 |
// TODO: Use resp. |
| 229 |
_ = resp |
| 230 |
} |
| 231 |
|
| 232 |
func ExampleFirestoreAdminClient_DeleteBackup() { |
| 233 |
ctx := context.Background() |
| 234 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 235 |
// It will require modifications to work: |
| 236 |
// - It may require correct/in-range values for request initialization. |
| 237 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 238 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 239 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 240 |
if err != nil { |
| 241 |
// TODO: Handle error. |
| 242 |
} |
| 243 |
defer c.Close() |
| 244 |
|
| 245 |
req := &adminpb.DeleteBackupRequest{ |
| 246 |
// TODO: Fill request struct fields. |
| 247 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#DeleteBackupRequest. |
| 248 |
} |
| 249 |
err = c.DeleteBackup(ctx, req) |
| 250 |
if err != nil { |
| 251 |
// TODO: Handle error. |
| 252 |
} |
| 253 |
} |
| 254 |
|
| 255 |
func ExampleFirestoreAdminClient_DeleteBackupSchedule() { |
| 256 |
ctx := context.Background() |
| 257 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 258 |
// It will require modifications to work: |
| 259 |
// - It may require correct/in-range values for request initialization. |
| 260 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 261 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 262 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 263 |
if err != nil { |
| 264 |
// TODO: Handle error. |
| 265 |
} |
| 266 |
defer c.Close() |
| 267 |
|
| 268 |
req := &adminpb.DeleteBackupScheduleRequest{ |
| 269 |
// TODO: Fill request struct fields. |
| 270 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#DeleteBackupScheduleRequest. |
| 271 |
} |
| 272 |
err = c.DeleteBackupSchedule(ctx, req) |
| 273 |
if err != nil { |
| 274 |
// TODO: Handle error. |
| 275 |
} |
| 276 |
} |
| 277 |
|
| 278 |
func ExampleFirestoreAdminClient_DeleteDatabase() { |
| 279 |
ctx := context.Background() |
| 280 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 281 |
// It will require modifications to work: |
| 282 |
// - It may require correct/in-range values for request initialization. |
| 283 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 284 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 285 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 286 |
if err != nil { |
| 287 |
// TODO: Handle error. |
| 288 |
} |
| 289 |
defer c.Close() |
| 290 |
|
| 291 |
req := &adminpb.DeleteDatabaseRequest{ |
| 292 |
// TODO: Fill request struct fields. |
| 293 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#DeleteDatabaseRequest. |
| 294 |
} |
| 295 |
op, err := c.DeleteDatabase(ctx, req) |
| 296 |
if err != nil { |
| 297 |
// TODO: Handle error. |
| 298 |
} |
| 299 |
|
| 300 |
resp, err := op.Wait(ctx) |
| 301 |
if err != nil { |
| 302 |
// TODO: Handle error. |
| 303 |
} |
| 304 |
// TODO: Use resp. |
| 305 |
_ = resp |
| 306 |
} |
| 307 |
|
| 308 |
func ExampleFirestoreAdminClient_DeleteIndex() { |
| 309 |
ctx := context.Background() |
| 310 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 311 |
// It will require modifications to work: |
| 312 |
// - It may require correct/in-range values for request initialization. |
| 313 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 314 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 315 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 316 |
if err != nil { |
| 317 |
// TODO: Handle error. |
| 318 |
} |
| 319 |
defer c.Close() |
| 320 |
|
| 321 |
req := &adminpb.DeleteIndexRequest{ |
| 322 |
// TODO: Fill request struct fields. |
| 323 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#DeleteIndexRequest. |
| 324 |
} |
| 325 |
err = c.DeleteIndex(ctx, req) |
| 326 |
if err != nil { |
| 327 |
// TODO: Handle error. |
| 328 |
} |
| 329 |
} |
| 330 |
|
| 331 |
func ExampleFirestoreAdminClient_DeleteUserCreds() { |
| 332 |
ctx := context.Background() |
| 333 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 334 |
// It will require modifications to work: |
| 335 |
// - It may require correct/in-range values for request initialization. |
| 336 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 337 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 338 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 339 |
if err != nil { |
| 340 |
// TODO: Handle error. |
| 341 |
} |
| 342 |
defer c.Close() |
| 343 |
|
| 344 |
req := &adminpb.DeleteUserCredsRequest{ |
| 345 |
// TODO: Fill request struct fields. |
| 346 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#DeleteUserCredsRequest. |
| 347 |
} |
| 348 |
err = c.DeleteUserCreds(ctx, req) |
| 349 |
if err != nil { |
| 350 |
// TODO: Handle error. |
| 351 |
} |
| 352 |
} |
| 353 |
|
| 354 |
func ExampleFirestoreAdminClient_DisableUserCreds() { |
| 355 |
ctx := context.Background() |
| 356 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 357 |
// It will require modifications to work: |
| 358 |
// - It may require correct/in-range values for request initialization. |
| 359 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 360 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 361 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 362 |
if err != nil { |
| 363 |
// TODO: Handle error. |
| 364 |
} |
| 365 |
defer c.Close() |
| 366 |
|
| 367 |
req := &adminpb.DisableUserCredsRequest{ |
| 368 |
// TODO: Fill request struct fields. |
| 369 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#DisableUserCredsRequest. |
| 370 |
} |
| 371 |
resp, err := c.DisableUserCreds(ctx, req) |
| 372 |
if err != nil { |
| 373 |
// TODO: Handle error. |
| 374 |
} |
| 375 |
// TODO: Use resp. |
| 376 |
_ = resp |
| 377 |
} |
| 378 |
|
| 379 |
func ExampleFirestoreAdminClient_EnableUserCreds() { |
| 380 |
ctx := context.Background() |
| 381 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 382 |
// It will require modifications to work: |
| 383 |
// - It may require correct/in-range values for request initialization. |
| 384 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 385 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 386 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 387 |
if err != nil { |
| 388 |
// TODO: Handle error. |
| 389 |
} |
| 390 |
defer c.Close() |
| 391 |
|
| 392 |
req := &adminpb.EnableUserCredsRequest{ |
| 393 |
// TODO: Fill request struct fields. |
| 394 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#EnableUserCredsRequest. |
| 395 |
} |
| 396 |
resp, err := c.EnableUserCreds(ctx, req) |
| 397 |
if err != nil { |
| 398 |
// TODO: Handle error. |
| 399 |
} |
| 400 |
// TODO: Use resp. |
| 401 |
_ = resp |
| 402 |
} |
| 403 |
|
| 404 |
func ExampleFirestoreAdminClient_ExportDocuments() { |
| 405 |
ctx := context.Background() |
| 406 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 407 |
// It will require modifications to work: |
| 408 |
// - It may require correct/in-range values for request initialization. |
| 409 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 410 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 411 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 412 |
if err != nil { |
| 413 |
// TODO: Handle error. |
| 414 |
} |
| 415 |
defer c.Close() |
| 416 |
|
| 417 |
req := &adminpb.ExportDocumentsRequest{ |
| 418 |
// TODO: Fill request struct fields. |
| 419 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ExportDocumentsRequest. |
| 420 |
} |
| 421 |
op, err := c.ExportDocuments(ctx, req) |
| 422 |
if err != nil { |
| 423 |
// TODO: Handle error. |
| 424 |
} |
| 425 |
|
| 426 |
resp, err := op.Wait(ctx) |
| 427 |
if err != nil { |
| 428 |
// TODO: Handle error. |
| 429 |
} |
| 430 |
// TODO: Use resp. |
| 431 |
_ = resp |
| 432 |
} |
| 433 |
|
| 434 |
func ExampleFirestoreAdminClient_GetBackup() { |
| 435 |
ctx := context.Background() |
| 436 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 437 |
// It will require modifications to work: |
| 438 |
// - It may require correct/in-range values for request initialization. |
| 439 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 440 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 441 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 442 |
if err != nil { |
| 443 |
// TODO: Handle error. |
| 444 |
} |
| 445 |
defer c.Close() |
| 446 |
|
| 447 |
req := &adminpb.GetBackupRequest{ |
| 448 |
// TODO: Fill request struct fields. |
| 449 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#GetBackupRequest. |
| 450 |
} |
| 451 |
resp, err := c.GetBackup(ctx, req) |
| 452 |
if err != nil { |
| 453 |
// TODO: Handle error. |
| 454 |
} |
| 455 |
// TODO: Use resp. |
| 456 |
_ = resp |
| 457 |
} |
| 458 |
|
| 459 |
func ExampleFirestoreAdminClient_GetBackupSchedule() { |
| 460 |
ctx := context.Background() |
| 461 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 462 |
// It will require modifications to work: |
| 463 |
// - It may require correct/in-range values for request initialization. |
| 464 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 465 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 466 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 467 |
if err != nil { |
| 468 |
// TODO: Handle error. |
| 469 |
} |
| 470 |
defer c.Close() |
| 471 |
|
| 472 |
req := &adminpb.GetBackupScheduleRequest{ |
| 473 |
// TODO: Fill request struct fields. |
| 474 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#GetBackupScheduleRequest. |
| 475 |
} |
| 476 |
resp, err := c.GetBackupSchedule(ctx, req) |
| 477 |
if err != nil { |
| 478 |
// TODO: Handle error. |
| 479 |
} |
| 480 |
// TODO: Use resp. |
| 481 |
_ = resp |
| 482 |
} |
| 483 |
|
| 484 |
func ExampleFirestoreAdminClient_GetDatabase() { |
| 485 |
ctx := context.Background() |
| 486 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 487 |
// It will require modifications to work: |
| 488 |
// - It may require correct/in-range values for request initialization. |
| 489 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 490 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 491 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 492 |
if err != nil { |
| 493 |
// TODO: Handle error. |
| 494 |
} |
| 495 |
defer c.Close() |
| 496 |
|
| 497 |
req := &adminpb.GetDatabaseRequest{ |
| 498 |
// TODO: Fill request struct fields. |
| 499 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#GetDatabaseRequest. |
| 500 |
} |
| 501 |
resp, err := c.GetDatabase(ctx, req) |
| 502 |
if err != nil { |
| 503 |
// TODO: Handle error. |
| 504 |
} |
| 505 |
// TODO: Use resp. |
| 506 |
_ = resp |
| 507 |
} |
| 508 |
|
| 509 |
func ExampleFirestoreAdminClient_GetField() { |
| 510 |
ctx := context.Background() |
| 511 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 512 |
// It will require modifications to work: |
| 513 |
// - It may require correct/in-range values for request initialization. |
| 514 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 515 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 516 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 517 |
if err != nil { |
| 518 |
// TODO: Handle error. |
| 519 |
} |
| 520 |
defer c.Close() |
| 521 |
|
| 522 |
req := &adminpb.GetFieldRequest{ |
| 523 |
// TODO: Fill request struct fields. |
| 524 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#GetFieldRequest. |
| 525 |
} |
| 526 |
resp, err := c.GetField(ctx, req) |
| 527 |
if err != nil { |
| 528 |
// TODO: Handle error. |
| 529 |
} |
| 530 |
// TODO: Use resp. |
| 531 |
_ = resp |
| 532 |
} |
| 533 |
|
| 534 |
func ExampleFirestoreAdminClient_GetIndex() { |
| 535 |
ctx := context.Background() |
| 536 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 537 |
// It will require modifications to work: |
| 538 |
// - It may require correct/in-range values for request initialization. |
| 539 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 540 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 541 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 542 |
if err != nil { |
| 543 |
// TODO: Handle error. |
| 544 |
} |
| 545 |
defer c.Close() |
| 546 |
|
| 547 |
req := &adminpb.GetIndexRequest{ |
| 548 |
// TODO: Fill request struct fields. |
| 549 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#GetIndexRequest. |
| 550 |
} |
| 551 |
resp, err := c.GetIndex(ctx, req) |
| 552 |
if err != nil { |
| 553 |
// TODO: Handle error. |
| 554 |
} |
| 555 |
// TODO: Use resp. |
| 556 |
_ = resp |
| 557 |
} |
| 558 |
|
| 559 |
func ExampleFirestoreAdminClient_GetUserCreds() { |
| 560 |
ctx := context.Background() |
| 561 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 562 |
// It will require modifications to work: |
| 563 |
// - It may require correct/in-range values for request initialization. |
| 564 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 565 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 566 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 567 |
if err != nil { |
| 568 |
// TODO: Handle error. |
| 569 |
} |
| 570 |
defer c.Close() |
| 571 |
|
| 572 |
req := &adminpb.GetUserCredsRequest{ |
| 573 |
// TODO: Fill request struct fields. |
| 574 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#GetUserCredsRequest. |
| 575 |
} |
| 576 |
resp, err := c.GetUserCreds(ctx, req) |
| 577 |
if err != nil { |
| 578 |
// TODO: Handle error. |
| 579 |
} |
| 580 |
// TODO: Use resp. |
| 581 |
_ = resp |
| 582 |
} |
| 583 |
|
| 584 |
func ExampleFirestoreAdminClient_ImportDocuments() { |
| 585 |
ctx := context.Background() |
| 586 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 587 |
// It will require modifications to work: |
| 588 |
// - It may require correct/in-range values for request initialization. |
| 589 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 590 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 591 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 592 |
if err != nil { |
| 593 |
// TODO: Handle error. |
| 594 |
} |
| 595 |
defer c.Close() |
| 596 |
|
| 597 |
req := &adminpb.ImportDocumentsRequest{ |
| 598 |
// TODO: Fill request struct fields. |
| 599 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ImportDocumentsRequest. |
| 600 |
} |
| 601 |
op, err := c.ImportDocuments(ctx, req) |
| 602 |
if err != nil { |
| 603 |
// TODO: Handle error. |
| 604 |
} |
| 605 |
|
| 606 |
err = op.Wait(ctx) |
| 607 |
if err != nil { |
| 608 |
// TODO: Handle error. |
| 609 |
} |
| 610 |
} |
| 611 |
|
| 612 |
func ExampleFirestoreAdminClient_ListBackupSchedules() { |
| 613 |
ctx := context.Background() |
| 614 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 615 |
// It will require modifications to work: |
| 616 |
// - It may require correct/in-range values for request initialization. |
| 617 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 618 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 619 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 620 |
if err != nil { |
| 621 |
// TODO: Handle error. |
| 622 |
} |
| 623 |
defer c.Close() |
| 624 |
|
| 625 |
req := &adminpb.ListBackupSchedulesRequest{ |
| 626 |
// TODO: Fill request struct fields. |
| 627 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ListBackupSchedulesRequest. |
| 628 |
} |
| 629 |
resp, err := c.ListBackupSchedules(ctx, req) |
| 630 |
if err != nil { |
| 631 |
// TODO: Handle error. |
| 632 |
} |
| 633 |
// TODO: Use resp. |
| 634 |
_ = resp |
| 635 |
} |
| 636 |
|
| 637 |
func ExampleFirestoreAdminClient_ListBackups() { |
| 638 |
ctx := context.Background() |
| 639 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 640 |
// It will require modifications to work: |
| 641 |
// - It may require correct/in-range values for request initialization. |
| 642 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 643 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 644 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 645 |
if err != nil { |
| 646 |
// TODO: Handle error. |
| 647 |
} |
| 648 |
defer c.Close() |
| 649 |
|
| 650 |
req := &adminpb.ListBackupsRequest{ |
| 651 |
// TODO: Fill request struct fields. |
| 652 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ListBackupsRequest. |
| 653 |
} |
| 654 |
resp, err := c.ListBackups(ctx, req) |
| 655 |
if err != nil { |
| 656 |
// TODO: Handle error. |
| 657 |
} |
| 658 |
// TODO: Use resp. |
| 659 |
_ = resp |
| 660 |
} |
| 661 |
|
| 662 |
func ExampleFirestoreAdminClient_ListDatabases() { |
| 663 |
ctx := context.Background() |
| 664 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 665 |
// It will require modifications to work: |
| 666 |
// - It may require correct/in-range values for request initialization. |
| 667 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 668 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 669 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 670 |
if err != nil { |
| 671 |
// TODO: Handle error. |
| 672 |
} |
| 673 |
defer c.Close() |
| 674 |
|
| 675 |
req := &adminpb.ListDatabasesRequest{ |
| 676 |
// TODO: Fill request struct fields. |
| 677 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ListDatabasesRequest. |
| 678 |
} |
| 679 |
resp, err := c.ListDatabases(ctx, req) |
| 680 |
if err != nil { |
| 681 |
// TODO: Handle error. |
| 682 |
} |
| 683 |
// TODO: Use resp. |
| 684 |
_ = resp |
| 685 |
} |
| 686 |
|
| 687 |
func ExampleFirestoreAdminClient_ListFields() { |
| 688 |
ctx := context.Background() |
| 689 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 690 |
// It will require modifications to work: |
| 691 |
// - It may require correct/in-range values for request initialization. |
| 692 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 693 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 694 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 695 |
if err != nil { |
| 696 |
// TODO: Handle error. |
| 697 |
} |
| 698 |
defer c.Close() |
| 699 |
|
| 700 |
req := &adminpb.ListFieldsRequest{ |
| 701 |
// TODO: Fill request struct fields. |
| 702 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ListFieldsRequest. |
| 703 |
} |
| 704 |
it := c.ListFields(ctx, req) |
| 705 |
for { |
| 706 |
resp, err := it.Next() |
| 707 |
if err == iterator.Done { |
| 708 |
break |
| 709 |
} |
| 710 |
if err != nil { |
| 711 |
// TODO: Handle error. |
| 712 |
} |
| 713 |
// TODO: Use resp. |
| 714 |
_ = resp |
| 715 |
|
| 716 |
// If you need to access the underlying RPC response, |
| 717 |
// you can do so by casting the `Response` as below. |
| 718 |
// Otherwise, remove this line. Only populated after |
| 719 |
// first call to Next(). Not safe for concurrent access. |
| 720 |
_ = it.Response.(*adminpb.ListFieldsResponse) |
| 721 |
} |
| 722 |
} |
| 723 |
|
| 724 |
func ExampleFirestoreAdminClient_ListIndexes() { |
| 725 |
ctx := context.Background() |
| 726 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 727 |
// It will require modifications to work: |
| 728 |
// - It may require correct/in-range values for request initialization. |
| 729 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 730 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 731 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 732 |
if err != nil { |
| 733 |
// TODO: Handle error. |
| 734 |
} |
| 735 |
defer c.Close() |
| 736 |
|
| 737 |
req := &adminpb.ListIndexesRequest{ |
| 738 |
// TODO: Fill request struct fields. |
| 739 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ListIndexesRequest. |
| 740 |
} |
| 741 |
it := c.ListIndexes(ctx, req) |
| 742 |
for { |
| 743 |
resp, err := it.Next() |
| 744 |
if err == iterator.Done { |
| 745 |
break |
| 746 |
} |
| 747 |
if err != nil { |
| 748 |
// TODO: Handle error. |
| 749 |
} |
| 750 |
// TODO: Use resp. |
| 751 |
_ = resp |
| 752 |
|
| 753 |
// If you need to access the underlying RPC response, |
| 754 |
// you can do so by casting the `Response` as below. |
| 755 |
// Otherwise, remove this line. Only populated after |
| 756 |
// first call to Next(). Not safe for concurrent access. |
| 757 |
_ = it.Response.(*adminpb.ListIndexesResponse) |
| 758 |
} |
| 759 |
} |
| 760 |
|
| 761 |
func ExampleFirestoreAdminClient_ListUserCreds() { |
| 762 |
ctx := context.Background() |
| 763 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 764 |
// It will require modifications to work: |
| 765 |
// - It may require correct/in-range values for request initialization. |
| 766 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 767 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 768 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 769 |
if err != nil { |
| 770 |
// TODO: Handle error. |
| 771 |
} |
| 772 |
defer c.Close() |
| 773 |
|
| 774 |
req := &adminpb.ListUserCredsRequest{ |
| 775 |
// TODO: Fill request struct fields. |
| 776 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ListUserCredsRequest. |
| 777 |
} |
| 778 |
resp, err := c.ListUserCreds(ctx, req) |
| 779 |
if err != nil { |
| 780 |
// TODO: Handle error. |
| 781 |
} |
| 782 |
// TODO: Use resp. |
| 783 |
_ = resp |
| 784 |
} |
| 785 |
|
| 786 |
func ExampleFirestoreAdminClient_ResetUserPassword() { |
| 787 |
ctx := context.Background() |
| 788 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 789 |
// It will require modifications to work: |
| 790 |
// - It may require correct/in-range values for request initialization. |
| 791 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 792 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 793 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 794 |
if err != nil { |
| 795 |
// TODO: Handle error. |
| 796 |
} |
| 797 |
defer c.Close() |
| 798 |
|
| 799 |
req := &adminpb.ResetUserPasswordRequest{ |
| 800 |
// TODO: Fill request struct fields. |
| 801 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ResetUserPasswordRequest. |
| 802 |
} |
| 803 |
resp, err := c.ResetUserPassword(ctx, req) |
| 804 |
if err != nil { |
| 805 |
// TODO: Handle error. |
| 806 |
} |
| 807 |
// TODO: Use resp. |
| 808 |
_ = resp |
| 809 |
} |
| 810 |
|
| 811 |
func ExampleFirestoreAdminClient_RestoreDatabase() { |
| 812 |
ctx := context.Background() |
| 813 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 814 |
// It will require modifications to work: |
| 815 |
// - It may require correct/in-range values for request initialization. |
| 816 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 817 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 818 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 819 |
if err != nil { |
| 820 |
// TODO: Handle error. |
| 821 |
} |
| 822 |
defer c.Close() |
| 823 |
|
| 824 |
req := &adminpb.RestoreDatabaseRequest{ |
| 825 |
// TODO: Fill request struct fields. |
| 826 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#RestoreDatabaseRequest. |
| 827 |
} |
| 828 |
op, err := c.RestoreDatabase(ctx, req) |
| 829 |
if err != nil { |
| 830 |
// TODO: Handle error. |
| 831 |
} |
| 832 |
|
| 833 |
resp, err := op.Wait(ctx) |
| 834 |
if err != nil { |
| 835 |
// TODO: Handle error. |
| 836 |
} |
| 837 |
// TODO: Use resp. |
| 838 |
_ = resp |
| 839 |
} |
| 840 |
|
| 841 |
func ExampleFirestoreAdminClient_UpdateBackupSchedule() { |
| 842 |
ctx := context.Background() |
| 843 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 844 |
// It will require modifications to work: |
| 845 |
// - It may require correct/in-range values for request initialization. |
| 846 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 847 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 848 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 849 |
if err != nil { |
| 850 |
// TODO: Handle error. |
| 851 |
} |
| 852 |
defer c.Close() |
| 853 |
|
| 854 |
req := &adminpb.UpdateBackupScheduleRequest{ |
| 855 |
// TODO: Fill request struct fields. |
| 856 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#UpdateBackupScheduleRequest. |
| 857 |
} |
| 858 |
resp, err := c.UpdateBackupSchedule(ctx, req) |
| 859 |
if err != nil { |
| 860 |
// TODO: Handle error. |
| 861 |
} |
| 862 |
// TODO: Use resp. |
| 863 |
_ = resp |
| 864 |
} |
| 865 |
|
| 866 |
func ExampleFirestoreAdminClient_UpdateDatabase() { |
| 867 |
ctx := context.Background() |
| 868 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 869 |
// It will require modifications to work: |
| 870 |
// - It may require correct/in-range values for request initialization. |
| 871 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 872 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 873 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 874 |
if err != nil { |
| 875 |
// TODO: Handle error. |
| 876 |
} |
| 877 |
defer c.Close() |
| 878 |
|
| 879 |
req := &adminpb.UpdateDatabaseRequest{ |
| 880 |
// TODO: Fill request struct fields. |
| 881 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#UpdateDatabaseRequest. |
| 882 |
} |
| 883 |
op, err := c.UpdateDatabase(ctx, req) |
| 884 |
if err != nil { |
| 885 |
// TODO: Handle error. |
| 886 |
} |
| 887 |
|
| 888 |
resp, err := op.Wait(ctx) |
| 889 |
if err != nil { |
| 890 |
// TODO: Handle error. |
| 891 |
} |
| 892 |
// TODO: Use resp. |
| 893 |
_ = resp |
| 894 |
} |
| 895 |
|
| 896 |
func ExampleFirestoreAdminClient_UpdateField() { |
| 897 |
ctx := context.Background() |
| 898 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 899 |
// It will require modifications to work: |
| 900 |
// - It may require correct/in-range values for request initialization. |
| 901 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 902 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 903 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 904 |
if err != nil { |
| 905 |
// TODO: Handle error. |
| 906 |
} |
| 907 |
defer c.Close() |
| 908 |
|
| 909 |
req := &adminpb.UpdateFieldRequest{ |
| 910 |
// TODO: Fill request struct fields. |
| 911 |
// See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#UpdateFieldRequest. |
| 912 |
} |
| 913 |
op, err := c.UpdateField(ctx, req) |
| 914 |
if err != nil { |
| 915 |
// TODO: Handle error. |
| 916 |
} |
| 917 |
|
| 918 |
resp, err := op.Wait(ctx) |
| 919 |
if err != nil { |
| 920 |
// TODO: Handle error. |
| 921 |
} |
| 922 |
// TODO: Use resp. |
| 923 |
_ = resp |
| 924 |
} |
| 925 |
|
| 926 |
func ExampleFirestoreAdminClient_CancelOperation() { |
| 927 |
ctx := context.Background() |
| 928 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 929 |
// It will require modifications to work: |
| 930 |
// - It may require correct/in-range values for request initialization. |
| 931 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 932 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 933 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 934 |
if err != nil { |
| 935 |
// TODO: Handle error. |
| 936 |
} |
| 937 |
defer c.Close() |
| 938 |
|
| 939 |
req := &longrunningpb.CancelOperationRequest{ |
| 940 |
// TODO: Fill request struct fields. |
| 941 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. |
| 942 |
} |
| 943 |
err = c.CancelOperation(ctx, req) |
| 944 |
if err != nil { |
| 945 |
// TODO: Handle error. |
| 946 |
} |
| 947 |
} |
| 948 |
|
| 949 |
func ExampleFirestoreAdminClient_DeleteOperation() { |
| 950 |
ctx := context.Background() |
| 951 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 952 |
// It will require modifications to work: |
| 953 |
// - It may require correct/in-range values for request initialization. |
| 954 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 955 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 956 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 957 |
if err != nil { |
| 958 |
// TODO: Handle error. |
| 959 |
} |
| 960 |
defer c.Close() |
| 961 |
|
| 962 |
req := &longrunningpb.DeleteOperationRequest{ |
| 963 |
// TODO: Fill request struct fields. |
| 964 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest. |
| 965 |
} |
| 966 |
err = c.DeleteOperation(ctx, req) |
| 967 |
if err != nil { |
| 968 |
// TODO: Handle error. |
| 969 |
} |
| 970 |
} |
| 971 |
|
| 972 |
func ExampleFirestoreAdminClient_GetOperation() { |
| 973 |
ctx := context.Background() |
| 974 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 975 |
// It will require modifications to work: |
| 976 |
// - It may require correct/in-range values for request initialization. |
| 977 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 978 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 979 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 980 |
if err != nil { |
| 981 |
// TODO: Handle error. |
| 982 |
} |
| 983 |
defer c.Close() |
| 984 |
|
| 985 |
req := &longrunningpb.GetOperationRequest{ |
| 986 |
// TODO: Fill request struct fields. |
| 987 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. |
| 988 |
} |
| 989 |
resp, err := c.GetOperation(ctx, req) |
| 990 |
if err != nil { |
| 991 |
// TODO: Handle error. |
| 992 |
} |
| 993 |
// TODO: Use resp. |
| 994 |
_ = resp |
| 995 |
} |
| 996 |
|
| 997 |
func ExampleFirestoreAdminClient_ListOperations() { |
| 998 |
ctx := context.Background() |
| 999 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 1000 |
// It will require modifications to work: |
| 1001 |
// - It may require correct/in-range values for request initialization. |
| 1002 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 1003 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 1004 |
c, err := apiv1.NewFirestoreAdminClient(ctx) |
| 1005 |
if err != nil { |
| 1006 |
// TODO: Handle error. |
| 1007 |
} |
| 1008 |
defer c.Close() |
| 1009 |
|
| 1010 |
req := &longrunningpb.ListOperationsRequest{ |
| 1011 |
// TODO: Fill request struct fields. |
| 1012 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. |
| 1013 |
} |
| 1014 |
it := c.ListOperations(ctx, req) |
| 1015 |
for { |
| 1016 |
resp, err := it.Next() |
| 1017 |
if err == iterator.Done { |
| 1018 |
break |
| 1019 |
} |
| 1020 |
if err != nil { |
| 1021 |
// TODO: Handle error. |
| 1022 |
} |
| 1023 |
// TODO: Use resp. |
| 1024 |
_ = resp |
| 1025 |
|
| 1026 |
// If you need to access the underlying RPC response, |
| 1027 |
// you can do so by casting the `Response` as below. |
| 1028 |
// Otherwise, remove this line. Only populated after |
| 1029 |
// first call to Next(). Not safe for concurrent access. |
| 1030 |
_ = it.Response.(*longrunningpb.ListOperationsResponse) |
| 1031 |
} |
| 1032 |
} |