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