| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package telcoautomation |
| 18 |
|
| 19 |
import ( |
| 20 |
"context" |
| 21 |
"time" |
| 22 |
|
| 23 |
"cloud.google.com/go/longrunning" |
| 24 |
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 25 |
telcoautomationpb "cloud.google.com/go/telcoautomation/apiv1/telcoautomationpb" |
| 26 |
gax "github.com/googleapis/gax-go/v2" |
| 27 |
"google.golang.org/api/iterator" |
| 28 |
locationpb "google.golang.org/genproto/googleapis/cloud/location" |
| 29 |
) |
| 30 |
|
| 31 |
|
| 32 |
type CreateEdgeSlmOperation struct { |
| 33 |
lro *longrunning.Operation |
| 34 |
pollPath string |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
func (op *CreateEdgeSlmOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*telcoautomationpb.EdgeSlm, error) { |
| 41 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 42 |
var resp telcoautomationpb.EdgeSlm |
| 43 |
if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { |
| 44 |
return nil, err |
| 45 |
} |
| 46 |
return &resp, nil |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
func (op *CreateEdgeSlmOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*telcoautomationpb.EdgeSlm, error) { |
| 59 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 60 |
var resp telcoautomationpb.EdgeSlm |
| 61 |
if err := op.lro.Poll(ctx, &resp, opts...); err != nil { |
| 62 |
return nil, err |
| 63 |
} |
| 64 |
if !op.Done() { |
| 65 |
return nil, nil |
| 66 |
} |
| 67 |
return &resp, nil |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
func (op *CreateEdgeSlmOperation) Metadata() (*telcoautomationpb.OperationMetadata, error) { |
| 75 |
var meta telcoautomationpb.OperationMetadata |
| 76 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 77 |
return nil, nil |
| 78 |
} else if err != nil { |
| 79 |
return nil, err |
| 80 |
} |
| 81 |
return &meta, nil |
| 82 |
} |
| 83 |
|
| 84 |
|
| 85 |
func (op *CreateEdgeSlmOperation) Done() bool { |
| 86 |
return op.lro.Done() |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
func (op *CreateEdgeSlmOperation) Name() string { |
| 92 |
return op.lro.Name() |
| 93 |
} |
| 94 |
|
| 95 |
|
| 96 |
type CreateOrchestrationClusterOperation struct { |
| 97 |
lro *longrunning.Operation |
| 98 |
pollPath string |
| 99 |
} |
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
func (op *CreateOrchestrationClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*telcoautomationpb.OrchestrationCluster, error) { |
| 105 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 106 |
var resp telcoautomationpb.OrchestrationCluster |
| 107 |
if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { |
| 108 |
return nil, err |
| 109 |
} |
| 110 |
return &resp, nil |
| 111 |
} |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
func (op *CreateOrchestrationClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*telcoautomationpb.OrchestrationCluster, error) { |
| 123 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 124 |
var resp telcoautomationpb.OrchestrationCluster |
| 125 |
if err := op.lro.Poll(ctx, &resp, opts...); err != nil { |
| 126 |
return nil, err |
| 127 |
} |
| 128 |
if !op.Done() { |
| 129 |
return nil, nil |
| 130 |
} |
| 131 |
return &resp, nil |
| 132 |
} |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
func (op *CreateOrchestrationClusterOperation) Metadata() (*telcoautomationpb.OperationMetadata, error) { |
| 139 |
var meta telcoautomationpb.OperationMetadata |
| 140 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 141 |
return nil, nil |
| 142 |
} else if err != nil { |
| 143 |
return nil, err |
| 144 |
} |
| 145 |
return &meta, nil |
| 146 |
} |
| 147 |
|
| 148 |
|
| 149 |
func (op *CreateOrchestrationClusterOperation) Done() bool { |
| 150 |
return op.lro.Done() |
| 151 |
} |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
func (op *CreateOrchestrationClusterOperation) Name() string { |
| 156 |
return op.lro.Name() |
| 157 |
} |
| 158 |
|
| 159 |
|
| 160 |
type DeleteEdgeSlmOperation struct { |
| 161 |
lro *longrunning.Operation |
| 162 |
pollPath string |
| 163 |
} |
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
func (op *DeleteEdgeSlmOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { |
| 169 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 170 |
return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) |
| 171 |
} |
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
func (op *DeleteEdgeSlmOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { |
| 183 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 184 |
return op.lro.Poll(ctx, nil, opts...) |
| 185 |
} |
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
func (op *DeleteEdgeSlmOperation) Metadata() (*telcoautomationpb.OperationMetadata, error) { |
| 192 |
var meta telcoautomationpb.OperationMetadata |
| 193 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 194 |
return nil, nil |
| 195 |
} else if err != nil { |
| 196 |
return nil, err |
| 197 |
} |
| 198 |
return &meta, nil |
| 199 |
} |
| 200 |
|
| 201 |
|
| 202 |
func (op *DeleteEdgeSlmOperation) Done() bool { |
| 203 |
return op.lro.Done() |
| 204 |
} |
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
func (op *DeleteEdgeSlmOperation) Name() string { |
| 209 |
return op.lro.Name() |
| 210 |
} |
| 211 |
|
| 212 |
|
| 213 |
type DeleteOrchestrationClusterOperation struct { |
| 214 |
lro *longrunning.Operation |
| 215 |
pollPath string |
| 216 |
} |
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
func (op *DeleteOrchestrationClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { |
| 222 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 223 |
return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) |
| 224 |
} |
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
func (op *DeleteOrchestrationClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { |
| 236 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 237 |
return op.lro.Poll(ctx, nil, opts...) |
| 238 |
} |
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
func (op *DeleteOrchestrationClusterOperation) Metadata() (*telcoautomationpb.OperationMetadata, error) { |
| 245 |
var meta telcoautomationpb.OperationMetadata |
| 246 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 247 |
return nil, nil |
| 248 |
} else if err != nil { |
| 249 |
return nil, err |
| 250 |
} |
| 251 |
return &meta, nil |
| 252 |
} |
| 253 |
|
| 254 |
|
| 255 |
func (op *DeleteOrchestrationClusterOperation) Done() bool { |
| 256 |
return op.lro.Done() |
| 257 |
} |
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
func (op *DeleteOrchestrationClusterOperation) Name() string { |
| 262 |
return op.lro.Name() |
| 263 |
} |
| 264 |
|
| 265 |
|
| 266 |
type BlueprintIterator struct { |
| 267 |
items []*telcoautomationpb.Blueprint |
| 268 |
pageInfo *iterator.PageInfo |
| 269 |
nextFunc func() error |
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
Response interface{} |
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
InternalFetch func(pageSize int, pageToken string) (results []*telcoautomationpb.Blueprint, nextPageToken string, err error) |
| 283 |
} |
| 284 |
|
| 285 |
|
| 286 |
func (it *BlueprintIterator) PageInfo() *iterator.PageInfo { |
| 287 |
return it.pageInfo |
| 288 |
} |
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
func (it *BlueprintIterator) Next() (*telcoautomationpb.Blueprint, error) { |
| 293 |
var item *telcoautomationpb.Blueprint |
| 294 |
if err := it.nextFunc(); err != nil { |
| 295 |
return item, err |
| 296 |
} |
| 297 |
item = it.items[0] |
| 298 |
it.items = it.items[1:] |
| 299 |
return item, nil |
| 300 |
} |
| 301 |
|
| 302 |
func (it *BlueprintIterator) bufLen() int { |
| 303 |
return len(it.items) |
| 304 |
} |
| 305 |
|
| 306 |
func (it *BlueprintIterator) takeBuf() interface{} { |
| 307 |
b := it.items |
| 308 |
it.items = nil |
| 309 |
return b |
| 310 |
} |
| 311 |
|
| 312 |
|
| 313 |
type DeploymentIterator struct { |
| 314 |
items []*telcoautomationpb.Deployment |
| 315 |
pageInfo *iterator.PageInfo |
| 316 |
nextFunc func() error |
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
Response interface{} |
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
InternalFetch func(pageSize int, pageToken string) (results []*telcoautomationpb.Deployment, nextPageToken string, err error) |
| 330 |
} |
| 331 |
|
| 332 |
|
| 333 |
func (it *DeploymentIterator) PageInfo() *iterator.PageInfo { |
| 334 |
return it.pageInfo |
| 335 |
} |
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
func (it *DeploymentIterator) Next() (*telcoautomationpb.Deployment, error) { |
| 340 |
var item *telcoautomationpb.Deployment |
| 341 |
if err := it.nextFunc(); err != nil { |
| 342 |
return item, err |
| 343 |
} |
| 344 |
item = it.items[0] |
| 345 |
it.items = it.items[1:] |
| 346 |
return item, nil |
| 347 |
} |
| 348 |
|
| 349 |
func (it *DeploymentIterator) bufLen() int { |
| 350 |
return len(it.items) |
| 351 |
} |
| 352 |
|
| 353 |
func (it *DeploymentIterator) takeBuf() interface{} { |
| 354 |
b := it.items |
| 355 |
it.items = nil |
| 356 |
return b |
| 357 |
} |
| 358 |
|
| 359 |
|
| 360 |
type EdgeSlmIterator struct { |
| 361 |
items []*telcoautomationpb.EdgeSlm |
| 362 |
pageInfo *iterator.PageInfo |
| 363 |
nextFunc func() error |
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
Response interface{} |
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
InternalFetch func(pageSize int, pageToken string) (results []*telcoautomationpb.EdgeSlm, nextPageToken string, err error) |
| 377 |
} |
| 378 |
|
| 379 |
|
| 380 |
func (it *EdgeSlmIterator) PageInfo() *iterator.PageInfo { |
| 381 |
return it.pageInfo |
| 382 |
} |
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
func (it *EdgeSlmIterator) Next() (*telcoautomationpb.EdgeSlm, error) { |
| 387 |
var item *telcoautomationpb.EdgeSlm |
| 388 |
if err := it.nextFunc(); err != nil { |
| 389 |
return item, err |
| 390 |
} |
| 391 |
item = it.items[0] |
| 392 |
it.items = it.items[1:] |
| 393 |
return item, nil |
| 394 |
} |
| 395 |
|
| 396 |
func (it *EdgeSlmIterator) bufLen() int { |
| 397 |
return len(it.items) |
| 398 |
} |
| 399 |
|
| 400 |
func (it *EdgeSlmIterator) takeBuf() interface{} { |
| 401 |
b := it.items |
| 402 |
it.items = nil |
| 403 |
return b |
| 404 |
} |
| 405 |
|
| 406 |
|
| 407 |
type HydratedDeploymentIterator struct { |
| 408 |
items []*telcoautomationpb.HydratedDeployment |
| 409 |
pageInfo *iterator.PageInfo |
| 410 |
nextFunc func() error |
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
Response interface{} |
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
InternalFetch func(pageSize int, pageToken string) (results []*telcoautomationpb.HydratedDeployment, nextPageToken string, err error) |
| 424 |
} |
| 425 |
|
| 426 |
|
| 427 |
func (it *HydratedDeploymentIterator) PageInfo() *iterator.PageInfo { |
| 428 |
return it.pageInfo |
| 429 |
} |
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
func (it *HydratedDeploymentIterator) Next() (*telcoautomationpb.HydratedDeployment, error) { |
| 434 |
var item *telcoautomationpb.HydratedDeployment |
| 435 |
if err := it.nextFunc(); err != nil { |
| 436 |
return item, err |
| 437 |
} |
| 438 |
item = it.items[0] |
| 439 |
it.items = it.items[1:] |
| 440 |
return item, nil |
| 441 |
} |
| 442 |
|
| 443 |
func (it *HydratedDeploymentIterator) bufLen() int { |
| 444 |
return len(it.items) |
| 445 |
} |
| 446 |
|
| 447 |
func (it *HydratedDeploymentIterator) takeBuf() interface{} { |
| 448 |
b := it.items |
| 449 |
it.items = nil |
| 450 |
return b |
| 451 |
} |
| 452 |
|
| 453 |
|
| 454 |
type LocationIterator struct { |
| 455 |
items []*locationpb.Location |
| 456 |
pageInfo *iterator.PageInfo |
| 457 |
nextFunc func() error |
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
Response interface{} |
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error) |
| 471 |
} |
| 472 |
|
| 473 |
|
| 474 |
func (it *LocationIterator) PageInfo() *iterator.PageInfo { |
| 475 |
return it.pageInfo |
| 476 |
} |
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
func (it *LocationIterator) Next() (*locationpb.Location, error) { |
| 481 |
var item *locationpb.Location |
| 482 |
if err := it.nextFunc(); err != nil { |
| 483 |
return item, err |
| 484 |
} |
| 485 |
item = it.items[0] |
| 486 |
it.items = it.items[1:] |
| 487 |
return item, nil |
| 488 |
} |
| 489 |
|
| 490 |
func (it *LocationIterator) bufLen() int { |
| 491 |
return len(it.items) |
| 492 |
} |
| 493 |
|
| 494 |
func (it *LocationIterator) takeBuf() interface{} { |
| 495 |
b := it.items |
| 496 |
it.items = nil |
| 497 |
return b |
| 498 |
} |
| 499 |
|
| 500 |
|
| 501 |
type OperationIterator struct { |
| 502 |
items []*longrunningpb.Operation |
| 503 |
pageInfo *iterator.PageInfo |
| 504 |
nextFunc func() error |
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
Response interface{} |
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error) |
| 518 |
} |
| 519 |
|
| 520 |
|
| 521 |
func (it *OperationIterator) PageInfo() *iterator.PageInfo { |
| 522 |
return it.pageInfo |
| 523 |
} |
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
func (it *OperationIterator) Next() (*longrunningpb.Operation, error) { |
| 528 |
var item *longrunningpb.Operation |
| 529 |
if err := it.nextFunc(); err != nil { |
| 530 |
return item, err |
| 531 |
} |
| 532 |
item = it.items[0] |
| 533 |
it.items = it.items[1:] |
| 534 |
return item, nil |
| 535 |
} |
| 536 |
|
| 537 |
func (it *OperationIterator) bufLen() int { |
| 538 |
return len(it.items) |
| 539 |
} |
| 540 |
|
| 541 |
func (it *OperationIterator) takeBuf() interface{} { |
| 542 |
b := it.items |
| 543 |
it.items = nil |
| 544 |
return b |
| 545 |
} |
| 546 |
|
| 547 |
|
| 548 |
type OrchestrationClusterIterator struct { |
| 549 |
items []*telcoautomationpb.OrchestrationCluster |
| 550 |
pageInfo *iterator.PageInfo |
| 551 |
nextFunc func() error |
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
Response interface{} |
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
InternalFetch func(pageSize int, pageToken string) (results []*telcoautomationpb.OrchestrationCluster, nextPageToken string, err error) |
| 565 |
} |
| 566 |
|
| 567 |
|
| 568 |
func (it *OrchestrationClusterIterator) PageInfo() *iterator.PageInfo { |
| 569 |
return it.pageInfo |
| 570 |
} |
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
func (it *OrchestrationClusterIterator) Next() (*telcoautomationpb.OrchestrationCluster, error) { |
| 575 |
var item *telcoautomationpb.OrchestrationCluster |
| 576 |
if err := it.nextFunc(); err != nil { |
| 577 |
return item, err |
| 578 |
} |
| 579 |
item = it.items[0] |
| 580 |
it.items = it.items[1:] |
| 581 |
return item, nil |
| 582 |
} |
| 583 |
|
| 584 |
func (it *OrchestrationClusterIterator) bufLen() int { |
| 585 |
return len(it.items) |
| 586 |
} |
| 587 |
|
| 588 |
func (it *OrchestrationClusterIterator) takeBuf() interface{} { |
| 589 |
b := it.items |
| 590 |
it.items = nil |
| 591 |
return b |
| 592 |
} |
| 593 |
|
| 594 |
|
| 595 |
type PublicBlueprintIterator struct { |
| 596 |
items []*telcoautomationpb.PublicBlueprint |
| 597 |
pageInfo *iterator.PageInfo |
| 598 |
nextFunc func() error |
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
Response interface{} |
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
InternalFetch func(pageSize int, pageToken string) (results []*telcoautomationpb.PublicBlueprint, nextPageToken string, err error) |
| 612 |
} |
| 613 |
|
| 614 |
|
| 615 |
func (it *PublicBlueprintIterator) PageInfo() *iterator.PageInfo { |
| 616 |
return it.pageInfo |
| 617 |
} |
| 618 |
|
| 619 |
|
| 620 |
|
| 621 |
func (it *PublicBlueprintIterator) Next() (*telcoautomationpb.PublicBlueprint, error) { |
| 622 |
var item *telcoautomationpb.PublicBlueprint |
| 623 |
if err := it.nextFunc(); err != nil { |
| 624 |
return item, err |
| 625 |
} |
| 626 |
item = it.items[0] |
| 627 |
it.items = it.items[1:] |
| 628 |
return item, nil |
| 629 |
} |
| 630 |
|
| 631 |
func (it *PublicBlueprintIterator) bufLen() int { |
| 632 |
return len(it.items) |
| 633 |
} |
| 634 |
|
| 635 |
func (it *PublicBlueprintIterator) takeBuf() interface{} { |
| 636 |
b := it.items |
| 637 |
it.items = nil |
| 638 |
return b |
| 639 |
} |