| 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 service_test |
| 18 |
|
| 19 |
import ( |
| 20 |
"context" |
| 21 |
|
| 22 |
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 23 |
service "cloud.google.com/go/orchestration/airflow/service/apiv1" |
| 24 |
servicepb "cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb" |
| 25 |
"google.golang.org/api/iterator" |
| 26 |
) |
| 27 |
|
| 28 |
func ExampleNewEnvironmentsClient() { |
| 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 := service.NewEnvironmentsClient(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 ExampleNewEnvironmentsRESTClient() { |
| 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 := service.NewEnvironmentsRESTClient(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 ExampleEnvironmentsClient_CheckUpgrade() { |
| 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 := service.NewEnvironmentsClient(ctx) |
| 70 |
if err != nil { |
| 71 |
// TODO: Handle error. |
| 72 |
} |
| 73 |
defer c.Close() |
| 74 |
|
| 75 |
req := &servicepb.CheckUpgradeRequest{ |
| 76 |
// TODO: Fill request struct fields. |
| 77 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#CheckUpgradeRequest. |
| 78 |
} |
| 79 |
op, err := c.CheckUpgrade(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 ExampleEnvironmentsClient_CreateEnvironment() { |
| 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 := service.NewEnvironmentsClient(ctx) |
| 100 |
if err != nil { |
| 101 |
// TODO: Handle error. |
| 102 |
} |
| 103 |
defer c.Close() |
| 104 |
|
| 105 |
req := &servicepb.CreateEnvironmentRequest{ |
| 106 |
// TODO: Fill request struct fields. |
| 107 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#CreateEnvironmentRequest. |
| 108 |
} |
| 109 |
op, err := c.CreateEnvironment(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 ExampleEnvironmentsClient_CreateUserWorkloadsConfigMap() { |
| 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 := service.NewEnvironmentsClient(ctx) |
| 130 |
if err != nil { |
| 131 |
// TODO: Handle error. |
| 132 |
} |
| 133 |
defer c.Close() |
| 134 |
|
| 135 |
req := &servicepb.CreateUserWorkloadsConfigMapRequest{ |
| 136 |
// TODO: Fill request struct fields. |
| 137 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#CreateUserWorkloadsConfigMapRequest. |
| 138 |
} |
| 139 |
resp, err := c.CreateUserWorkloadsConfigMap(ctx, req) |
| 140 |
if err != nil { |
| 141 |
// TODO: Handle error. |
| 142 |
} |
| 143 |
// TODO: Use resp. |
| 144 |
_ = resp |
| 145 |
} |
| 146 |
|
| 147 |
func ExampleEnvironmentsClient_CreateUserWorkloadsSecret() { |
| 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 := service.NewEnvironmentsClient(ctx) |
| 155 |
if err != nil { |
| 156 |
// TODO: Handle error. |
| 157 |
} |
| 158 |
defer c.Close() |
| 159 |
|
| 160 |
req := &servicepb.CreateUserWorkloadsSecretRequest{ |
| 161 |
// TODO: Fill request struct fields. |
| 162 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#CreateUserWorkloadsSecretRequest. |
| 163 |
} |
| 164 |
resp, err := c.CreateUserWorkloadsSecret(ctx, req) |
| 165 |
if err != nil { |
| 166 |
// TODO: Handle error. |
| 167 |
} |
| 168 |
// TODO: Use resp. |
| 169 |
_ = resp |
| 170 |
} |
| 171 |
|
| 172 |
func ExampleEnvironmentsClient_DatabaseFailover() { |
| 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 := service.NewEnvironmentsClient(ctx) |
| 180 |
if err != nil { |
| 181 |
// TODO: Handle error. |
| 182 |
} |
| 183 |
defer c.Close() |
| 184 |
|
| 185 |
req := &servicepb.DatabaseFailoverRequest{ |
| 186 |
// TODO: Fill request struct fields. |
| 187 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#DatabaseFailoverRequest. |
| 188 |
} |
| 189 |
op, err := c.DatabaseFailover(ctx, req) |
| 190 |
if err != nil { |
| 191 |
// TODO: Handle error. |
| 192 |
} |
| 193 |
|
| 194 |
resp, err := op.Wait(ctx) |
| 195 |
if err != nil { |
| 196 |
// TODO: Handle error. |
| 197 |
} |
| 198 |
// TODO: Use resp. |
| 199 |
_ = resp |
| 200 |
} |
| 201 |
|
| 202 |
func ExampleEnvironmentsClient_DeleteEnvironment() { |
| 203 |
ctx := context.Background() |
| 204 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 205 |
// It will require modifications to work: |
| 206 |
// - It may require correct/in-range values for request initialization. |
| 207 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 208 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 209 |
c, err := service.NewEnvironmentsClient(ctx) |
| 210 |
if err != nil { |
| 211 |
// TODO: Handle error. |
| 212 |
} |
| 213 |
defer c.Close() |
| 214 |
|
| 215 |
req := &servicepb.DeleteEnvironmentRequest{ |
| 216 |
// TODO: Fill request struct fields. |
| 217 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#DeleteEnvironmentRequest. |
| 218 |
} |
| 219 |
op, err := c.DeleteEnvironment(ctx, req) |
| 220 |
if err != nil { |
| 221 |
// TODO: Handle error. |
| 222 |
} |
| 223 |
|
| 224 |
err = op.Wait(ctx) |
| 225 |
if err != nil { |
| 226 |
// TODO: Handle error. |
| 227 |
} |
| 228 |
} |
| 229 |
|
| 230 |
func ExampleEnvironmentsClient_DeleteUserWorkloadsConfigMap() { |
| 231 |
ctx := context.Background() |
| 232 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 233 |
// It will require modifications to work: |
| 234 |
// - It may require correct/in-range values for request initialization. |
| 235 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 236 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 237 |
c, err := service.NewEnvironmentsClient(ctx) |
| 238 |
if err != nil { |
| 239 |
// TODO: Handle error. |
| 240 |
} |
| 241 |
defer c.Close() |
| 242 |
|
| 243 |
req := &servicepb.DeleteUserWorkloadsConfigMapRequest{ |
| 244 |
// TODO: Fill request struct fields. |
| 245 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#DeleteUserWorkloadsConfigMapRequest. |
| 246 |
} |
| 247 |
err = c.DeleteUserWorkloadsConfigMap(ctx, req) |
| 248 |
if err != nil { |
| 249 |
// TODO: Handle error. |
| 250 |
} |
| 251 |
} |
| 252 |
|
| 253 |
func ExampleEnvironmentsClient_DeleteUserWorkloadsSecret() { |
| 254 |
ctx := context.Background() |
| 255 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 256 |
// It will require modifications to work: |
| 257 |
// - It may require correct/in-range values for request initialization. |
| 258 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 259 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 260 |
c, err := service.NewEnvironmentsClient(ctx) |
| 261 |
if err != nil { |
| 262 |
// TODO: Handle error. |
| 263 |
} |
| 264 |
defer c.Close() |
| 265 |
|
| 266 |
req := &servicepb.DeleteUserWorkloadsSecretRequest{ |
| 267 |
// TODO: Fill request struct fields. |
| 268 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#DeleteUserWorkloadsSecretRequest. |
| 269 |
} |
| 270 |
err = c.DeleteUserWorkloadsSecret(ctx, req) |
| 271 |
if err != nil { |
| 272 |
// TODO: Handle error. |
| 273 |
} |
| 274 |
} |
| 275 |
|
| 276 |
func ExampleEnvironmentsClient_ExecuteAirflowCommand() { |
| 277 |
ctx := context.Background() |
| 278 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 279 |
// It will require modifications to work: |
| 280 |
// - It may require correct/in-range values for request initialization. |
| 281 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 282 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 283 |
c, err := service.NewEnvironmentsClient(ctx) |
| 284 |
if err != nil { |
| 285 |
// TODO: Handle error. |
| 286 |
} |
| 287 |
defer c.Close() |
| 288 |
|
| 289 |
req := &servicepb.ExecuteAirflowCommandRequest{ |
| 290 |
// TODO: Fill request struct fields. |
| 291 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#ExecuteAirflowCommandRequest. |
| 292 |
} |
| 293 |
resp, err := c.ExecuteAirflowCommand(ctx, req) |
| 294 |
if err != nil { |
| 295 |
// TODO: Handle error. |
| 296 |
} |
| 297 |
// TODO: Use resp. |
| 298 |
_ = resp |
| 299 |
} |
| 300 |
|
| 301 |
func ExampleEnvironmentsClient_FetchDatabaseProperties() { |
| 302 |
ctx := context.Background() |
| 303 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 304 |
// It will require modifications to work: |
| 305 |
// - It may require correct/in-range values for request initialization. |
| 306 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 307 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 308 |
c, err := service.NewEnvironmentsClient(ctx) |
| 309 |
if err != nil { |
| 310 |
// TODO: Handle error. |
| 311 |
} |
| 312 |
defer c.Close() |
| 313 |
|
| 314 |
req := &servicepb.FetchDatabasePropertiesRequest{ |
| 315 |
// TODO: Fill request struct fields. |
| 316 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#FetchDatabasePropertiesRequest. |
| 317 |
} |
| 318 |
resp, err := c.FetchDatabaseProperties(ctx, req) |
| 319 |
if err != nil { |
| 320 |
// TODO: Handle error. |
| 321 |
} |
| 322 |
// TODO: Use resp. |
| 323 |
_ = resp |
| 324 |
} |
| 325 |
|
| 326 |
func ExampleEnvironmentsClient_GetEnvironment() { |
| 327 |
ctx := context.Background() |
| 328 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 329 |
// It will require modifications to work: |
| 330 |
// - It may require correct/in-range values for request initialization. |
| 331 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 332 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 333 |
c, err := service.NewEnvironmentsClient(ctx) |
| 334 |
if err != nil { |
| 335 |
// TODO: Handle error. |
| 336 |
} |
| 337 |
defer c.Close() |
| 338 |
|
| 339 |
req := &servicepb.GetEnvironmentRequest{ |
| 340 |
// TODO: Fill request struct fields. |
| 341 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#GetEnvironmentRequest. |
| 342 |
} |
| 343 |
resp, err := c.GetEnvironment(ctx, req) |
| 344 |
if err != nil { |
| 345 |
// TODO: Handle error. |
| 346 |
} |
| 347 |
// TODO: Use resp. |
| 348 |
_ = resp |
| 349 |
} |
| 350 |
|
| 351 |
func ExampleEnvironmentsClient_GetUserWorkloadsConfigMap() { |
| 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 := service.NewEnvironmentsClient(ctx) |
| 359 |
if err != nil { |
| 360 |
// TODO: Handle error. |
| 361 |
} |
| 362 |
defer c.Close() |
| 363 |
|
| 364 |
req := &servicepb.GetUserWorkloadsConfigMapRequest{ |
| 365 |
// TODO: Fill request struct fields. |
| 366 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#GetUserWorkloadsConfigMapRequest. |
| 367 |
} |
| 368 |
resp, err := c.GetUserWorkloadsConfigMap(ctx, req) |
| 369 |
if err != nil { |
| 370 |
// TODO: Handle error. |
| 371 |
} |
| 372 |
// TODO: Use resp. |
| 373 |
_ = resp |
| 374 |
} |
| 375 |
|
| 376 |
func ExampleEnvironmentsClient_GetUserWorkloadsSecret() { |
| 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 := service.NewEnvironmentsClient(ctx) |
| 384 |
if err != nil { |
| 385 |
// TODO: Handle error. |
| 386 |
} |
| 387 |
defer c.Close() |
| 388 |
|
| 389 |
req := &servicepb.GetUserWorkloadsSecretRequest{ |
| 390 |
// TODO: Fill request struct fields. |
| 391 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#GetUserWorkloadsSecretRequest. |
| 392 |
} |
| 393 |
resp, err := c.GetUserWorkloadsSecret(ctx, req) |
| 394 |
if err != nil { |
| 395 |
// TODO: Handle error. |
| 396 |
} |
| 397 |
// TODO: Use resp. |
| 398 |
_ = resp |
| 399 |
} |
| 400 |
|
| 401 |
func ExampleEnvironmentsClient_ListEnvironments() { |
| 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 := service.NewEnvironmentsClient(ctx) |
| 409 |
if err != nil { |
| 410 |
// TODO: Handle error. |
| 411 |
} |
| 412 |
defer c.Close() |
| 413 |
|
| 414 |
req := &servicepb.ListEnvironmentsRequest{ |
| 415 |
// TODO: Fill request struct fields. |
| 416 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#ListEnvironmentsRequest. |
| 417 |
} |
| 418 |
it := c.ListEnvironments(ctx, req) |
| 419 |
for { |
| 420 |
resp, err := it.Next() |
| 421 |
if err == iterator.Done { |
| 422 |
break |
| 423 |
} |
| 424 |
if err != nil { |
| 425 |
// TODO: Handle error. |
| 426 |
} |
| 427 |
// TODO: Use resp. |
| 428 |
_ = resp |
| 429 |
|
| 430 |
// If you need to access the underlying RPC response, |
| 431 |
// you can do so by casting the `Response` as below. |
| 432 |
// Otherwise, remove this line. Only populated after |
| 433 |
// first call to Next(). Not safe for concurrent access. |
| 434 |
_ = it.Response.(*servicepb.ListEnvironmentsResponse) |
| 435 |
} |
| 436 |
} |
| 437 |
|
| 438 |
func ExampleEnvironmentsClient_ListUserWorkloadsConfigMaps() { |
| 439 |
ctx := context.Background() |
| 440 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 441 |
// It will require modifications to work: |
| 442 |
// - It may require correct/in-range values for request initialization. |
| 443 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 444 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 445 |
c, err := service.NewEnvironmentsClient(ctx) |
| 446 |
if err != nil { |
| 447 |
// TODO: Handle error. |
| 448 |
} |
| 449 |
defer c.Close() |
| 450 |
|
| 451 |
req := &servicepb.ListUserWorkloadsConfigMapsRequest{ |
| 452 |
// TODO: Fill request struct fields. |
| 453 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#ListUserWorkloadsConfigMapsRequest. |
| 454 |
} |
| 455 |
it := c.ListUserWorkloadsConfigMaps(ctx, req) |
| 456 |
for { |
| 457 |
resp, err := it.Next() |
| 458 |
if err == iterator.Done { |
| 459 |
break |
| 460 |
} |
| 461 |
if err != nil { |
| 462 |
// TODO: Handle error. |
| 463 |
} |
| 464 |
// TODO: Use resp. |
| 465 |
_ = resp |
| 466 |
|
| 467 |
// If you need to access the underlying RPC response, |
| 468 |
// you can do so by casting the `Response` as below. |
| 469 |
// Otherwise, remove this line. Only populated after |
| 470 |
// first call to Next(). Not safe for concurrent access. |
| 471 |
_ = it.Response.(*servicepb.ListUserWorkloadsConfigMapsResponse) |
| 472 |
} |
| 473 |
} |
| 474 |
|
| 475 |
func ExampleEnvironmentsClient_ListUserWorkloadsSecrets() { |
| 476 |
ctx := context.Background() |
| 477 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 478 |
// It will require modifications to work: |
| 479 |
// - It may require correct/in-range values for request initialization. |
| 480 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 481 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 482 |
c, err := service.NewEnvironmentsClient(ctx) |
| 483 |
if err != nil { |
| 484 |
// TODO: Handle error. |
| 485 |
} |
| 486 |
defer c.Close() |
| 487 |
|
| 488 |
req := &servicepb.ListUserWorkloadsSecretsRequest{ |
| 489 |
// TODO: Fill request struct fields. |
| 490 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#ListUserWorkloadsSecretsRequest. |
| 491 |
} |
| 492 |
it := c.ListUserWorkloadsSecrets(ctx, req) |
| 493 |
for { |
| 494 |
resp, err := it.Next() |
| 495 |
if err == iterator.Done { |
| 496 |
break |
| 497 |
} |
| 498 |
if err != nil { |
| 499 |
// TODO: Handle error. |
| 500 |
} |
| 501 |
// TODO: Use resp. |
| 502 |
_ = resp |
| 503 |
|
| 504 |
// If you need to access the underlying RPC response, |
| 505 |
// you can do so by casting the `Response` as below. |
| 506 |
// Otherwise, remove this line. Only populated after |
| 507 |
// first call to Next(). Not safe for concurrent access. |
| 508 |
_ = it.Response.(*servicepb.ListUserWorkloadsSecretsResponse) |
| 509 |
} |
| 510 |
} |
| 511 |
|
| 512 |
func ExampleEnvironmentsClient_ListWorkloads() { |
| 513 |
ctx := context.Background() |
| 514 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 515 |
// It will require modifications to work: |
| 516 |
// - It may require correct/in-range values for request initialization. |
| 517 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 518 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 519 |
c, err := service.NewEnvironmentsClient(ctx) |
| 520 |
if err != nil { |
| 521 |
// TODO: Handle error. |
| 522 |
} |
| 523 |
defer c.Close() |
| 524 |
|
| 525 |
req := &servicepb.ListWorkloadsRequest{ |
| 526 |
// TODO: Fill request struct fields. |
| 527 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#ListWorkloadsRequest. |
| 528 |
} |
| 529 |
it := c.ListWorkloads(ctx, req) |
| 530 |
for { |
| 531 |
resp, err := it.Next() |
| 532 |
if err == iterator.Done { |
| 533 |
break |
| 534 |
} |
| 535 |
if err != nil { |
| 536 |
// TODO: Handle error. |
| 537 |
} |
| 538 |
// TODO: Use resp. |
| 539 |
_ = resp |
| 540 |
|
| 541 |
// If you need to access the underlying RPC response, |
| 542 |
// you can do so by casting the `Response` as below. |
| 543 |
// Otherwise, remove this line. Only populated after |
| 544 |
// first call to Next(). Not safe for concurrent access. |
| 545 |
_ = it.Response.(*servicepb.ListWorkloadsResponse) |
| 546 |
} |
| 547 |
} |
| 548 |
|
| 549 |
func ExampleEnvironmentsClient_LoadSnapshot() { |
| 550 |
ctx := context.Background() |
| 551 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 552 |
// It will require modifications to work: |
| 553 |
// - It may require correct/in-range values for request initialization. |
| 554 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 555 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 556 |
c, err := service.NewEnvironmentsClient(ctx) |
| 557 |
if err != nil { |
| 558 |
// TODO: Handle error. |
| 559 |
} |
| 560 |
defer c.Close() |
| 561 |
|
| 562 |
req := &servicepb.LoadSnapshotRequest{ |
| 563 |
// TODO: Fill request struct fields. |
| 564 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#LoadSnapshotRequest. |
| 565 |
} |
| 566 |
op, err := c.LoadSnapshot(ctx, req) |
| 567 |
if err != nil { |
| 568 |
// TODO: Handle error. |
| 569 |
} |
| 570 |
|
| 571 |
resp, err := op.Wait(ctx) |
| 572 |
if err != nil { |
| 573 |
// TODO: Handle error. |
| 574 |
} |
| 575 |
// TODO: Use resp. |
| 576 |
_ = resp |
| 577 |
} |
| 578 |
|
| 579 |
func ExampleEnvironmentsClient_PollAirflowCommand() { |
| 580 |
ctx := context.Background() |
| 581 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 582 |
// It will require modifications to work: |
| 583 |
// - It may require correct/in-range values for request initialization. |
| 584 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 585 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 586 |
c, err := service.NewEnvironmentsClient(ctx) |
| 587 |
if err != nil { |
| 588 |
// TODO: Handle error. |
| 589 |
} |
| 590 |
defer c.Close() |
| 591 |
|
| 592 |
req := &servicepb.PollAirflowCommandRequest{ |
| 593 |
// TODO: Fill request struct fields. |
| 594 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#PollAirflowCommandRequest. |
| 595 |
} |
| 596 |
resp, err := c.PollAirflowCommand(ctx, req) |
| 597 |
if err != nil { |
| 598 |
// TODO: Handle error. |
| 599 |
} |
| 600 |
// TODO: Use resp. |
| 601 |
_ = resp |
| 602 |
} |
| 603 |
|
| 604 |
func ExampleEnvironmentsClient_SaveSnapshot() { |
| 605 |
ctx := context.Background() |
| 606 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 607 |
// It will require modifications to work: |
| 608 |
// - It may require correct/in-range values for request initialization. |
| 609 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 610 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 611 |
c, err := service.NewEnvironmentsClient(ctx) |
| 612 |
if err != nil { |
| 613 |
// TODO: Handle error. |
| 614 |
} |
| 615 |
defer c.Close() |
| 616 |
|
| 617 |
req := &servicepb.SaveSnapshotRequest{ |
| 618 |
// TODO: Fill request struct fields. |
| 619 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#SaveSnapshotRequest. |
| 620 |
} |
| 621 |
op, err := c.SaveSnapshot(ctx, req) |
| 622 |
if err != nil { |
| 623 |
// TODO: Handle error. |
| 624 |
} |
| 625 |
|
| 626 |
resp, err := op.Wait(ctx) |
| 627 |
if err != nil { |
| 628 |
// TODO: Handle error. |
| 629 |
} |
| 630 |
// TODO: Use resp. |
| 631 |
_ = resp |
| 632 |
} |
| 633 |
|
| 634 |
func ExampleEnvironmentsClient_StopAirflowCommand() { |
| 635 |
ctx := context.Background() |
| 636 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 637 |
// It will require modifications to work: |
| 638 |
// - It may require correct/in-range values for request initialization. |
| 639 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 640 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 641 |
c, err := service.NewEnvironmentsClient(ctx) |
| 642 |
if err != nil { |
| 643 |
// TODO: Handle error. |
| 644 |
} |
| 645 |
defer c.Close() |
| 646 |
|
| 647 |
req := &servicepb.StopAirflowCommandRequest{ |
| 648 |
// TODO: Fill request struct fields. |
| 649 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#StopAirflowCommandRequest. |
| 650 |
} |
| 651 |
resp, err := c.StopAirflowCommand(ctx, req) |
| 652 |
if err != nil { |
| 653 |
// TODO: Handle error. |
| 654 |
} |
| 655 |
// TODO: Use resp. |
| 656 |
_ = resp |
| 657 |
} |
| 658 |
|
| 659 |
func ExampleEnvironmentsClient_UpdateEnvironment() { |
| 660 |
ctx := context.Background() |
| 661 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 662 |
// It will require modifications to work: |
| 663 |
// - It may require correct/in-range values for request initialization. |
| 664 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 665 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 666 |
c, err := service.NewEnvironmentsClient(ctx) |
| 667 |
if err != nil { |
| 668 |
// TODO: Handle error. |
| 669 |
} |
| 670 |
defer c.Close() |
| 671 |
|
| 672 |
req := &servicepb.UpdateEnvironmentRequest{ |
| 673 |
// TODO: Fill request struct fields. |
| 674 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#UpdateEnvironmentRequest. |
| 675 |
} |
| 676 |
op, err := c.UpdateEnvironment(ctx, req) |
| 677 |
if err != nil { |
| 678 |
// TODO: Handle error. |
| 679 |
} |
| 680 |
|
| 681 |
resp, err := op.Wait(ctx) |
| 682 |
if err != nil { |
| 683 |
// TODO: Handle error. |
| 684 |
} |
| 685 |
// TODO: Use resp. |
| 686 |
_ = resp |
| 687 |
} |
| 688 |
|
| 689 |
func ExampleEnvironmentsClient_UpdateUserWorkloadsConfigMap() { |
| 690 |
ctx := context.Background() |
| 691 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 692 |
// It will require modifications to work: |
| 693 |
// - It may require correct/in-range values for request initialization. |
| 694 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 695 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 696 |
c, err := service.NewEnvironmentsClient(ctx) |
| 697 |
if err != nil { |
| 698 |
// TODO: Handle error. |
| 699 |
} |
| 700 |
defer c.Close() |
| 701 |
|
| 702 |
req := &servicepb.UpdateUserWorkloadsConfigMapRequest{ |
| 703 |
// TODO: Fill request struct fields. |
| 704 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#UpdateUserWorkloadsConfigMapRequest. |
| 705 |
} |
| 706 |
resp, err := c.UpdateUserWorkloadsConfigMap(ctx, req) |
| 707 |
if err != nil { |
| 708 |
// TODO: Handle error. |
| 709 |
} |
| 710 |
// TODO: Use resp. |
| 711 |
_ = resp |
| 712 |
} |
| 713 |
|
| 714 |
func ExampleEnvironmentsClient_UpdateUserWorkloadsSecret() { |
| 715 |
ctx := context.Background() |
| 716 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 717 |
// It will require modifications to work: |
| 718 |
// - It may require correct/in-range values for request initialization. |
| 719 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 720 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 721 |
c, err := service.NewEnvironmentsClient(ctx) |
| 722 |
if err != nil { |
| 723 |
// TODO: Handle error. |
| 724 |
} |
| 725 |
defer c.Close() |
| 726 |
|
| 727 |
req := &servicepb.UpdateUserWorkloadsSecretRequest{ |
| 728 |
// TODO: Fill request struct fields. |
| 729 |
// See https://pkg.go.dev/cloud.google.com/go/orchestration/airflow/service/apiv1/servicepb#UpdateUserWorkloadsSecretRequest. |
| 730 |
} |
| 731 |
resp, err := c.UpdateUserWorkloadsSecret(ctx, req) |
| 732 |
if err != nil { |
| 733 |
// TODO: Handle error. |
| 734 |
} |
| 735 |
// TODO: Use resp. |
| 736 |
_ = resp |
| 737 |
} |
| 738 |
|
| 739 |
func ExampleEnvironmentsClient_DeleteOperation() { |
| 740 |
ctx := context.Background() |
| 741 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 742 |
// It will require modifications to work: |
| 743 |
// - It may require correct/in-range values for request initialization. |
| 744 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 745 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 746 |
c, err := service.NewEnvironmentsClient(ctx) |
| 747 |
if err != nil { |
| 748 |
// TODO: Handle error. |
| 749 |
} |
| 750 |
defer c.Close() |
| 751 |
|
| 752 |
req := &longrunningpb.DeleteOperationRequest{ |
| 753 |
// TODO: Fill request struct fields. |
| 754 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest. |
| 755 |
} |
| 756 |
err = c.DeleteOperation(ctx, req) |
| 757 |
if err != nil { |
| 758 |
// TODO: Handle error. |
| 759 |
} |
| 760 |
} |
| 761 |
|
| 762 |
func ExampleEnvironmentsClient_GetOperation() { |
| 763 |
ctx := context.Background() |
| 764 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 765 |
// It will require modifications to work: |
| 766 |
// - It may require correct/in-range values for request initialization. |
| 767 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 768 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 769 |
c, err := service.NewEnvironmentsClient(ctx) |
| 770 |
if err != nil { |
| 771 |
// TODO: Handle error. |
| 772 |
} |
| 773 |
defer c.Close() |
| 774 |
|
| 775 |
req := &longrunningpb.GetOperationRequest{ |
| 776 |
// TODO: Fill request struct fields. |
| 777 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. |
| 778 |
} |
| 779 |
resp, err := c.GetOperation(ctx, req) |
| 780 |
if err != nil { |
| 781 |
// TODO: Handle error. |
| 782 |
} |
| 783 |
// TODO: Use resp. |
| 784 |
_ = resp |
| 785 |
} |
| 786 |
|
| 787 |
func ExampleEnvironmentsClient_ListOperations() { |
| 788 |
ctx := context.Background() |
| 789 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 790 |
// It will require modifications to work: |
| 791 |
// - It may require correct/in-range values for request initialization. |
| 792 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 793 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 794 |
c, err := service.NewEnvironmentsClient(ctx) |
| 795 |
if err != nil { |
| 796 |
// TODO: Handle error. |
| 797 |
} |
| 798 |
defer c.Close() |
| 799 |
|
| 800 |
req := &longrunningpb.ListOperationsRequest{ |
| 801 |
// TODO: Fill request struct fields. |
| 802 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. |
| 803 |
} |
| 804 |
it := c.ListOperations(ctx, req) |
| 805 |
for { |
| 806 |
resp, err := it.Next() |
| 807 |
if err == iterator.Done { |
| 808 |
break |
| 809 |
} |
| 810 |
if err != nil { |
| 811 |
// TODO: Handle error. |
| 812 |
} |
| 813 |
// TODO: Use resp. |
| 814 |
_ = resp |
| 815 |
|
| 816 |
// If you need to access the underlying RPC response, |
| 817 |
// you can do so by casting the `Response` as below. |
| 818 |
// Otherwise, remove this line. Only populated after |
| 819 |
// first call to Next(). Not safe for concurrent access. |
| 820 |
_ = it.Response.(*longrunningpb.ListOperationsResponse) |
| 821 |
} |
| 822 |
} |