Debian Codegraph @

cloudbuild/apiv1/v2/auxiliary.go

raw
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 cloudbuild
18
19 import (
20 "context"
21 "time"
22
23 cloudbuildpb "cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb"
24 "cloud.google.com/go/longrunning"
25 gax "github.com/googleapis/gax-go/v2"
26 "google.golang.org/api/iterator"
27 )
28
29 // ApproveBuildOperation manages a long-running operation from ApproveBuild.
30 type ApproveBuildOperation struct {
31 lro *longrunning.Operation
32 pollPath string
33 }
34
35 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
36 //
37 // See documentation of Poll for error-handling information.
38 func (op *ApproveBuildOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.Build, error) {
39 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
40 var resp cloudbuildpb.Build
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 *ApproveBuildOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.Build, error) {
57 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
58 var resp cloudbuildpb.Build
59 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
60 return nil, err
61 }
62 if !op.Done() {
63 return nil, nil
64 }
65 return &resp, nil
66 }
67
68 // Metadata returns metadata associated with the long-running operation.
69 // Metadata itself does not contact the server, but Poll does.
70 // To get the latest metadata, call this method after a successful call to Poll.
71 // If the metadata is not available, the returned metadata and error are both nil.
72 func (op *ApproveBuildOperation) Metadata() (*cloudbuildpb.BuildOperationMetadata, error) {
73 var meta cloudbuildpb.BuildOperationMetadata
74 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
75 return nil, nil
76 } else if err != nil {
77 return nil, err
78 }
79 return &meta, nil
80 }
81
82 // Done reports whether the long-running operation has completed.
83 func (op *ApproveBuildOperation) Done() bool {
84 return op.lro.Done()
85 }
86
87 // Name returns the name of the long-running operation.
88 // The name is assigned by the server and is unique within the service from which the operation is created.
89 func (op *ApproveBuildOperation) Name() string {
90 return op.lro.Name()
91 }
92
93 // CreateBuildOperation manages a long-running operation from CreateBuild.
94 type CreateBuildOperation struct {
95 lro *longrunning.Operation
96 pollPath string
97 }
98
99 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
100 //
101 // See documentation of Poll for error-handling information.
102 func (op *CreateBuildOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.Build, error) {
103 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
104 var resp cloudbuildpb.Build
105 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
106 return nil, err
107 }
108 return &resp, nil
109 }
110
111 // Poll fetches the latest state of the long-running operation.
112 //
113 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
114 //
115 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
116 // the operation has completed with failure, the error is returned and op.Done will return true.
117 // If Poll succeeds and the operation has completed successfully,
118 // op.Done will return true, and the response of the operation is returned.
119 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
120 func (op *CreateBuildOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.Build, error) {
121 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
122 var resp cloudbuildpb.Build
123 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
124 return nil, err
125 }
126 if !op.Done() {
127 return nil, nil
128 }
129 return &resp, nil
130 }
131
132 // Metadata returns metadata associated with the long-running operation.
133 // Metadata itself does not contact the server, but Poll does.
134 // To get the latest metadata, call this method after a successful call to Poll.
135 // If the metadata is not available, the returned metadata and error are both nil.
136 func (op *CreateBuildOperation) Metadata() (*cloudbuildpb.BuildOperationMetadata, error) {
137 var meta cloudbuildpb.BuildOperationMetadata
138 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
139 return nil, nil
140 } else if err != nil {
141 return nil, err
142 }
143 return &meta, nil
144 }
145
146 // Done reports whether the long-running operation has completed.
147 func (op *CreateBuildOperation) Done() bool {
148 return op.lro.Done()
149 }
150
151 // Name returns the name of the long-running operation.
152 // The name is assigned by the server and is unique within the service from which the operation is created.
153 func (op *CreateBuildOperation) Name() string {
154 return op.lro.Name()
155 }
156
157 // CreateWorkerPoolOperation manages a long-running operation from CreateWorkerPool.
158 type CreateWorkerPoolOperation struct {
159 lro *longrunning.Operation
160 pollPath string
161 }
162
163 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
164 //
165 // See documentation of Poll for error-handling information.
166 func (op *CreateWorkerPoolOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.WorkerPool, error) {
167 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
168 var resp cloudbuildpb.WorkerPool
169 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
170 return nil, err
171 }
172 return &resp, nil
173 }
174
175 // Poll fetches the latest state of the long-running operation.
176 //
177 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
178 //
179 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
180 // the operation has completed with failure, the error is returned and op.Done will return true.
181 // If Poll succeeds and the operation has completed successfully,
182 // op.Done will return true, and the response of the operation is returned.
183 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
184 func (op *CreateWorkerPoolOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.WorkerPool, error) {
185 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
186 var resp cloudbuildpb.WorkerPool
187 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
188 return nil, err
189 }
190 if !op.Done() {
191 return nil, nil
192 }
193 return &resp, nil
194 }
195
196 // Metadata returns metadata associated with the long-running operation.
197 // Metadata itself does not contact the server, but Poll does.
198 // To get the latest metadata, call this method after a successful call to Poll.
199 // If the metadata is not available, the returned metadata and error are both nil.
200 func (op *CreateWorkerPoolOperation) Metadata() (*cloudbuildpb.CreateWorkerPoolOperationMetadata, error) {
201 var meta cloudbuildpb.CreateWorkerPoolOperationMetadata
202 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
203 return nil, nil
204 } else if err != nil {
205 return nil, err
206 }
207 return &meta, nil
208 }
209
210 // Done reports whether the long-running operation has completed.
211 func (op *CreateWorkerPoolOperation) Done() bool {
212 return op.lro.Done()
213 }
214
215 // Name returns the name of the long-running operation.
216 // The name is assigned by the server and is unique within the service from which the operation is created.
217 func (op *CreateWorkerPoolOperation) Name() string {
218 return op.lro.Name()
219 }
220
221 // DeleteWorkerPoolOperation manages a long-running operation from DeleteWorkerPool.
222 type DeleteWorkerPoolOperation struct {
223 lro *longrunning.Operation
224 pollPath string
225 }
226
227 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
228 //
229 // See documentation of Poll for error-handling information.
230 func (op *DeleteWorkerPoolOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
231 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
232 return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
233 }
234
235 // Poll fetches the latest state of the long-running operation.
236 //
237 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
238 //
239 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
240 // the operation has completed with failure, the error is returned and op.Done will return true.
241 // If Poll succeeds and the operation has completed successfully,
242 // op.Done will return true, and the response of the operation is returned.
243 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
244 func (op *DeleteWorkerPoolOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
245 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
246 return op.lro.Poll(ctx, nil, opts...)
247 }
248
249 // Metadata returns metadata associated with the long-running operation.
250 // Metadata itself does not contact the server, but Poll does.
251 // To get the latest metadata, call this method after a successful call to Poll.
252 // If the metadata is not available, the returned metadata and error are both nil.
253 func (op *DeleteWorkerPoolOperation) Metadata() (*cloudbuildpb.DeleteWorkerPoolOperationMetadata, error) {
254 var meta cloudbuildpb.DeleteWorkerPoolOperationMetadata
255 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
256 return nil, nil
257 } else if err != nil {
258 return nil, err
259 }
260 return &meta, nil
261 }
262
263 // Done reports whether the long-running operation has completed.
264 func (op *DeleteWorkerPoolOperation) Done() bool {
265 return op.lro.Done()
266 }
267
268 // Name returns the name of the long-running operation.
269 // The name is assigned by the server and is unique within the service from which the operation is created.
270 func (op *DeleteWorkerPoolOperation) Name() string {
271 return op.lro.Name()
272 }
273
274 // RetryBuildOperation manages a long-running operation from RetryBuild.
275 type RetryBuildOperation struct {
276 lro *longrunning.Operation
277 pollPath string
278 }
279
280 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
281 //
282 // See documentation of Poll for error-handling information.
283 func (op *RetryBuildOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.Build, error) {
284 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
285 var resp cloudbuildpb.Build
286 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
287 return nil, err
288 }
289 return &resp, nil
290 }
291
292 // Poll fetches the latest state of the long-running operation.
293 //
294 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
295 //
296 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
297 // the operation has completed with failure, the error is returned and op.Done will return true.
298 // If Poll succeeds and the operation has completed successfully,
299 // op.Done will return true, and the response of the operation is returned.
300 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
301 func (op *RetryBuildOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.Build, error) {
302 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
303 var resp cloudbuildpb.Build
304 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
305 return nil, err
306 }
307 if !op.Done() {
308 return nil, nil
309 }
310 return &resp, nil
311 }
312
313 // Metadata returns metadata associated with the long-running operation.
314 // Metadata itself does not contact the server, but Poll does.
315 // To get the latest metadata, call this method after a successful call to Poll.
316 // If the metadata is not available, the returned metadata and error are both nil.
317 func (op *RetryBuildOperation) Metadata() (*cloudbuildpb.BuildOperationMetadata, error) {
318 var meta cloudbuildpb.BuildOperationMetadata
319 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
320 return nil, nil
321 } else if err != nil {
322 return nil, err
323 }
324 return &meta, nil
325 }
326
327 // Done reports whether the long-running operation has completed.
328 func (op *RetryBuildOperation) Done() bool {
329 return op.lro.Done()
330 }
331
332 // Name returns the name of the long-running operation.
333 // The name is assigned by the server and is unique within the service from which the operation is created.
334 func (op *RetryBuildOperation) Name() string {
335 return op.lro.Name()
336 }
337
338 // RunBuildTriggerOperation manages a long-running operation from RunBuildTrigger.
339 type RunBuildTriggerOperation struct {
340 lro *longrunning.Operation
341 pollPath string
342 }
343
344 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
345 //
346 // See documentation of Poll for error-handling information.
347 func (op *RunBuildTriggerOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.Build, error) {
348 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
349 var resp cloudbuildpb.Build
350 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
351 return nil, err
352 }
353 return &resp, nil
354 }
355
356 // Poll fetches the latest state of the long-running operation.
357 //
358 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
359 //
360 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
361 // the operation has completed with failure, the error is returned and op.Done will return true.
362 // If Poll succeeds and the operation has completed successfully,
363 // op.Done will return true, and the response of the operation is returned.
364 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
365 func (op *RunBuildTriggerOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.Build, error) {
366 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
367 var resp cloudbuildpb.Build
368 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
369 return nil, err
370 }
371 if !op.Done() {
372 return nil, nil
373 }
374 return &resp, nil
375 }
376
377 // Metadata returns metadata associated with the long-running operation.
378 // Metadata itself does not contact the server, but Poll does.
379 // To get the latest metadata, call this method after a successful call to Poll.
380 // If the metadata is not available, the returned metadata and error are both nil.
381 func (op *RunBuildTriggerOperation) Metadata() (*cloudbuildpb.BuildOperationMetadata, error) {
382 var meta cloudbuildpb.BuildOperationMetadata
383 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
384 return nil, nil
385 } else if err != nil {
386 return nil, err
387 }
388 return &meta, nil
389 }
390
391 // Done reports whether the long-running operation has completed.
392 func (op *RunBuildTriggerOperation) Done() bool {
393 return op.lro.Done()
394 }
395
396 // Name returns the name of the long-running operation.
397 // The name is assigned by the server and is unique within the service from which the operation is created.
398 func (op *RunBuildTriggerOperation) Name() string {
399 return op.lro.Name()
400 }
401
402 // UpdateWorkerPoolOperation manages a long-running operation from UpdateWorkerPool.
403 type UpdateWorkerPoolOperation struct {
404 lro *longrunning.Operation
405 pollPath string
406 }
407
408 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
409 //
410 // See documentation of Poll for error-handling information.
411 func (op *UpdateWorkerPoolOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.WorkerPool, error) {
412 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
413 var resp cloudbuildpb.WorkerPool
414 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
415 return nil, err
416 }
417 return &resp, nil
418 }
419
420 // Poll fetches the latest state of the long-running operation.
421 //
422 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
423 //
424 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
425 // the operation has completed with failure, the error is returned and op.Done will return true.
426 // If Poll succeeds and the operation has completed successfully,
427 // op.Done will return true, and the response of the operation is returned.
428 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
429 func (op *UpdateWorkerPoolOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.WorkerPool, error) {
430 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
431 var resp cloudbuildpb.WorkerPool
432 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
433 return nil, err
434 }
435 if !op.Done() {
436 return nil, nil
437 }
438 return &resp, nil
439 }
440
441 // Metadata returns metadata associated with the long-running operation.
442 // Metadata itself does not contact the server, but Poll does.
443 // To get the latest metadata, call this method after a successful call to Poll.
444 // If the metadata is not available, the returned metadata and error are both nil.
445 func (op *UpdateWorkerPoolOperation) Metadata() (*cloudbuildpb.UpdateWorkerPoolOperationMetadata, error) {
446 var meta cloudbuildpb.UpdateWorkerPoolOperationMetadata
447 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
448 return nil, nil
449 } else if err != nil {
450 return nil, err
451 }
452 return &meta, nil
453 }
454
455 // Done reports whether the long-running operation has completed.
456 func (op *UpdateWorkerPoolOperation) Done() bool {
457 return op.lro.Done()
458 }
459
460 // Name returns the name of the long-running operation.
461 // The name is assigned by the server and is unique within the service from which the operation is created.
462 func (op *UpdateWorkerPoolOperation) Name() string {
463 return op.lro.Name()
464 }
465
466 // BuildIterator manages a stream of *cloudbuildpb.Build.
467 type BuildIterator struct {
468 items []*cloudbuildpb.Build
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 []*cloudbuildpb.Build, nextPageToken string, err error)
484 }
485
486 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
487 func (it *BuildIterator) 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 *BuildIterator) Next() (*cloudbuildpb.Build, error) {
494 var item *cloudbuildpb.Build
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 *BuildIterator) bufLen() int {
504 return len(it.items)
505 }
506
507 func (it *BuildIterator) takeBuf() interface{} {
508 b := it.items
509 it.items = nil
510 return b
511 }
512
513 // BuildTriggerIterator manages a stream of *cloudbuildpb.BuildTrigger.
514 type BuildTriggerIterator struct {
515 items []*cloudbuildpb.BuildTrigger
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 []*cloudbuildpb.BuildTrigger, nextPageToken string, err error)
531 }
532
533 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
534 func (it *BuildTriggerIterator) 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 *BuildTriggerIterator) Next() (*cloudbuildpb.BuildTrigger, error) {
541 var item *cloudbuildpb.BuildTrigger
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 *BuildTriggerIterator) bufLen() int {
551 return len(it.items)
552 }
553
554 func (it *BuildTriggerIterator) takeBuf() interface{} {
555 b := it.items
556 it.items = nil
557 return b
558 }
559
560 // WorkerPoolIterator manages a stream of *cloudbuildpb.WorkerPool.
561 type WorkerPoolIterator struct {
562 items []*cloudbuildpb.WorkerPool
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 []*cloudbuildpb.WorkerPool, nextPageToken string, err error)
578 }
579
580 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
581 func (it *WorkerPoolIterator) 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 *WorkerPoolIterator) Next() (*cloudbuildpb.WorkerPool, error) {
588 var item *cloudbuildpb.WorkerPool
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 *WorkerPoolIterator) bufLen() int {
598 return len(it.items)
599 }
600
601 func (it *WorkerPoolIterator) takeBuf() interface{} {
602 b := it.items
603 it.items = nil
604 return b
605 }