| 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 gkehub_test |
| 18 | |
| 19 | import ( |
| 20 | "context" |
| 21 | |
| 22 | gkehub "cloud.google.com/go/gkehub/apiv1beta1" |
| 23 | gkehubpb "cloud.google.com/go/gkehub/apiv1beta1/gkehubpb" |
| 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 ExampleNewGkeHubMembershipClient() { |
| 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 := gkehub.NewGkeHubMembershipClient(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 ExampleNewGkeHubMembershipRESTClient() { |
| 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 := gkehub.NewGkeHubMembershipRESTClient(ctx) |
| 55 | if err != nil { |
| 56 | // TODO: Handle error. |
| 57 | } |
| 58 | defer c.Close() |
| 59 | |
| 60 | // TODO: Use client. |
| 61 | _ = c |
| 62 | } |
| 63 | |
| 64 | func ExampleGkeHubMembershipClient_CreateMembership() { |
| 65 | ctx := context.Background() |
| 66 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 67 | // It will require modifications to work: |
| 68 | // - It may require correct/in-range values for request initialization. |
| 69 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 70 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 71 | c, err := gkehub.NewGkeHubMembershipClient(ctx) |
| 72 | if err != nil { |
| 73 | // TODO: Handle error. |
| 74 | } |
| 75 | defer c.Close() |
| 76 | |
| 77 | req := &gkehubpb.CreateMembershipRequest{ |
| 78 | // TODO: Fill request struct fields. |
| 79 | // See https://pkg.go.dev/cloud.google.com/go/gkehub/apiv1beta1/gkehubpb#CreateMembershipRequest. |
| 80 | } |
| 81 | op, err := c.CreateMembership(ctx, req) |
| 82 | if err != nil { |
| 83 | // TODO: Handle error. |
| 84 | } |
| 85 | |
| 86 | resp, err := op.Wait(ctx) |
| 87 | if err != nil { |
| 88 | // TODO: Handle error. |
| 89 | } |
| 90 | // TODO: Use resp. |
| 91 | _ = resp |
| 92 | } |
| 93 | |
| 94 | func ExampleGkeHubMembershipClient_DeleteMembership() { |
| 95 | ctx := context.Background() |
| 96 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 97 | // It will require modifications to work: |
| 98 | // - It may require correct/in-range values for request initialization. |
| 99 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 100 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 101 | c, err := gkehub.NewGkeHubMembershipClient(ctx) |
| 102 | if err != nil { |
| 103 | // TODO: Handle error. |
| 104 | } |
| 105 | defer c.Close() |
| 106 | |
| 107 | req := &gkehubpb.DeleteMembershipRequest{ |
| 108 | // TODO: Fill request struct fields. |
| 109 | // See https://pkg.go.dev/cloud.google.com/go/gkehub/apiv1beta1/gkehubpb#DeleteMembershipRequest. |
| 110 | } |
| 111 | op, err := c.DeleteMembership(ctx, req) |
| 112 | if err != nil { |
| 113 | // TODO: Handle error. |
| 114 | } |
| 115 | |
| 116 | err = op.Wait(ctx) |
| 117 | if err != nil { |
| 118 | // TODO: Handle error. |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | func ExampleGkeHubMembershipClient_GenerateConnectManifest() { |
| 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 := gkehub.NewGkeHubMembershipClient(ctx) |
| 130 | if err != nil { |
| 131 | // TODO: Handle error. |
| 132 | } |
| 133 | defer c.Close() |
| 134 | |
| 135 | req := &gkehubpb.GenerateConnectManifestRequest{ |
| 136 | // TODO: Fill request struct fields. |
| 137 | // See https://pkg.go.dev/cloud.google.com/go/gkehub/apiv1beta1/gkehubpb#GenerateConnectManifestRequest. |
| 138 | } |
| 139 | resp, err := c.GenerateConnectManifest(ctx, req) |
| 140 | if err != nil { |
| 141 | // TODO: Handle error. |
| 142 | } |
| 143 | // TODO: Use resp. |
| 144 | _ = resp |
| 145 | } |
| 146 | |
| 147 | func ExampleGkeHubMembershipClient_GenerateExclusivityManifest() { |
| 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 := gkehub.NewGkeHubMembershipClient(ctx) |
| 155 | if err != nil { |
| 156 | // TODO: Handle error. |
| 157 | } |
| 158 | defer c.Close() |
| 159 | |
| 160 | req := &gkehubpb.GenerateExclusivityManifestRequest{ |
| 161 | // TODO: Fill request struct fields. |
| 162 | // See https://pkg.go.dev/cloud.google.com/go/gkehub/apiv1beta1/gkehubpb#GenerateExclusivityManifestRequest. |
| 163 | } |
| 164 | resp, err := c.GenerateExclusivityManifest(ctx, req) |
| 165 | if err != nil { |
| 166 | // TODO: Handle error. |
| 167 | } |
| 168 | // TODO: Use resp. |
| 169 | _ = resp |
| 170 | } |
| 171 | |
| 172 | func ExampleGkeHubMembershipClient_GetMembership() { |
| 173 | ctx := context.Background() |
| 174 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 175 | // It will require modifications to work: |
| 176 | // - It may require correct/in-range values for request initialization. |
| 177 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 178 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 179 | c, err := gkehub.NewGkeHubMembershipClient(ctx) |
| 180 | if err != nil { |
| 181 | // TODO: Handle error. |
| 182 | } |
| 183 | defer c.Close() |
| 184 | |
| 185 | req := &gkehubpb.GetMembershipRequest{ |
| 186 | // TODO: Fill request struct fields. |
| 187 | // See https://pkg.go.dev/cloud.google.com/go/gkehub/apiv1beta1/gkehubpb#GetMembershipRequest. |
| 188 | } |
| 189 | resp, err := c.GetMembership(ctx, req) |
| 190 | if err != nil { |
| 191 | // TODO: Handle error. |
| 192 | } |
| 193 | // TODO: Use resp. |
| 194 | _ = resp |
| 195 | } |
| 196 | |
| 197 | func ExampleGkeHubMembershipClient_ListMemberships() { |
| 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 := gkehub.NewGkeHubMembershipClient(ctx) |
| 205 | if err != nil { |
| 206 | // TODO: Handle error. |
| 207 | } |
| 208 | defer c.Close() |
| 209 | |
| 210 | req := &gkehubpb.ListMembershipsRequest{ |
| 211 | // TODO: Fill request struct fields. |
| 212 | // See https://pkg.go.dev/cloud.google.com/go/gkehub/apiv1beta1/gkehubpb#ListMembershipsRequest. |
| 213 | } |
| 214 | it := c.ListMemberships(ctx, req) |
| 215 | for { |
| 216 | resp, err := it.Next() |
| 217 | if err == iterator.Done { |
| 218 | break |
| 219 | } |
| 220 | if err != nil { |
| 221 | // TODO: Handle error. |
| 222 | } |
| 223 | // TODO: Use resp. |
| 224 | _ = resp |
| 225 | |
| 226 | // If you need to access the underlying RPC response, |
| 227 | // you can do so by casting the `Response` as below. |
| 228 | // Otherwise, remove this line. Only populated after |
| 229 | // first call to Next(). Not safe for concurrent access. |
| 230 | _ = it.Response.(*gkehubpb.ListMembershipsResponse) |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | func ExampleGkeHubMembershipClient_UpdateMembership() { |
| 235 | ctx := context.Background() |
| 236 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 237 | // It will require modifications to work: |
| 238 | // - It may require correct/in-range values for request initialization. |
| 239 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 240 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 241 | c, err := gkehub.NewGkeHubMembershipClient(ctx) |
| 242 | if err != nil { |
| 243 | // TODO: Handle error. |
| 244 | } |
| 245 | defer c.Close() |
| 246 | |
| 247 | req := &gkehubpb.UpdateMembershipRequest{ |
| 248 | // TODO: Fill request struct fields. |
| 249 | // See https://pkg.go.dev/cloud.google.com/go/gkehub/apiv1beta1/gkehubpb#UpdateMembershipRequest. |
| 250 | } |
| 251 | op, err := c.UpdateMembership(ctx, req) |
| 252 | if err != nil { |
| 253 | // TODO: Handle error. |
| 254 | } |
| 255 | |
| 256 | resp, err := op.Wait(ctx) |
| 257 | if err != nil { |
| 258 | // TODO: Handle error. |
| 259 | } |
| 260 | // TODO: Use resp. |
| 261 | _ = resp |
| 262 | } |
| 263 | |
| 264 | func ExampleGkeHubMembershipClient_ValidateExclusivity() { |
| 265 | ctx := context.Background() |
| 266 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 267 | // It will require modifications to work: |
| 268 | // - It may require correct/in-range values for request initialization. |
| 269 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 270 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 271 | c, err := gkehub.NewGkeHubMembershipClient(ctx) |
| 272 | if err != nil { |
| 273 | // TODO: Handle error. |
| 274 | } |
| 275 | defer c.Close() |
| 276 | |
| 277 | req := &gkehubpb.ValidateExclusivityRequest{ |
| 278 | // TODO: Fill request struct fields. |
| 279 | // See https://pkg.go.dev/cloud.google.com/go/gkehub/apiv1beta1/gkehubpb#ValidateExclusivityRequest. |
| 280 | } |
| 281 | resp, err := c.ValidateExclusivity(ctx, req) |
| 282 | if err != nil { |
| 283 | // TODO: Handle error. |
| 284 | } |
| 285 | // TODO: Use resp. |
| 286 | _ = resp |
| 287 | } |
| 288 | |
| 289 | func ExampleGkeHubMembershipClient_GetLocation() { |
| 290 | ctx := context.Background() |
| 291 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 292 | // It will require modifications to work: |
| 293 | // - It may require correct/in-range values for request initialization. |
| 294 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 295 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 296 | c, err := gkehub.NewGkeHubMembershipClient(ctx) |
| 297 | if err != nil { |
| 298 | // TODO: Handle error. |
| 299 | } |
| 300 | defer c.Close() |
| 301 | |
| 302 | req := &locationpb.GetLocationRequest{ |
| 303 | // TODO: Fill request struct fields. |
| 304 | // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest. |
| 305 | } |
| 306 | resp, err := c.GetLocation(ctx, req) |
| 307 | if err != nil { |
| 308 | // TODO: Handle error. |
| 309 | } |
| 310 | // TODO: Use resp. |
| 311 | _ = resp |
| 312 | } |
| 313 | |
| 314 | func ExampleGkeHubMembershipClient_ListLocations() { |
| 315 | ctx := context.Background() |
| 316 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 317 | // It will require modifications to work: |
| 318 | // - It may require correct/in-range values for request initialization. |
| 319 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 320 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 321 | c, err := gkehub.NewGkeHubMembershipClient(ctx) |
| 322 | if err != nil { |
| 323 | // TODO: Handle error. |
| 324 | } |
| 325 | defer c.Close() |
| 326 | |
| 327 | req := &locationpb.ListLocationsRequest{ |
| 328 | // TODO: Fill request struct fields. |
| 329 | // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. |
| 330 | } |
| 331 | it := c.ListLocations(ctx, req) |
| 332 | for { |
| 333 | resp, err := it.Next() |
| 334 | if err == iterator.Done { |
| 335 | break |
| 336 | } |
| 337 | if err != nil { |
| 338 | // TODO: Handle error. |
| 339 | } |
| 340 | // TODO: Use resp. |
| 341 | _ = resp |
| 342 | |
| 343 | // If you need to access the underlying RPC response, |
| 344 | // you can do so by casting the `Response` as below. |
| 345 | // Otherwise, remove this line. Only populated after |
| 346 | // first call to Next(). Not safe for concurrent access. |
| 347 | _ = it.Response.(*locationpb.ListLocationsResponse) |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | func ExampleGkeHubMembershipClient_GetIamPolicy() { |
| 352 | ctx := context.Background() |
| 353 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 354 | // It will require modifications to work: |
| 355 | // - It may require correct/in-range values for request initialization. |
| 356 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 357 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 358 | c, err := gkehub.NewGkeHubMembershipClient(ctx) |
| 359 | if err != nil { |
| 360 | // TODO: Handle error. |
| 361 | } |
| 362 | defer c.Close() |
| 363 | |
| 364 | req := &iampb.GetIamPolicyRequest{ |
| 365 | // TODO: Fill request struct fields. |
| 366 | // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest. |
| 367 | } |
| 368 | resp, err := c.GetIamPolicy(ctx, req) |
| 369 | if err != nil { |
| 370 | // TODO: Handle error. |
| 371 | } |
| 372 | // TODO: Use resp. |
| 373 | _ = resp |
| 374 | } |
| 375 | |
| 376 | func ExampleGkeHubMembershipClient_SetIamPolicy() { |
| 377 | ctx := context.Background() |
| 378 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 379 | // It will require modifications to work: |
| 380 | // - It may require correct/in-range values for request initialization. |
| 381 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 382 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 383 | c, err := gkehub.NewGkeHubMembershipClient(ctx) |
| 384 | if err != nil { |
| 385 | // TODO: Handle error. |
| 386 | } |
| 387 | defer c.Close() |
| 388 | |
| 389 | req := &iampb.SetIamPolicyRequest{ |
| 390 | // TODO: Fill request struct fields. |
| 391 | // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest. |
| 392 | } |
| 393 | resp, err := c.SetIamPolicy(ctx, req) |
| 394 | if err != nil { |
| 395 | // TODO: Handle error. |
| 396 | } |
| 397 | // TODO: Use resp. |
| 398 | _ = resp |
| 399 | } |
| 400 | |
| 401 | func ExampleGkeHubMembershipClient_TestIamPermissions() { |
| 402 | ctx := context.Background() |
| 403 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 404 | // It will require modifications to work: |
| 405 | // - It may require correct/in-range values for request initialization. |
| 406 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 407 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 408 | c, err := gkehub.NewGkeHubMembershipClient(ctx) |
| 409 | if err != nil { |
| 410 | // TODO: Handle error. |
| 411 | } |
| 412 | defer c.Close() |
| 413 | |
| 414 | req := &iampb.TestIamPermissionsRequest{ |
| 415 | // TODO: Fill request struct fields. |
| 416 | // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest. |
| 417 | } |
| 418 | resp, err := c.TestIamPermissions(ctx, req) |
| 419 | if err != nil { |
| 420 | // TODO: Handle error. |
| 421 | } |
| 422 | // TODO: Use resp. |
| 423 | _ = resp |
| 424 | } |
| 425 | |
| 426 | func ExampleGkeHubMembershipClient_CancelOperation() { |
| 427 | ctx := context.Background() |
| 428 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 429 | // It will require modifications to work: |
| 430 | // - It may require correct/in-range values for request initialization. |
| 431 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 432 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 433 | c, err := gkehub.NewGkeHubMembershipClient(ctx) |
| 434 | if err != nil { |
| 435 | // TODO: Handle error. |
| 436 | } |
| 437 | defer c.Close() |
| 438 | |
| 439 | req := &longrunningpb.CancelOperationRequest{ |
| 440 | // TODO: Fill request struct fields. |
| 441 | // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. |
| 442 | } |
| 443 | err = c.CancelOperation(ctx, req) |
| 444 | if err != nil { |
| 445 | // TODO: Handle error. |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | func ExampleGkeHubMembershipClient_DeleteOperation() { |
| 450 | ctx := context.Background() |
| 451 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 452 | // It will require modifications to work: |
| 453 | // - It may require correct/in-range values for request initialization. |
| 454 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 455 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 456 | c, err := gkehub.NewGkeHubMembershipClient(ctx) |
| 457 | if err != nil { |
| 458 | // TODO: Handle error. |
| 459 | } |
| 460 | defer c.Close() |
| 461 | |
| 462 | req := &longrunningpb.DeleteOperationRequest{ |
| 463 | // TODO: Fill request struct fields. |
| 464 | // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest. |
| 465 | } |
| 466 | err = c.DeleteOperation(ctx, req) |
| 467 | if err != nil { |
| 468 | // TODO: Handle error. |
| 469 | } |
| 470 | } |
| 471 | |
| 472 | func ExampleGkeHubMembershipClient_GetOperation() { |
| 473 | ctx := context.Background() |
| 474 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 475 | // It will require modifications to work: |
| 476 | // - It may require correct/in-range values for request initialization. |
| 477 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 478 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 479 | c, err := gkehub.NewGkeHubMembershipClient(ctx) |
| 480 | if err != nil { |
| 481 | // TODO: Handle error. |
| 482 | } |
| 483 | defer c.Close() |
| 484 | |
| 485 | req := &longrunningpb.GetOperationRequest{ |
| 486 | // TODO: Fill request struct fields. |
| 487 | // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. |
| 488 | } |
| 489 | resp, err := c.GetOperation(ctx, req) |
| 490 | if err != nil { |
| 491 | // TODO: Handle error. |
| 492 | } |
| 493 | // TODO: Use resp. |
| 494 | _ = resp |
| 495 | } |
| 496 | |
| 497 | func ExampleGkeHubMembershipClient_ListOperations() { |
| 498 | ctx := context.Background() |
| 499 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 500 | // It will require modifications to work: |
| 501 | // - It may require correct/in-range values for request initialization. |
| 502 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 503 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 504 | c, err := gkehub.NewGkeHubMembershipClient(ctx) |
| 505 | if err != nil { |
| 506 | // TODO: Handle error. |
| 507 | } |
| 508 | defer c.Close() |
| 509 | |
| 510 | req := &longrunningpb.ListOperationsRequest{ |
| 511 | // TODO: Fill request struct fields. |
| 512 | // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. |
| 513 | } |
| 514 | it := c.ListOperations(ctx, req) |
| 515 | for { |
| 516 | resp, err := it.Next() |
| 517 | if err == iterator.Done { |
| 518 | break |
| 519 | } |
| 520 | if err != nil { |
| 521 | // TODO: Handle error. |
| 522 | } |
| 523 | // TODO: Use resp. |
| 524 | _ = resp |
| 525 | |
| 526 | // If you need to access the underlying RPC response, |
| 527 | // you can do so by casting the `Response` as below. |
| 528 | // Otherwise, remove this line. Only populated after |
| 529 | // first call to Next(). Not safe for concurrent access. |
| 530 | _ = it.Response.(*longrunningpb.ListOperationsResponse) |
| 531 | } |
| 532 | } |