| 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 gkemulticloud_test |
| 18 | |
| 19 | import ( |
| 20 | "context" |
| 21 | |
| 22 | gkemulticloud "cloud.google.com/go/gkemulticloud/apiv1" |
| 23 | gkemulticloudpb "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb" |
| 24 | longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 25 | "google.golang.org/api/iterator" |
| 26 | ) |
| 27 | |
| 28 | func ExampleNewAwsClustersClient() { |
| 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 := gkemulticloud.NewAwsClustersClient(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 ExampleAwsClustersClient_CreateAwsCluster() { |
| 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 := gkemulticloud.NewAwsClustersClient(ctx) |
| 53 | if err != nil { |
| 54 | // TODO: Handle error. |
| 55 | } |
| 56 | defer c.Close() |
| 57 | |
| 58 | req := &gkemulticloudpb.CreateAwsClusterRequest{ |
| 59 | // TODO: Fill request struct fields. |
| 60 | // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#CreateAwsClusterRequest. |
| 61 | } |
| 62 | op, err := c.CreateAwsCluster(ctx, req) |
| 63 | if err != nil { |
| 64 | // TODO: Handle error. |
| 65 | } |
| 66 | |
| 67 | resp, err := op.Wait(ctx) |
| 68 | if err != nil { |
| 69 | // TODO: Handle error. |
| 70 | } |
| 71 | // TODO: Use resp. |
| 72 | _ = resp |
| 73 | } |
| 74 | |
| 75 | func ExampleAwsClustersClient_CreateAwsNodePool() { |
| 76 | ctx := context.Background() |
| 77 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 78 | // It will require modifications to work: |
| 79 | // - It may require correct/in-range values for request initialization. |
| 80 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 81 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 82 | c, err := gkemulticloud.NewAwsClustersClient(ctx) |
| 83 | if err != nil { |
| 84 | // TODO: Handle error. |
| 85 | } |
| 86 | defer c.Close() |
| 87 | |
| 88 | req := &gkemulticloudpb.CreateAwsNodePoolRequest{ |
| 89 | // TODO: Fill request struct fields. |
| 90 | // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#CreateAwsNodePoolRequest. |
| 91 | } |
| 92 | op, err := c.CreateAwsNodePool(ctx, req) |
| 93 | if err != nil { |
| 94 | // TODO: Handle error. |
| 95 | } |
| 96 | |
| 97 | resp, err := op.Wait(ctx) |
| 98 | if err != nil { |
| 99 | // TODO: Handle error. |
| 100 | } |
| 101 | // TODO: Use resp. |
| 102 | _ = resp |
| 103 | } |
| 104 | |
| 105 | func ExampleAwsClustersClient_DeleteAwsCluster() { |
| 106 | ctx := context.Background() |
| 107 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 108 | // It will require modifications to work: |
| 109 | // - It may require correct/in-range values for request initialization. |
| 110 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 111 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 112 | c, err := gkemulticloud.NewAwsClustersClient(ctx) |
| 113 | if err != nil { |
| 114 | // TODO: Handle error. |
| 115 | } |
| 116 | defer c.Close() |
| 117 | |
| 118 | req := &gkemulticloudpb.DeleteAwsClusterRequest{ |
| 119 | // TODO: Fill request struct fields. |
| 120 | // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#DeleteAwsClusterRequest. |
| 121 | } |
| 122 | op, err := c.DeleteAwsCluster(ctx, req) |
| 123 | if err != nil { |
| 124 | // TODO: Handle error. |
| 125 | } |
| 126 | |
| 127 | err = op.Wait(ctx) |
| 128 | if err != nil { |
| 129 | // TODO: Handle error. |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | func ExampleAwsClustersClient_DeleteAwsNodePool() { |
| 134 | ctx := context.Background() |
| 135 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 136 | // It will require modifications to work: |
| 137 | // - It may require correct/in-range values for request initialization. |
| 138 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 139 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 140 | c, err := gkemulticloud.NewAwsClustersClient(ctx) |
| 141 | if err != nil { |
| 142 | // TODO: Handle error. |
| 143 | } |
| 144 | defer c.Close() |
| 145 | |
| 146 | req := &gkemulticloudpb.DeleteAwsNodePoolRequest{ |
| 147 | // TODO: Fill request struct fields. |
| 148 | // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#DeleteAwsNodePoolRequest. |
| 149 | } |
| 150 | op, err := c.DeleteAwsNodePool(ctx, req) |
| 151 | if err != nil { |
| 152 | // TODO: Handle error. |
| 153 | } |
| 154 | |
| 155 | err = op.Wait(ctx) |
| 156 | if err != nil { |
| 157 | // TODO: Handle error. |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | func ExampleAwsClustersClient_GenerateAwsAccessToken() { |
| 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 := gkemulticloud.NewAwsClustersClient(ctx) |
| 169 | if err != nil { |
| 170 | // TODO: Handle error. |
| 171 | } |
| 172 | defer c.Close() |
| 173 | |
| 174 | req := &gkemulticloudpb.GenerateAwsAccessTokenRequest{ |
| 175 | // TODO: Fill request struct fields. |
| 176 | // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#GenerateAwsAccessTokenRequest. |
| 177 | } |
| 178 | resp, err := c.GenerateAwsAccessToken(ctx, req) |
| 179 | if err != nil { |
| 180 | // TODO: Handle error. |
| 181 | } |
| 182 | // TODO: Use resp. |
| 183 | _ = resp |
| 184 | } |
| 185 | |
| 186 | func ExampleAwsClustersClient_GenerateAwsClusterAgentToken() { |
| 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 := gkemulticloud.NewAwsClustersClient(ctx) |
| 194 | if err != nil { |
| 195 | // TODO: Handle error. |
| 196 | } |
| 197 | defer c.Close() |
| 198 | |
| 199 | req := &gkemulticloudpb.GenerateAwsClusterAgentTokenRequest{ |
| 200 | // TODO: Fill request struct fields. |
| 201 | // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#GenerateAwsClusterAgentTokenRequest. |
| 202 | } |
| 203 | resp, err := c.GenerateAwsClusterAgentToken(ctx, req) |
| 204 | if err != nil { |
| 205 | // TODO: Handle error. |
| 206 | } |
| 207 | // TODO: Use resp. |
| 208 | _ = resp |
| 209 | } |
| 210 | |
| 211 | func ExampleAwsClustersClient_GetAwsCluster() { |
| 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 := gkemulticloud.NewAwsClustersClient(ctx) |
| 219 | if err != nil { |
| 220 | // TODO: Handle error. |
| 221 | } |
| 222 | defer c.Close() |
| 223 | |
| 224 | req := &gkemulticloudpb.GetAwsClusterRequest{ |
| 225 | // TODO: Fill request struct fields. |
| 226 | // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#GetAwsClusterRequest. |
| 227 | } |
| 228 | resp, err := c.GetAwsCluster(ctx, req) |
| 229 | if err != nil { |
| 230 | // TODO: Handle error. |
| 231 | } |
| 232 | // TODO: Use resp. |
| 233 | _ = resp |
| 234 | } |
| 235 | |
| 236 | func ExampleAwsClustersClient_GetAwsJsonWebKeys() { |
| 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 := gkemulticloud.NewAwsClustersClient(ctx) |
| 244 | if err != nil { |
| 245 | // TODO: Handle error. |
| 246 | } |
| 247 | defer c.Close() |
| 248 | |
| 249 | req := &gkemulticloudpb.GetAwsJsonWebKeysRequest{ |
| 250 | // TODO: Fill request struct fields. |
| 251 | // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#GetAwsJsonWebKeysRequest. |
| 252 | } |
| 253 | resp, err := c.GetAwsJsonWebKeys(ctx, req) |
| 254 | if err != nil { |
| 255 | // TODO: Handle error. |
| 256 | } |
| 257 | // TODO: Use resp. |
| 258 | _ = resp |
| 259 | } |
| 260 | |
| 261 | func ExampleAwsClustersClient_GetAwsNodePool() { |
| 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 := gkemulticloud.NewAwsClustersClient(ctx) |
| 269 | if err != nil { |
| 270 | // TODO: Handle error. |
| 271 | } |
| 272 | defer c.Close() |
| 273 | |
| 274 | req := &gkemulticloudpb.GetAwsNodePoolRequest{ |
| 275 | // TODO: Fill request struct fields. |
| 276 | // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#GetAwsNodePoolRequest. |
| 277 | } |
| 278 | resp, err := c.GetAwsNodePool(ctx, req) |
| 279 | if err != nil { |
| 280 | // TODO: Handle error. |
| 281 | } |
| 282 | // TODO: Use resp. |
| 283 | _ = resp |
| 284 | } |
| 285 | |
| 286 | func ExampleAwsClustersClient_GetAwsOpenIdConfig() { |
| 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 := gkemulticloud.NewAwsClustersClient(ctx) |
| 294 | if err != nil { |
| 295 | // TODO: Handle error. |
| 296 | } |
| 297 | defer c.Close() |
| 298 | |
| 299 | req := &gkemulticloudpb.GetAwsOpenIdConfigRequest{ |
| 300 | // TODO: Fill request struct fields. |
| 301 | // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#GetAwsOpenIdConfigRequest. |
| 302 | } |
| 303 | resp, err := c.GetAwsOpenIdConfig(ctx, req) |
| 304 | if err != nil { |
| 305 | // TODO: Handle error. |
| 306 | } |
| 307 | // TODO: Use resp. |
| 308 | _ = resp |
| 309 | } |
| 310 | |
| 311 | func ExampleAwsClustersClient_GetAwsServerConfig() { |
| 312 | ctx := context.Background() |
| 313 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 314 | // It will require modifications to work: |
| 315 | // - It may require correct/in-range values for request initialization. |
| 316 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 317 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 318 | c, err := gkemulticloud.NewAwsClustersClient(ctx) |
| 319 | if err != nil { |
| 320 | // TODO: Handle error. |
| 321 | } |
| 322 | defer c.Close() |
| 323 | |
| 324 | req := &gkemulticloudpb.GetAwsServerConfigRequest{ |
| 325 | // TODO: Fill request struct fields. |
| 326 | // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#GetAwsServerConfigRequest. |
| 327 | } |
| 328 | resp, err := c.GetAwsServerConfig(ctx, req) |
| 329 | if err != nil { |
| 330 | // TODO: Handle error. |
| 331 | } |
| 332 | // TODO: Use resp. |
| 333 | _ = resp |
| 334 | } |
| 335 | |
| 336 | func ExampleAwsClustersClient_ListAwsClusters() { |
| 337 | ctx := context.Background() |
| 338 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 339 | // It will require modifications to work: |
| 340 | // - It may require correct/in-range values for request initialization. |
| 341 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 342 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 343 | c, err := gkemulticloud.NewAwsClustersClient(ctx) |
| 344 | if err != nil { |
| 345 | // TODO: Handle error. |
| 346 | } |
| 347 | defer c.Close() |
| 348 | |
| 349 | req := &gkemulticloudpb.ListAwsClustersRequest{ |
| 350 | // TODO: Fill request struct fields. |
| 351 | // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#ListAwsClustersRequest. |
| 352 | } |
| 353 | it := c.ListAwsClusters(ctx, req) |
| 354 | for { |
| 355 | resp, err := it.Next() |
| 356 | if err == iterator.Done { |
| 357 | break |
| 358 | } |
| 359 | if err != nil { |
| 360 | // TODO: Handle error. |
| 361 | } |
| 362 | // TODO: Use resp. |
| 363 | _ = resp |
| 364 | |
| 365 | // If you need to access the underlying RPC response, |
| 366 | // you can do so by casting the `Response` as below. |
| 367 | // Otherwise, remove this line. Only populated after |
| 368 | // first call to Next(). Not safe for concurrent access. |
| 369 | _ = it.Response.(*gkemulticloudpb.ListAwsClustersResponse) |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | func ExampleAwsClustersClient_ListAwsNodePools() { |
| 374 | ctx := context.Background() |
| 375 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 376 | // It will require modifications to work: |
| 377 | // - It may require correct/in-range values for request initialization. |
| 378 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 379 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 380 | c, err := gkemulticloud.NewAwsClustersClient(ctx) |
| 381 | if err != nil { |
| 382 | // TODO: Handle error. |
| 383 | } |
| 384 | defer c.Close() |
| 385 | |
| 386 | req := &gkemulticloudpb.ListAwsNodePoolsRequest{ |
| 387 | // TODO: Fill request struct fields. |
| 388 | // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#ListAwsNodePoolsRequest. |
| 389 | } |
| 390 | it := c.ListAwsNodePools(ctx, req) |
| 391 | for { |
| 392 | resp, err := it.Next() |
| 393 | if err == iterator.Done { |
| 394 | break |
| 395 | } |
| 396 | if err != nil { |
| 397 | // TODO: Handle error. |
| 398 | } |
| 399 | // TODO: Use resp. |
| 400 | _ = resp |
| 401 | |
| 402 | // If you need to access the underlying RPC response, |
| 403 | // you can do so by casting the `Response` as below. |
| 404 | // Otherwise, remove this line. Only populated after |
| 405 | // first call to Next(). Not safe for concurrent access. |
| 406 | _ = it.Response.(*gkemulticloudpb.ListAwsNodePoolsResponse) |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | func ExampleAwsClustersClient_RollbackAwsNodePoolUpdate() { |
| 411 | ctx := context.Background() |
| 412 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 413 | // It will require modifications to work: |
| 414 | // - It may require correct/in-range values for request initialization. |
| 415 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 416 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 417 | c, err := gkemulticloud.NewAwsClustersClient(ctx) |
| 418 | if err != nil { |
| 419 | // TODO: Handle error. |
| 420 | } |
| 421 | defer c.Close() |
| 422 | |
| 423 | req := &gkemulticloudpb.RollbackAwsNodePoolUpdateRequest{ |
| 424 | // TODO: Fill request struct fields. |
| 425 | // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#RollbackAwsNodePoolUpdateRequest. |
| 426 | } |
| 427 | op, err := c.RollbackAwsNodePoolUpdate(ctx, req) |
| 428 | if err != nil { |
| 429 | // TODO: Handle error. |
| 430 | } |
| 431 | |
| 432 | resp, err := op.Wait(ctx) |
| 433 | if err != nil { |
| 434 | // TODO: Handle error. |
| 435 | } |
| 436 | // TODO: Use resp. |
| 437 | _ = resp |
| 438 | } |
| 439 | |
| 440 | func ExampleAwsClustersClient_UpdateAwsCluster() { |
| 441 | ctx := context.Background() |
| 442 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 443 | // It will require modifications to work: |
| 444 | // - It may require correct/in-range values for request initialization. |
| 445 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 446 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 447 | c, err := gkemulticloud.NewAwsClustersClient(ctx) |
| 448 | if err != nil { |
| 449 | // TODO: Handle error. |
| 450 | } |
| 451 | defer c.Close() |
| 452 | |
| 453 | req := &gkemulticloudpb.UpdateAwsClusterRequest{ |
| 454 | // TODO: Fill request struct fields. |
| 455 | // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#UpdateAwsClusterRequest. |
| 456 | } |
| 457 | op, err := c.UpdateAwsCluster(ctx, req) |
| 458 | if err != nil { |
| 459 | // TODO: Handle error. |
| 460 | } |
| 461 | |
| 462 | resp, err := op.Wait(ctx) |
| 463 | if err != nil { |
| 464 | // TODO: Handle error. |
| 465 | } |
| 466 | // TODO: Use resp. |
| 467 | _ = resp |
| 468 | } |
| 469 | |
| 470 | func ExampleAwsClustersClient_UpdateAwsNodePool() { |
| 471 | ctx := context.Background() |
| 472 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 473 | // It will require modifications to work: |
| 474 | // - It may require correct/in-range values for request initialization. |
| 475 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 476 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 477 | c, err := gkemulticloud.NewAwsClustersClient(ctx) |
| 478 | if err != nil { |
| 479 | // TODO: Handle error. |
| 480 | } |
| 481 | defer c.Close() |
| 482 | |
| 483 | req := &gkemulticloudpb.UpdateAwsNodePoolRequest{ |
| 484 | // TODO: Fill request struct fields. |
| 485 | // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#UpdateAwsNodePoolRequest. |
| 486 | } |
| 487 | op, err := c.UpdateAwsNodePool(ctx, req) |
| 488 | if err != nil { |
| 489 | // TODO: Handle error. |
| 490 | } |
| 491 | |
| 492 | resp, err := op.Wait(ctx) |
| 493 | if err != nil { |
| 494 | // TODO: Handle error. |
| 495 | } |
| 496 | // TODO: Use resp. |
| 497 | _ = resp |
| 498 | } |
| 499 | |
| 500 | func ExampleAwsClustersClient_CancelOperation() { |
| 501 | ctx := context.Background() |
| 502 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 503 | // It will require modifications to work: |
| 504 | // - It may require correct/in-range values for request initialization. |
| 505 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 506 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 507 | c, err := gkemulticloud.NewAwsClustersClient(ctx) |
| 508 | if err != nil { |
| 509 | // TODO: Handle error. |
| 510 | } |
| 511 | defer c.Close() |
| 512 | |
| 513 | req := &longrunningpb.CancelOperationRequest{ |
| 514 | // TODO: Fill request struct fields. |
| 515 | // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. |
| 516 | } |
| 517 | err = c.CancelOperation(ctx, req) |
| 518 | if err != nil { |
| 519 | // TODO: Handle error. |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | func ExampleAwsClustersClient_DeleteOperation() { |
| 524 | ctx := context.Background() |
| 525 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 526 | // It will require modifications to work: |
| 527 | // - It may require correct/in-range values for request initialization. |
| 528 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 529 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 530 | c, err := gkemulticloud.NewAwsClustersClient(ctx) |
| 531 | if err != nil { |
| 532 | // TODO: Handle error. |
| 533 | } |
| 534 | defer c.Close() |
| 535 | |
| 536 | req := &longrunningpb.DeleteOperationRequest{ |
| 537 | // TODO: Fill request struct fields. |
| 538 | // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest. |
| 539 | } |
| 540 | err = c.DeleteOperation(ctx, req) |
| 541 | if err != nil { |
| 542 | // TODO: Handle error. |
| 543 | } |
| 544 | } |
| 545 | |
| 546 | func ExampleAwsClustersClient_GetOperation() { |
| 547 | ctx := context.Background() |
| 548 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 549 | // It will require modifications to work: |
| 550 | // - It may require correct/in-range values for request initialization. |
| 551 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 552 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 553 | c, err := gkemulticloud.NewAwsClustersClient(ctx) |
| 554 | if err != nil { |
| 555 | // TODO: Handle error. |
| 556 | } |
| 557 | defer c.Close() |
| 558 | |
| 559 | req := &longrunningpb.GetOperationRequest{ |
| 560 | // TODO: Fill request struct fields. |
| 561 | // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. |
| 562 | } |
| 563 | resp, err := c.GetOperation(ctx, req) |
| 564 | if err != nil { |
| 565 | // TODO: Handle error. |
| 566 | } |
| 567 | // TODO: Use resp. |
| 568 | _ = resp |
| 569 | } |
| 570 | |
| 571 | func ExampleAwsClustersClient_ListOperations() { |
| 572 | ctx := context.Background() |
| 573 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 574 | // It will require modifications to work: |
| 575 | // - It may require correct/in-range values for request initialization. |
| 576 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 577 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 578 | c, err := gkemulticloud.NewAwsClustersClient(ctx) |
| 579 | if err != nil { |
| 580 | // TODO: Handle error. |
| 581 | } |
| 582 | defer c.Close() |
| 583 | |
| 584 | req := &longrunningpb.ListOperationsRequest{ |
| 585 | // TODO: Fill request struct fields. |
| 586 | // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. |
| 587 | } |
| 588 | it := c.ListOperations(ctx, req) |
| 589 | for { |
| 590 | resp, err := it.Next() |
| 591 | if err == iterator.Done { |
| 592 | break |
| 593 | } |
| 594 | if err != nil { |
| 595 | // TODO: Handle error. |
| 596 | } |
| 597 | // TODO: Use resp. |
| 598 | _ = resp |
| 599 | |
| 600 | // If you need to access the underlying RPC response, |
| 601 | // you can do so by casting the `Response` as below. |
| 602 | // Otherwise, remove this line. Only populated after |
| 603 | // first call to Next(). Not safe for concurrent access. |
| 604 | _ = it.Response.(*longrunningpb.ListOperationsResponse) |
| 605 | } |
| 606 | } |