1 // Copyright 2024 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 logging 18 19 import ( 20 "context" 21 "time" 22 23 loggingpb "cloud.google.com/go/logging/apiv2/loggingpb" 24 "cloud.google.com/go/longrunning" 25 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" 26 gax "github.com/googleapis/gax-go/v2" 27 "google.golang.org/api/iterator" 28 monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres" 29 ) 30 31 // CopyLogEntriesOperation manages a long-running operation from CopyLogEntries. 32 type CopyLogEntriesOperation struct { 33 lro *longrunning.Operation 34 } 35 36 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered. 37 // 38 // See documentation of Poll for error-handling information. 39 func (op *CopyLogEntriesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*loggingpb.CopyLogEntriesResponse, error) { 40 var resp loggingpb.CopyLogEntriesResponse 41 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { 42 return nil, err 43 } 44 return &resp, nil 45 } 46 47 // Poll fetches the latest state of the long-running operation. 48 // 49 // Poll also fetches the latest metadata, which can be retrieved by Metadata. 50 // 51 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and 52 // the operation has completed with failure, the error is returned and op.Done will return true. 53 // If Poll succeeds and the operation has completed successfully, 54 // op.Done will return true, and the response of the operation is returned. 55 // If Poll succeeds and the operation has not completed, the returned response and error are both nil. 56 func (op *CopyLogEntriesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*loggingpb.CopyLogEntriesResponse, error) { 57 var resp loggingpb.CopyLogEntriesResponse 58 if err := op.lro.Poll(ctx, &resp, opts...); err != nil { 59 return nil, err 60 } 61 if !op.Done() { 62 return nil, nil 63 } 64 return &resp, nil 65 } 66 67 // Metadata returns metadata associated with the long-running operation. 68 // Metadata itself does not contact the server, but Poll does. 69 // To get the latest metadata, call this method after a successful call to Poll. 70 // If the metadata is not available, the returned metadata and error are both nil. 71 func (op *CopyLogEntriesOperation) Metadata() (*loggingpb.CopyLogEntriesMetadata, error) { 72 var meta loggingpb.CopyLogEntriesMetadata 73 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { 74 return nil, nil 75 } else if err != nil { 76 return nil, err 77 } 78 return &meta, nil 79 } 80 81 // Done reports whether the long-running operation has completed. 82 func (op *CopyLogEntriesOperation) Done() bool { 83 return op.lro.Done() 84 } 85 86 // Name returns the name of the long-running operation. 87 // The name is assigned by the server and is unique within the service from which the operation is created. 88 func (op *CopyLogEntriesOperation) Name() string { 89 return op.lro.Name() 90 } 91 92 // CreateBucketAsyncOperation manages a long-running operation from CreateBucketAsync. 93 type CreateBucketAsyncOperation struct { 94 lro *longrunning.Operation 95 } 96 97 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered. 98 // 99 // See documentation of Poll for error-handling information. 100 func (op *CreateBucketAsyncOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*loggingpb.LogBucket, error) { 101 var resp loggingpb.LogBucket 102 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { 103 return nil, err 104 } 105 return &resp, nil 106 } 107 108 // Poll fetches the latest state of the long-running operation. 109 // 110 // Poll also fetches the latest metadata, which can be retrieved by Metadata. 111 // 112 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and 113 // the operation has completed with failure, the error is returned and op.Done will return true. 114 // If Poll succeeds and the operation has completed successfully, 115 // op.Done will return true, and the response of the operation is returned. 116 // If Poll succeeds and the operation has not completed, the returned response and error are both nil. 117 func (op *CreateBucketAsyncOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*loggingpb.LogBucket, error) { 118 var resp loggingpb.LogBucket 119 if err := op.lro.Poll(ctx, &resp, opts...); err != nil { 120 return nil, err 121 } 122 if !op.Done() { 123 return nil, nil 124 } 125 return &resp, nil 126 } 127 128 // Metadata returns metadata associated with the long-running operation. 129 // Metadata itself does not contact the server, but Poll does. 130 // To get the latest metadata, call this method after a successful call to Poll. 131 // If the metadata is not available, the returned metadata and error are both nil. 132 func (op *CreateBucketAsyncOperation) Metadata() (*loggingpb.BucketMetadata, error) { 133 var meta loggingpb.BucketMetadata 134 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { 135 return nil, nil 136 } else if err != nil { 137 return nil, err 138 } 139 return &meta, nil 140 } 141 142 // Done reports whether the long-running operation has completed. 143 func (op *CreateBucketAsyncOperation) Done() bool { 144 return op.lro.Done() 145 } 146 147 // Name returns the name of the long-running operation. 148 // The name is assigned by the server and is unique within the service from which the operation is created. 149 func (op *CreateBucketAsyncOperation) Name() string { 150 return op.lro.Name() 151 } 152 153 // CreateLinkOperation manages a long-running operation from CreateLink. 154 type CreateLinkOperation struct { 155 lro *longrunning.Operation 156 } 157 158 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered. 159 // 160 // See documentation of Poll for error-handling information. 161 func (op *CreateLinkOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*loggingpb.Link, error) { 162 var resp loggingpb.Link 163 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { 164 return nil, err 165 } 166 return &resp, nil 167 } 168 169 // Poll fetches the latest state of the long-running operation. 170 // 171 // Poll also fetches the latest metadata, which can be retrieved by Metadata. 172 // 173 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and 174 // the operation has completed with failure, the error is returned and op.Done will return true. 175 // If Poll succeeds and the operation has completed successfully, 176 // op.Done will return true, and the response of the operation is returned. 177 // If Poll succeeds and the operation has not completed, the returned response and error are both nil. 178 func (op *CreateLinkOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*loggingpb.Link, error) { 179 var resp loggingpb.Link 180 if err := op.lro.Poll(ctx, &resp, opts...); err != nil { 181 return nil, err 182 } 183 if !op.Done() { 184 return nil, nil 185 } 186 return &resp, nil 187 } 188 189 // Metadata returns metadata associated with the long-running operation. 190 // Metadata itself does not contact the server, but Poll does. 191 // To get the latest metadata, call this method after a successful call to Poll. 192 // If the metadata is not available, the returned metadata and error are both nil. 193 func (op *CreateLinkOperation) Metadata() (*loggingpb.LinkMetadata, error) { 194 var meta loggingpb.LinkMetadata 195 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { 196 return nil, nil 197 } else if err != nil { 198 return nil, err 199 } 200 return &meta, nil 201 } 202 203 // Done reports whether the long-running operation has completed. 204 func (op *CreateLinkOperation) Done() bool { 205 return op.lro.Done() 206 } 207 208 // Name returns the name of the long-running operation. 209 // The name is assigned by the server and is unique within the service from which the operation is created. 210 func (op *CreateLinkOperation) Name() string { 211 return op.lro.Name() 212 } 213 214 // DeleteLinkOperation manages a long-running operation from DeleteLink. 215 type DeleteLinkOperation struct { 216 lro *longrunning.Operation 217 } 218 219 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered. 220 // 221 // See documentation of Poll for error-handling information. 222 func (op *DeleteLinkOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { 223 return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) 224 } 225 226 // Poll fetches the latest state of the long-running operation. 227 // 228 // Poll also fetches the latest metadata, which can be retrieved by Metadata. 229 // 230 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and 231 // the operation has completed with failure, the error is returned and op.Done will return true. 232 // If Poll succeeds and the operation has completed successfully, 233 // op.Done will return true, and the response of the operation is returned. 234 // If Poll succeeds and the operation has not completed, the returned response and error are both nil. 235 func (op *DeleteLinkOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { 236 return op.lro.Poll(ctx, nil, opts...) 237 } 238 239 // Metadata returns metadata associated with the long-running operation. 240 // Metadata itself does not contact the server, but Poll does. 241 // To get the latest metadata, call this method after a successful call to Poll. 242 // If the metadata is not available, the returned metadata and error are both nil. 243 func (op *DeleteLinkOperation) Metadata() (*loggingpb.LinkMetadata, error) { 244 var meta loggingpb.LinkMetadata 245 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { 246 return nil, nil 247 } else if err != nil { 248 return nil, err 249 } 250 return &meta, nil 251 } 252 253 // Done reports whether the long-running operation has completed. 254 func (op *DeleteLinkOperation) Done() bool { 255 return op.lro.Done() 256 } 257 258 // Name returns the name of the long-running operation. 259 // The name is assigned by the server and is unique within the service from which the operation is created. 260 func (op *DeleteLinkOperation) Name() string { 261 return op.lro.Name() 262 } 263 264 // UpdateBucketAsyncOperation manages a long-running operation from UpdateBucketAsync. 265 type UpdateBucketAsyncOperation struct { 266 lro *longrunning.Operation 267 } 268 269 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered. 270 // 271 // See documentation of Poll for error-handling information. 272 func (op *UpdateBucketAsyncOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*loggingpb.LogBucket, error) { 273 var resp loggingpb.LogBucket 274 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { 275 return nil, err 276 } 277 return &resp, nil 278 } 279 280 // Poll fetches the latest state of the long-running operation. 281 // 282 // Poll also fetches the latest metadata, which can be retrieved by Metadata. 283 // 284 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and 285 // the operation has completed with failure, the error is returned and op.Done will return true. 286 // If Poll succeeds and the operation has completed successfully, 287 // op.Done will return true, and the response of the operation is returned. 288 // If Poll succeeds and the operation has not completed, the returned response and error are both nil. 289 func (op *UpdateBucketAsyncOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*loggingpb.LogBucket, error) { 290 var resp loggingpb.LogBucket 291 if err := op.lro.Poll(ctx, &resp, opts...); err != nil { 292 return nil, err 293 } 294 if !op.Done() { 295 return nil, nil 296 } 297 return &resp, nil 298 } 299 300 // Metadata returns metadata associated with the long-running operation. 301 // Metadata itself does not contact the server, but Poll does. 302 // To get the latest metadata, call this method after a successful call to Poll. 303 // If the metadata is not available, the returned metadata and error are both nil. 304 func (op *UpdateBucketAsyncOperation) Metadata() (*loggingpb.BucketMetadata, error) { 305 var meta loggingpb.BucketMetadata 306 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { 307 return nil, nil 308 } else if err != nil { 309 return nil, err 310 } 311 return &meta, nil 312 } 313 314 // Done reports whether the long-running operation has completed. 315 func (op *UpdateBucketAsyncOperation) Done() bool { 316 return op.lro.Done() 317 } 318 319 // Name returns the name of the long-running operation. 320 // The name is assigned by the server and is unique within the service from which the operation is created. 321 func (op *UpdateBucketAsyncOperation) Name() string { 322 return op.lro.Name() 323 } 324 325 // LinkIterator manages a stream of *loggingpb.Link. 326 type LinkIterator struct { 327 items []*loggingpb.Link 328 pageInfo *iterator.PageInfo 329 nextFunc func() error 330 331 // Response is the raw response for the current page. 332 // It must be cast to the RPC response type. 333 // Calling Next() or InternalFetch() updates this value. 334 Response interface{} 335 336 // InternalFetch is for use by the Google Cloud Libraries only. 337 // It is not part of the stable interface of this package. 338 // 339 // InternalFetch returns results from a single call to the underlying RPC. 340 // The number of results is no greater than pageSize. 341 // If there are no more results, nextPageToken is empty and err is nil. 342 InternalFetch func(pageSize int, pageToken string) (results []*loggingpb.Link, nextPageToken string, err error) 343 } 344 345 // PageInfo supports pagination. See the google.golang.org/api/iterator package for details. 346 func (it *LinkIterator) PageInfo() *iterator.PageInfo { 347 return it.pageInfo 348 } 349 350 // Next returns the next result. Its second return value is iterator.Done if there are no more 351 // results. Once Next returns Done, all subsequent calls will return Done. 352 func (it *LinkIterator) Next() (*loggingpb.Link, error) { 353 var item *loggingpb.Link 354 if err := it.nextFunc(); err != nil { 355 return item, err 356 } 357 item = it.items[0] 358 it.items = it.items[1:] 359 return item, nil 360 } 361 362 func (it *LinkIterator) bufLen() int { 363 return len(it.items) 364 } 365 366 func (it *LinkIterator) takeBuf() interface{} { 367 b := it.items 368 it.items = nil 369 return b 370 } 371 372 // LogBucketIterator manages a stream of *loggingpb.LogBucket. 373 type LogBucketIterator struct { 374 items []*loggingpb.LogBucket 375 pageInfo *iterator.PageInfo 376 nextFunc func() error 377 378 // Response is the raw response for the current page. 379 // It must be cast to the RPC response type. 380 // Calling Next() or InternalFetch() updates this value. 381 Response interface{} 382 383 // InternalFetch is for use by the Google Cloud Libraries only. 384 // It is not part of the stable interface of this package. 385 // 386 // InternalFetch returns results from a single call to the underlying RPC. 387 // The number of results is no greater than pageSize. 388 // If there are no more results, nextPageToken is empty and err is nil. 389 InternalFetch func(pageSize int, pageToken string) (results []*loggingpb.LogBucket, nextPageToken string, err error) 390 } 391 392 // PageInfo supports pagination. See the google.golang.org/api/iterator package for details. 393 func (it *LogBucketIterator) PageInfo() *iterator.PageInfo { 394 return it.pageInfo 395 } 396 397 // Next returns the next result. Its second return value is iterator.Done if there are no more 398 // results. Once Next returns Done, all subsequent calls will return Done. 399 func (it *LogBucketIterator) Next() (*loggingpb.LogBucket, error) { 400 var item *loggingpb.LogBucket 401 if err := it.nextFunc(); err != nil { 402 return item, err 403 } 404 item = it.items[0] 405 it.items = it.items[1:] 406 return item, nil 407 } 408 409 func (it *LogBucketIterator) bufLen() int { 410 return len(it.items) 411 } 412 413 func (it *LogBucketIterator) takeBuf() interface{} { 414 b := it.items 415 it.items = nil 416 return b 417 } 418 419 // LogEntryIterator manages a stream of *loggingpb.LogEntry. 420 type LogEntryIterator struct { 421 items []*loggingpb.LogEntry 422 pageInfo *iterator.PageInfo 423 nextFunc func() error 424 425 // Response is the raw response for the current page. 426 // It must be cast to the RPC response type. 427 // Calling Next() or InternalFetch() updates this value. 428 Response interface{} 429 430 // InternalFetch is for use by the Google Cloud Libraries only. 431 // It is not part of the stable interface of this package. 432 // 433 // InternalFetch returns results from a single call to the underlying RPC. 434 // The number of results is no greater than pageSize. 435 // If there are no more results, nextPageToken is empty and err is nil. 436 InternalFetch func(pageSize int, pageToken string) (results []*loggingpb.LogEntry, nextPageToken string, err error) 437 } 438 439 // PageInfo supports pagination. See the google.golang.org/api/iterator package for details. 440 func (it *LogEntryIterator) PageInfo() *iterator.PageInfo { 441 return it.pageInfo 442 } 443 444 // Next returns the next result. Its second return value is iterator.Done if there are no more 445 // results. Once Next returns Done, all subsequent calls will return Done. 446 func (it *LogEntryIterator) Next() (*loggingpb.LogEntry, error) { 447 var item *loggingpb.LogEntry 448 if err := it.nextFunc(); err != nil { 449 return item, err 450 } 451 item = it.items[0] 452 it.items = it.items[1:] 453 return item, nil 454 } 455 456 func (it *LogEntryIterator) bufLen() int { 457 return len(it.items) 458 } 459 460 func (it *LogEntryIterator) takeBuf() interface{} { 461 b := it.items 462 it.items = nil 463 return b 464 } 465 466 // LogExclusionIterator manages a stream of *loggingpb.LogExclusion. 467 type LogExclusionIterator struct { 468 items []*loggingpb.LogExclusion 469 pageInfo *iterator.PageInfo 470 nextFunc func() error 471 472 // Response is the raw response for the current page. 473 // It must be cast to the RPC response type. 474 // Calling Next() or InternalFetch() updates this value. 475 Response interface{} 476 477 // InternalFetch is for use by the Google Cloud Libraries only. 478 // It is not part of the stable interface of this package. 479 // 480 // InternalFetch returns results from a single call to the underlying RPC. 481 // The number of results is no greater than pageSize. 482 // If there are no more results, nextPageToken is empty and err is nil. 483 InternalFetch func(pageSize int, pageToken string) (results []*loggingpb.LogExclusion, nextPageToken string, err error) 484 } 485 486 // PageInfo supports pagination. See the google.golang.org/api/iterator package for details. 487 func (it *LogExclusionIterator) PageInfo() *iterator.PageInfo { 488 return it.pageInfo 489 } 490 491 // Next returns the next result. Its second return value is iterator.Done if there are no more 492 // results. Once Next returns Done, all subsequent calls will return Done. 493 func (it *LogExclusionIterator) Next() (*loggingpb.LogExclusion, error) { 494 var item *loggingpb.LogExclusion 495 if err := it.nextFunc(); err != nil { 496 return item, err 497 } 498 item = it.items[0] 499 it.items = it.items[1:] 500 return item, nil 501 } 502 503 func (it *LogExclusionIterator) bufLen() int { 504 return len(it.items) 505 } 506 507 func (it *LogExclusionIterator) takeBuf() interface{} { 508 b := it.items 509 it.items = nil 510 return b 511 } 512 513 // LogMetricIterator manages a stream of *loggingpb.LogMetric. 514 type LogMetricIterator struct { 515 items []*loggingpb.LogMetric 516 pageInfo *iterator.PageInfo 517 nextFunc func() error 518 519 // Response is the raw response for the current page. 520 // It must be cast to the RPC response type. 521 // Calling Next() or InternalFetch() updates this value. 522 Response interface{} 523 524 // InternalFetch is for use by the Google Cloud Libraries only. 525 // It is not part of the stable interface of this package. 526 // 527 // InternalFetch returns results from a single call to the underlying RPC. 528 // The number of results is no greater than pageSize. 529 // If there are no more results, nextPageToken is empty and err is nil. 530 InternalFetch func(pageSize int, pageToken string) (results []*loggingpb.LogMetric, nextPageToken string, err error) 531 } 532 533 // PageInfo supports pagination. See the google.golang.org/api/iterator package for details. 534 func (it *LogMetricIterator) PageInfo() *iterator.PageInfo { 535 return it.pageInfo 536 } 537 538 // Next returns the next result. Its second return value is iterator.Done if there are no more 539 // results. Once Next returns Done, all subsequent calls will return Done. 540 func (it *LogMetricIterator) Next() (*loggingpb.LogMetric, error) { 541 var item *loggingpb.LogMetric 542 if err := it.nextFunc(); err != nil { 543 return item, err 544 } 545 item = it.items[0] 546 it.items = it.items[1:] 547 return item, nil 548 } 549 550 func (it *LogMetricIterator) bufLen() int { 551 return len(it.items) 552 } 553 554 func (it *LogMetricIterator) takeBuf() interface{} { 555 b := it.items 556 it.items = nil 557 return b 558 } 559 560 // LogSinkIterator manages a stream of *loggingpb.LogSink. 561 type LogSinkIterator struct { 562 items []*loggingpb.LogSink 563 pageInfo *iterator.PageInfo 564 nextFunc func() error 565 566 // Response is the raw response for the current page. 567 // It must be cast to the RPC response type. 568 // Calling Next() or InternalFetch() updates this value. 569 Response interface{} 570 571 // InternalFetch is for use by the Google Cloud Libraries only. 572 // It is not part of the stable interface of this package. 573 // 574 // InternalFetch returns results from a single call to the underlying RPC. 575 // The number of results is no greater than pageSize. 576 // If there are no more results, nextPageToken is empty and err is nil. 577 InternalFetch func(pageSize int, pageToken string) (results []*loggingpb.LogSink, nextPageToken string, err error) 578 } 579 580 // PageInfo supports pagination. See the google.golang.org/api/iterator package for details. 581 func (it *LogSinkIterator) PageInfo() *iterator.PageInfo { 582 return it.pageInfo 583 } 584 585 // Next returns the next result. Its second return value is iterator.Done if there are no more 586 // results. Once Next returns Done, all subsequent calls will return Done. 587 func (it *LogSinkIterator) Next() (*loggingpb.LogSink, error) { 588 var item *loggingpb.LogSink 589 if err := it.nextFunc(); err != nil { 590 return item, err 591 } 592 item = it.items[0] 593 it.items = it.items[1:] 594 return item, nil 595 } 596 597 func (it *LogSinkIterator) bufLen() int { 598 return len(it.items) 599 } 600 601 func (it *LogSinkIterator) takeBuf() interface{} { 602 b := it.items 603 it.items = nil 604 return b 605 } 606 607 // LogViewIterator manages a stream of *loggingpb.LogView. 608 type LogViewIterator struct { 609 items []*loggingpb.LogView 610 pageInfo *iterator.PageInfo 611 nextFunc func() error 612 613 // Response is the raw response for the current page. 614 // It must be cast to the RPC response type. 615 // Calling Next() or InternalFetch() updates this value. 616 Response interface{} 617 618 // InternalFetch is for use by the Google Cloud Libraries only. 619 // It is not part of the stable interface of this package. 620 // 621 // InternalFetch returns results from a single call to the underlying RPC. 622 // The number of results is no greater than pageSize. 623 // If there are no more results, nextPageToken is empty and err is nil. 624 InternalFetch func(pageSize int, pageToken string) (results []*loggingpb.LogView, nextPageToken string, err error) 625 } 626 627 // PageInfo supports pagination. See the google.golang.org/api/iterator package for details. 628 func (it *LogViewIterator) PageInfo() *iterator.PageInfo { 629 return it.pageInfo 630 } 631 632 // Next returns the next result. Its second return value is iterator.Done if there are no more 633 // results. Once Next returns Done, all subsequent calls will return Done. 634 func (it *LogViewIterator) Next() (*loggingpb.LogView, error) { 635 var item *loggingpb.LogView 636 if err := it.nextFunc(); err != nil { 637 return item, err 638 } 639 item = it.items[0] 640 it.items = it.items[1:] 641 return item, nil 642 } 643 644 func (it *LogViewIterator) bufLen() int { 645 return len(it.items) 646 } 647 648 func (it *LogViewIterator) takeBuf() interface{} { 649 b := it.items 650 it.items = nil 651 return b 652 } 653 654 // MonitoredResourceDescriptorIterator manages a stream of *monitoredrespb.MonitoredResourceDescriptor. 655 type MonitoredResourceDescriptorIterator struct { 656 items []*monitoredrespb.MonitoredResourceDescriptor 657 pageInfo *iterator.PageInfo 658 nextFunc func() error 659 660 // Response is the raw response for the current page. 661 // It must be cast to the RPC response type. 662 // Calling Next() or InternalFetch() updates this value. 663 Response interface{} 664 665 // InternalFetch is for use by the Google Cloud Libraries only. 666 // It is not part of the stable interface of this package. 667 // 668 // InternalFetch returns results from a single call to the underlying RPC. 669 // The number of results is no greater than pageSize. 670 // If there are no more results, nextPageToken is empty and err is nil. 671 InternalFetch func(pageSize int, pageToken string) (results []*monitoredrespb.MonitoredResourceDescriptor, nextPageToken string, err error) 672 } 673 674 // PageInfo supports pagination. See the google.golang.org/api/iterator package for details. 675 func (it *MonitoredResourceDescriptorIterator) PageInfo() *iterator.PageInfo { 676 return it.pageInfo 677 } 678 679 // Next returns the next result. Its second return value is iterator.Done if there are no more 680 // results. Once Next returns Done, all subsequent calls will return Done. 681 func (it *MonitoredResourceDescriptorIterator) Next() (*monitoredrespb.MonitoredResourceDescriptor, error) { 682 var item *monitoredrespb.MonitoredResourceDescriptor 683 if err := it.nextFunc(); err != nil { 684 return item, err 685 } 686 item = it.items[0] 687 it.items = it.items[1:] 688 return item, nil 689 } 690 691 func (it *MonitoredResourceDescriptorIterator) bufLen() int { 692 return len(it.items) 693 } 694 695 func (it *MonitoredResourceDescriptorIterator) takeBuf() interface{} { 696 b := it.items 697 it.items = nil 698 return b 699 } 700 701 // OperationIterator manages a stream of *longrunningpb.Operation. 702 type OperationIterator struct { 703 items []*longrunningpb.Operation 704 pageInfo *iterator.PageInfo 705 nextFunc func() error 706 707 // Response is the raw response for the current page. 708 // It must be cast to the RPC response type. 709 // Calling Next() or InternalFetch() updates this value. 710 Response interface{} 711 712 // InternalFetch is for use by the Google Cloud Libraries only. 713 // It is not part of the stable interface of this package. 714 // 715 // InternalFetch returns results from a single call to the underlying RPC. 716 // The number of results is no greater than pageSize. 717 // If there are no more results, nextPageToken is empty and err is nil. 718 InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error) 719 } 720 721 // PageInfo supports pagination. See the google.golang.org/api/iterator package for details. 722 func (it *OperationIterator) PageInfo() *iterator.PageInfo { 723 return it.pageInfo 724 } 725 726 // Next returns the next result. Its second return value is iterator.Done if there are no more 727 // results. Once Next returns Done, all subsequent calls will return Done. 728 func (it *OperationIterator) Next() (*longrunningpb.Operation, error) { 729 var item *longrunningpb.Operation 730 if err := it.nextFunc(); err != nil { 731 return item, err 732 } 733 item = it.items[0] 734 it.items = it.items[1:] 735 return item, nil 736 } 737 738 func (it *OperationIterator) bufLen() int { 739 return len(it.items) 740 } 741 742 func (it *OperationIterator) takeBuf() interface{} { 743 b := it.items 744 it.items = nil 745 return b 746 } 747 748 // StringIterator manages a stream of string. 749 type StringIterator struct { 750 items []string 751 pageInfo *iterator.PageInfo 752 nextFunc func() error 753 754 // Response is the raw response for the current page. 755 // It must be cast to the RPC response type. 756 // Calling Next() or InternalFetch() updates this value. 757 Response interface{} 758 759 // InternalFetch is for use by the Google Cloud Libraries only. 760 // It is not part of the stable interface of this package. 761 // 762 // InternalFetch returns results from a single call to the underlying RPC. 763 // The number of results is no greater than pageSize. 764 // If there are no more results, nextPageToken is empty and err is nil. 765 InternalFetch func(pageSize int, pageToken string) (results []string, nextPageToken string, err error) 766 } 767 768 // PageInfo supports pagination. See the google.golang.org/api/iterator package for details. 769 func (it *StringIterator) PageInfo() *iterator.PageInfo { 770 return it.pageInfo 771 } 772 773 // Next returns the next result. Its second return value is iterator.Done if there are no more 774 // results. Once Next returns Done, all subsequent calls will return Done. 775 func (it *StringIterator) Next() (string, error) { 776 var item string 777 if err := it.nextFunc(); err != nil { 778 return item, err 779 } 780 item = it.items[0] 781 it.items = it.items[1:] 782 return item, nil 783 } 784 785 func (it *StringIterator) bufLen() int { 786 return len(it.items) 787 } 788 789 func (it *StringIterator) takeBuf() interface{} { 790 b := it.items 791 it.items = nil 792 return b 793 } 794