Debian Codegraph @

alloydb/apiv1alpha/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 alloydb
18
19 import (
20 "context"
21 "time"
22
23 alloydbpb "cloud.google.com/go/alloydb/apiv1alpha/alloydbpb"
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 locationpb "google.golang.org/genproto/googleapis/cloud/location"
29 )
30
31 // BatchCreateInstancesOperation manages a long-running operation from BatchCreateInstances.
32 type BatchCreateInstancesOperation struct {
33 lro *longrunning.Operation
34 pollPath string
35 }
36
37 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
38 //
39 // See documentation of Poll for error-handling information.
40 func (op *BatchCreateInstancesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.BatchCreateInstancesResponse, error) {
41 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
42 var resp alloydbpb.BatchCreateInstancesResponse
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 // Poll fetches the latest state of the long-running operation.
50 //
51 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
52 //
53 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
54 // the operation has completed with failure, the error is returned and op.Done will return true.
55 // If Poll succeeds and the operation has completed successfully,
56 // op.Done will return true, and the response of the operation is returned.
57 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
58 func (op *BatchCreateInstancesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.BatchCreateInstancesResponse, error) {
59 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
60 var resp alloydbpb.BatchCreateInstancesResponse
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 // Metadata returns metadata associated with the long-running operation.
71 // Metadata itself does not contact the server, but Poll does.
72 // To get the latest metadata, call this method after a successful call to Poll.
73 // If the metadata is not available, the returned metadata and error are both nil.
74 func (op *BatchCreateInstancesOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
75 var meta alloydbpb.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 // Done reports whether the long-running operation has completed.
85 func (op *BatchCreateInstancesOperation) Done() bool {
86 return op.lro.Done()
87 }
88
89 // Name returns the name of the long-running operation.
90 // The name is assigned by the server and is unique within the service from which the operation is created.
91 func (op *BatchCreateInstancesOperation) Name() string {
92 return op.lro.Name()
93 }
94
95 // CreateBackupOperation manages a long-running operation from CreateBackup.
96 type CreateBackupOperation struct {
97 lro *longrunning.Operation
98 pollPath string
99 }
100
101 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
102 //
103 // See documentation of Poll for error-handling information.
104 func (op *CreateBackupOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Backup, error) {
105 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
106 var resp alloydbpb.Backup
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 // Poll fetches the latest state of the long-running operation.
114 //
115 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
116 //
117 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
118 // the operation has completed with failure, the error is returned and op.Done will return true.
119 // If Poll succeeds and the operation has completed successfully,
120 // op.Done will return true, and the response of the operation is returned.
121 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
122 func (op *CreateBackupOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Backup, error) {
123 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
124 var resp alloydbpb.Backup
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 // Metadata returns metadata associated with the long-running operation.
135 // Metadata itself does not contact the server, but Poll does.
136 // To get the latest metadata, call this method after a successful call to Poll.
137 // If the metadata is not available, the returned metadata and error are both nil.
138 func (op *CreateBackupOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
139 var meta alloydbpb.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 // Done reports whether the long-running operation has completed.
149 func (op *CreateBackupOperation) Done() bool {
150 return op.lro.Done()
151 }
152
153 // Name returns the name of the long-running operation.
154 // The name is assigned by the server and is unique within the service from which the operation is created.
155 func (op *CreateBackupOperation) Name() string {
156 return op.lro.Name()
157 }
158
159 // CreateClusterOperation manages a long-running operation from CreateCluster.
160 type CreateClusterOperation struct {
161 lro *longrunning.Operation
162 pollPath string
163 }
164
165 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
166 //
167 // See documentation of Poll for error-handling information.
168 func (op *CreateClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Cluster, error) {
169 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
170 var resp alloydbpb.Cluster
171 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
172 return nil, err
173 }
174 return &resp, nil
175 }
176
177 // Poll fetches the latest state of the long-running operation.
178 //
179 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
180 //
181 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
182 // the operation has completed with failure, the error is returned and op.Done will return true.
183 // If Poll succeeds and the operation has completed successfully,
184 // op.Done will return true, and the response of the operation is returned.
185 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
186 func (op *CreateClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Cluster, error) {
187 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
188 var resp alloydbpb.Cluster
189 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
190 return nil, err
191 }
192 if !op.Done() {
193 return nil, nil
194 }
195 return &resp, nil
196 }
197
198 // Metadata returns metadata associated with the long-running operation.
199 // Metadata itself does not contact the server, but Poll does.
200 // To get the latest metadata, call this method after a successful call to Poll.
201 // If the metadata is not available, the returned metadata and error are both nil.
202 func (op *CreateClusterOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
203 var meta alloydbpb.OperationMetadata
204 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
205 return nil, nil
206 } else if err != nil {
207 return nil, err
208 }
209 return &meta, nil
210 }
211
212 // Done reports whether the long-running operation has completed.
213 func (op *CreateClusterOperation) Done() bool {
214 return op.lro.Done()
215 }
216
217 // Name returns the name of the long-running operation.
218 // The name is assigned by the server and is unique within the service from which the operation is created.
219 func (op *CreateClusterOperation) Name() string {
220 return op.lro.Name()
221 }
222
223 // CreateInstanceOperation manages a long-running operation from CreateInstance.
224 type CreateInstanceOperation struct {
225 lro *longrunning.Operation
226 pollPath string
227 }
228
229 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
230 //
231 // See documentation of Poll for error-handling information.
232 func (op *CreateInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Instance, error) {
233 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
234 var resp alloydbpb.Instance
235 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
236 return nil, err
237 }
238 return &resp, nil
239 }
240
241 // Poll fetches the latest state of the long-running operation.
242 //
243 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
244 //
245 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
246 // the operation has completed with failure, the error is returned and op.Done will return true.
247 // If Poll succeeds and the operation has completed successfully,
248 // op.Done will return true, and the response of the operation is returned.
249 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
250 func (op *CreateInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Instance, error) {
251 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
252 var resp alloydbpb.Instance
253 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
254 return nil, err
255 }
256 if !op.Done() {
257 return nil, nil
258 }
259 return &resp, nil
260 }
261
262 // Metadata returns metadata associated with the long-running operation.
263 // Metadata itself does not contact the server, but Poll does.
264 // To get the latest metadata, call this method after a successful call to Poll.
265 // If the metadata is not available, the returned metadata and error are both nil.
266 func (op *CreateInstanceOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
267 var meta alloydbpb.OperationMetadata
268 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
269 return nil, nil
270 } else if err != nil {
271 return nil, err
272 }
273 return &meta, nil
274 }
275
276 // Done reports whether the long-running operation has completed.
277 func (op *CreateInstanceOperation) Done() bool {
278 return op.lro.Done()
279 }
280
281 // Name returns the name of the long-running operation.
282 // The name is assigned by the server and is unique within the service from which the operation is created.
283 func (op *CreateInstanceOperation) Name() string {
284 return op.lro.Name()
285 }
286
287 // CreateSecondaryClusterOperation manages a long-running operation from CreateSecondaryCluster.
288 type CreateSecondaryClusterOperation struct {
289 lro *longrunning.Operation
290 pollPath string
291 }
292
293 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
294 //
295 // See documentation of Poll for error-handling information.
296 func (op *CreateSecondaryClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Cluster, error) {
297 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
298 var resp alloydbpb.Cluster
299 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
300 return nil, err
301 }
302 return &resp, nil
303 }
304
305 // Poll fetches the latest state of the long-running operation.
306 //
307 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
308 //
309 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
310 // the operation has completed with failure, the error is returned and op.Done will return true.
311 // If Poll succeeds and the operation has completed successfully,
312 // op.Done will return true, and the response of the operation is returned.
313 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
314 func (op *CreateSecondaryClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Cluster, error) {
315 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
316 var resp alloydbpb.Cluster
317 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
318 return nil, err
319 }
320 if !op.Done() {
321 return nil, nil
322 }
323 return &resp, nil
324 }
325
326 // Metadata returns metadata associated with the long-running operation.
327 // Metadata itself does not contact the server, but Poll does.
328 // To get the latest metadata, call this method after a successful call to Poll.
329 // If the metadata is not available, the returned metadata and error are both nil.
330 func (op *CreateSecondaryClusterOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
331 var meta alloydbpb.OperationMetadata
332 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
333 return nil, nil
334 } else if err != nil {
335 return nil, err
336 }
337 return &meta, nil
338 }
339
340 // Done reports whether the long-running operation has completed.
341 func (op *CreateSecondaryClusterOperation) Done() bool {
342 return op.lro.Done()
343 }
344
345 // Name returns the name of the long-running operation.
346 // The name is assigned by the server and is unique within the service from which the operation is created.
347 func (op *CreateSecondaryClusterOperation) Name() string {
348 return op.lro.Name()
349 }
350
351 // CreateSecondaryInstanceOperation manages a long-running operation from CreateSecondaryInstance.
352 type CreateSecondaryInstanceOperation struct {
353 lro *longrunning.Operation
354 pollPath string
355 }
356
357 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
358 //
359 // See documentation of Poll for error-handling information.
360 func (op *CreateSecondaryInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Instance, error) {
361 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
362 var resp alloydbpb.Instance
363 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
364 return nil, err
365 }
366 return &resp, nil
367 }
368
369 // Poll fetches the latest state of the long-running operation.
370 //
371 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
372 //
373 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
374 // the operation has completed with failure, the error is returned and op.Done will return true.
375 // If Poll succeeds and the operation has completed successfully,
376 // op.Done will return true, and the response of the operation is returned.
377 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
378 func (op *CreateSecondaryInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Instance, error) {
379 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
380 var resp alloydbpb.Instance
381 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
382 return nil, err
383 }
384 if !op.Done() {
385 return nil, nil
386 }
387 return &resp, nil
388 }
389
390 // Metadata returns metadata associated with the long-running operation.
391 // Metadata itself does not contact the server, but Poll does.
392 // To get the latest metadata, call this method after a successful call to Poll.
393 // If the metadata is not available, the returned metadata and error are both nil.
394 func (op *CreateSecondaryInstanceOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
395 var meta alloydbpb.OperationMetadata
396 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
397 return nil, nil
398 } else if err != nil {
399 return nil, err
400 }
401 return &meta, nil
402 }
403
404 // Done reports whether the long-running operation has completed.
405 func (op *CreateSecondaryInstanceOperation) Done() bool {
406 return op.lro.Done()
407 }
408
409 // Name returns the name of the long-running operation.
410 // The name is assigned by the server and is unique within the service from which the operation is created.
411 func (op *CreateSecondaryInstanceOperation) Name() string {
412 return op.lro.Name()
413 }
414
415 // DeleteBackupOperation manages a long-running operation from DeleteBackup.
416 type DeleteBackupOperation struct {
417 lro *longrunning.Operation
418 pollPath string
419 }
420
421 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
422 //
423 // See documentation of Poll for error-handling information.
424 func (op *DeleteBackupOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
425 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
426 return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
427 }
428
429 // Poll fetches the latest state of the long-running operation.
430 //
431 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
432 //
433 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
434 // the operation has completed with failure, the error is returned and op.Done will return true.
435 // If Poll succeeds and the operation has completed successfully,
436 // op.Done will return true, and the response of the operation is returned.
437 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
438 func (op *DeleteBackupOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
439 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
440 return op.lro.Poll(ctx, nil, opts...)
441 }
442
443 // Metadata returns metadata associated with the long-running operation.
444 // Metadata itself does not contact the server, but Poll does.
445 // To get the latest metadata, call this method after a successful call to Poll.
446 // If the metadata is not available, the returned metadata and error are both nil.
447 func (op *DeleteBackupOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
448 var meta alloydbpb.OperationMetadata
449 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
450 return nil, nil
451 } else if err != nil {
452 return nil, err
453 }
454 return &meta, nil
455 }
456
457 // Done reports whether the long-running operation has completed.
458 func (op *DeleteBackupOperation) Done() bool {
459 return op.lro.Done()
460 }
461
462 // Name returns the name of the long-running operation.
463 // The name is assigned by the server and is unique within the service from which the operation is created.
464 func (op *DeleteBackupOperation) Name() string {
465 return op.lro.Name()
466 }
467
468 // DeleteClusterOperation manages a long-running operation from DeleteCluster.
469 type DeleteClusterOperation struct {
470 lro *longrunning.Operation
471 pollPath string
472 }
473
474 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
475 //
476 // See documentation of Poll for error-handling information.
477 func (op *DeleteClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
478 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
479 return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
480 }
481
482 // Poll fetches the latest state of the long-running operation.
483 //
484 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
485 //
486 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
487 // the operation has completed with failure, the error is returned and op.Done will return true.
488 // If Poll succeeds and the operation has completed successfully,
489 // op.Done will return true, and the response of the operation is returned.
490 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
491 func (op *DeleteClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
492 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
493 return op.lro.Poll(ctx, nil, opts...)
494 }
495
496 // Metadata returns metadata associated with the long-running operation.
497 // Metadata itself does not contact the server, but Poll does.
498 // To get the latest metadata, call this method after a successful call to Poll.
499 // If the metadata is not available, the returned metadata and error are both nil.
500 func (op *DeleteClusterOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
501 var meta alloydbpb.OperationMetadata
502 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
503 return nil, nil
504 } else if err != nil {
505 return nil, err
506 }
507 return &meta, nil
508 }
509
510 // Done reports whether the long-running operation has completed.
511 func (op *DeleteClusterOperation) Done() bool {
512 return op.lro.Done()
513 }
514
515 // Name returns the name of the long-running operation.
516 // The name is assigned by the server and is unique within the service from which the operation is created.
517 func (op *DeleteClusterOperation) Name() string {
518 return op.lro.Name()
519 }
520
521 // DeleteInstanceOperation manages a long-running operation from DeleteInstance.
522 type DeleteInstanceOperation struct {
523 lro *longrunning.Operation
524 pollPath string
525 }
526
527 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
528 //
529 // See documentation of Poll for error-handling information.
530 func (op *DeleteInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
531 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
532 return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
533 }
534
535 // Poll fetches the latest state of the long-running operation.
536 //
537 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
538 //
539 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
540 // the operation has completed with failure, the error is returned and op.Done will return true.
541 // If Poll succeeds and the operation has completed successfully,
542 // op.Done will return true, and the response of the operation is returned.
543 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
544 func (op *DeleteInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
545 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
546 return op.lro.Poll(ctx, nil, opts...)
547 }
548
549 // Metadata returns metadata associated with the long-running operation.
550 // Metadata itself does not contact the server, but Poll does.
551 // To get the latest metadata, call this method after a successful call to Poll.
552 // If the metadata is not available, the returned metadata and error are both nil.
553 func (op *DeleteInstanceOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
554 var meta alloydbpb.OperationMetadata
555 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
556 return nil, nil
557 } else if err != nil {
558 return nil, err
559 }
560 return &meta, nil
561 }
562
563 // Done reports whether the long-running operation has completed.
564 func (op *DeleteInstanceOperation) Done() bool {
565 return op.lro.Done()
566 }
567
568 // Name returns the name of the long-running operation.
569 // The name is assigned by the server and is unique within the service from which the operation is created.
570 func (op *DeleteInstanceOperation) Name() string {
571 return op.lro.Name()
572 }
573
574 // ExportClusterOperation manages a long-running operation from ExportCluster.
575 type ExportClusterOperation struct {
576 lro *longrunning.Operation
577 pollPath string
578 }
579
580 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
581 //
582 // See documentation of Poll for error-handling information.
583 func (op *ExportClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.ExportClusterResponse, error) {
584 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
585 var resp alloydbpb.ExportClusterResponse
586 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
587 return nil, err
588 }
589 return &resp, nil
590 }
591
592 // Poll fetches the latest state of the long-running operation.
593 //
594 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
595 //
596 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
597 // the operation has completed with failure, the error is returned and op.Done will return true.
598 // If Poll succeeds and the operation has completed successfully,
599 // op.Done will return true, and the response of the operation is returned.
600 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
601 func (op *ExportClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.ExportClusterResponse, error) {
602 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
603 var resp alloydbpb.ExportClusterResponse
604 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
605 return nil, err
606 }
607 if !op.Done() {
608 return nil, nil
609 }
610 return &resp, nil
611 }
612
613 // Metadata returns metadata associated with the long-running operation.
614 // Metadata itself does not contact the server, but Poll does.
615 // To get the latest metadata, call this method after a successful call to Poll.
616 // If the metadata is not available, the returned metadata and error are both nil.
617 func (op *ExportClusterOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
618 var meta alloydbpb.OperationMetadata
619 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
620 return nil, nil
621 } else if err != nil {
622 return nil, err
623 }
624 return &meta, nil
625 }
626
627 // Done reports whether the long-running operation has completed.
628 func (op *ExportClusterOperation) Done() bool {
629 return op.lro.Done()
630 }
631
632 // Name returns the name of the long-running operation.
633 // The name is assigned by the server and is unique within the service from which the operation is created.
634 func (op *ExportClusterOperation) Name() string {
635 return op.lro.Name()
636 }
637
638 // FailoverInstanceOperation manages a long-running operation from FailoverInstance.
639 type FailoverInstanceOperation struct {
640 lro *longrunning.Operation
641 pollPath string
642 }
643
644 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
645 //
646 // See documentation of Poll for error-handling information.
647 func (op *FailoverInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Instance, error) {
648 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
649 var resp alloydbpb.Instance
650 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
651 return nil, err
652 }
653 return &resp, nil
654 }
655
656 // Poll fetches the latest state of the long-running operation.
657 //
658 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
659 //
660 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
661 // the operation has completed with failure, the error is returned and op.Done will return true.
662 // If Poll succeeds and the operation has completed successfully,
663 // op.Done will return true, and the response of the operation is returned.
664 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
665 func (op *FailoverInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Instance, error) {
666 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
667 var resp alloydbpb.Instance
668 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
669 return nil, err
670 }
671 if !op.Done() {
672 return nil, nil
673 }
674 return &resp, nil
675 }
676
677 // Metadata returns metadata associated with the long-running operation.
678 // Metadata itself does not contact the server, but Poll does.
679 // To get the latest metadata, call this method after a successful call to Poll.
680 // If the metadata is not available, the returned metadata and error are both nil.
681 func (op *FailoverInstanceOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
682 var meta alloydbpb.OperationMetadata
683 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
684 return nil, nil
685 } else if err != nil {
686 return nil, err
687 }
688 return &meta, nil
689 }
690
691 // Done reports whether the long-running operation has completed.
692 func (op *FailoverInstanceOperation) Done() bool {
693 return op.lro.Done()
694 }
695
696 // Name returns the name of the long-running operation.
697 // The name is assigned by the server and is unique within the service from which the operation is created.
698 func (op *FailoverInstanceOperation) Name() string {
699 return op.lro.Name()
700 }
701
702 // ImportClusterOperation manages a long-running operation from ImportCluster.
703 type ImportClusterOperation struct {
704 lro *longrunning.Operation
705 pollPath string
706 }
707
708 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
709 //
710 // See documentation of Poll for error-handling information.
711 func (op *ImportClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.ImportClusterResponse, error) {
712 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
713 var resp alloydbpb.ImportClusterResponse
714 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
715 return nil, err
716 }
717 return &resp, nil
718 }
719
720 // Poll fetches the latest state of the long-running operation.
721 //
722 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
723 //
724 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
725 // the operation has completed with failure, the error is returned and op.Done will return true.
726 // If Poll succeeds and the operation has completed successfully,
727 // op.Done will return true, and the response of the operation is returned.
728 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
729 func (op *ImportClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.ImportClusterResponse, error) {
730 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
731 var resp alloydbpb.ImportClusterResponse
732 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
733 return nil, err
734 }
735 if !op.Done() {
736 return nil, nil
737 }
738 return &resp, nil
739 }
740
741 // Metadata returns metadata associated with the long-running operation.
742 // Metadata itself does not contact the server, but Poll does.
743 // To get the latest metadata, call this method after a successful call to Poll.
744 // If the metadata is not available, the returned metadata and error are both nil.
745 func (op *ImportClusterOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
746 var meta alloydbpb.OperationMetadata
747 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
748 return nil, nil
749 } else if err != nil {
750 return nil, err
751 }
752 return &meta, nil
753 }
754
755 // Done reports whether the long-running operation has completed.
756 func (op *ImportClusterOperation) Done() bool {
757 return op.lro.Done()
758 }
759
760 // Name returns the name of the long-running operation.
761 // The name is assigned by the server and is unique within the service from which the operation is created.
762 func (op *ImportClusterOperation) Name() string {
763 return op.lro.Name()
764 }
765
766 // InjectFaultOperation manages a long-running operation from InjectFault.
767 type InjectFaultOperation struct {
768 lro *longrunning.Operation
769 pollPath string
770 }
771
772 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
773 //
774 // See documentation of Poll for error-handling information.
775 func (op *InjectFaultOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Instance, error) {
776 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
777 var resp alloydbpb.Instance
778 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
779 return nil, err
780 }
781 return &resp, nil
782 }
783
784 // Poll fetches the latest state of the long-running operation.
785 //
786 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
787 //
788 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
789 // the operation has completed with failure, the error is returned and op.Done will return true.
790 // If Poll succeeds and the operation has completed successfully,
791 // op.Done will return true, and the response of the operation is returned.
792 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
793 func (op *InjectFaultOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Instance, error) {
794 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
795 var resp alloydbpb.Instance
796 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
797 return nil, err
798 }
799 if !op.Done() {
800 return nil, nil
801 }
802 return &resp, nil
803 }
804
805 // Metadata returns metadata associated with the long-running operation.
806 // Metadata itself does not contact the server, but Poll does.
807 // To get the latest metadata, call this method after a successful call to Poll.
808 // If the metadata is not available, the returned metadata and error are both nil.
809 func (op *InjectFaultOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
810 var meta alloydbpb.OperationMetadata
811 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
812 return nil, nil
813 } else if err != nil {
814 return nil, err
815 }
816 return &meta, nil
817 }
818
819 // Done reports whether the long-running operation has completed.
820 func (op *InjectFaultOperation) Done() bool {
821 return op.lro.Done()
822 }
823
824 // Name returns the name of the long-running operation.
825 // The name is assigned by the server and is unique within the service from which the operation is created.
826 func (op *InjectFaultOperation) Name() string {
827 return op.lro.Name()
828 }
829
830 // PromoteClusterOperation manages a long-running operation from PromoteCluster.
831 type PromoteClusterOperation struct {
832 lro *longrunning.Operation
833 pollPath string
834 }
835
836 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
837 //
838 // See documentation of Poll for error-handling information.
839 func (op *PromoteClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Cluster, error) {
840 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
841 var resp alloydbpb.Cluster
842 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
843 return nil, err
844 }
845 return &resp, nil
846 }
847
848 // Poll fetches the latest state of the long-running operation.
849 //
850 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
851 //
852 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
853 // the operation has completed with failure, the error is returned and op.Done will return true.
854 // If Poll succeeds and the operation has completed successfully,
855 // op.Done will return true, and the response of the operation is returned.
856 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
857 func (op *PromoteClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Cluster, error) {
858 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
859 var resp alloydbpb.Cluster
860 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
861 return nil, err
862 }
863 if !op.Done() {
864 return nil, nil
865 }
866 return &resp, nil
867 }
868
869 // Metadata returns metadata associated with the long-running operation.
870 // Metadata itself does not contact the server, but Poll does.
871 // To get the latest metadata, call this method after a successful call to Poll.
872 // If the metadata is not available, the returned metadata and error are both nil.
873 func (op *PromoteClusterOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
874 var meta alloydbpb.OperationMetadata
875 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
876 return nil, nil
877 } else if err != nil {
878 return nil, err
879 }
880 return &meta, nil
881 }
882
883 // Done reports whether the long-running operation has completed.
884 func (op *PromoteClusterOperation) Done() bool {
885 return op.lro.Done()
886 }
887
888 // Name returns the name of the long-running operation.
889 // The name is assigned by the server and is unique within the service from which the operation is created.
890 func (op *PromoteClusterOperation) Name() string {
891 return op.lro.Name()
892 }
893
894 // RestartInstanceOperation manages a long-running operation from RestartInstance.
895 type RestartInstanceOperation struct {
896 lro *longrunning.Operation
897 pollPath string
898 }
899
900 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
901 //
902 // See documentation of Poll for error-handling information.
903 func (op *RestartInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Instance, error) {
904 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
905 var resp alloydbpb.Instance
906 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
907 return nil, err
908 }
909 return &resp, nil
910 }
911
912 // Poll fetches the latest state of the long-running operation.
913 //
914 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
915 //
916 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
917 // the operation has completed with failure, the error is returned and op.Done will return true.
918 // If Poll succeeds and the operation has completed successfully,
919 // op.Done will return true, and the response of the operation is returned.
920 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
921 func (op *RestartInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Instance, error) {
922 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
923 var resp alloydbpb.Instance
924 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
925 return nil, err
926 }
927 if !op.Done() {
928 return nil, nil
929 }
930 return &resp, nil
931 }
932
933 // Metadata returns metadata associated with the long-running operation.
934 // Metadata itself does not contact the server, but Poll does.
935 // To get the latest metadata, call this method after a successful call to Poll.
936 // If the metadata is not available, the returned metadata and error are both nil.
937 func (op *RestartInstanceOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
938 var meta alloydbpb.OperationMetadata
939 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
940 return nil, nil
941 } else if err != nil {
942 return nil, err
943 }
944 return &meta, nil
945 }
946
947 // Done reports whether the long-running operation has completed.
948 func (op *RestartInstanceOperation) Done() bool {
949 return op.lro.Done()
950 }
951
952 // Name returns the name of the long-running operation.
953 // The name is assigned by the server and is unique within the service from which the operation is created.
954 func (op *RestartInstanceOperation) Name() string {
955 return op.lro.Name()
956 }
957
958 // RestoreClusterOperation manages a long-running operation from RestoreCluster.
959 type RestoreClusterOperation struct {
960 lro *longrunning.Operation
961 pollPath string
962 }
963
964 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
965 //
966 // See documentation of Poll for error-handling information.
967 func (op *RestoreClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Cluster, error) {
968 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
969 var resp alloydbpb.Cluster
970 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
971 return nil, err
972 }
973 return &resp, nil
974 }
975
976 // Poll fetches the latest state of the long-running operation.
977 //
978 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
979 //
980 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
981 // the operation has completed with failure, the error is returned and op.Done will return true.
982 // If Poll succeeds and the operation has completed successfully,
983 // op.Done will return true, and the response of the operation is returned.
984 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
985 func (op *RestoreClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Cluster, error) {
986 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
987 var resp alloydbpb.Cluster
988 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
989 return nil, err
990 }
991 if !op.Done() {
992 return nil, nil
993 }
994 return &resp, nil
995 }
996
997 // Metadata returns metadata associated with the long-running operation.
998 // Metadata itself does not contact the server, but Poll does.
999 // To get the latest metadata, call this method after a successful call to Poll.
1000 // If the metadata is not available, the returned metadata and error are both nil.
1001 func (op *RestoreClusterOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
1002 var meta alloydbpb.OperationMetadata
1003 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
1004 return nil, nil
1005 } else if err != nil {
1006 return nil, err
1007 }
1008 return &meta, nil
1009 }
1010
1011 // Done reports whether the long-running operation has completed.
1012 func (op *RestoreClusterOperation) Done() bool {
1013 return op.lro.Done()
1014 }
1015
1016 // Name returns the name of the long-running operation.
1017 // The name is assigned by the server and is unique within the service from which the operation is created.
1018 func (op *RestoreClusterOperation) Name() string {
1019 return op.lro.Name()
1020 }
1021
1022 // RestoreFromCloudSQLOperation manages a long-running operation from RestoreFromCloudSQL.
1023 type RestoreFromCloudSQLOperation struct {
1024 lro *longrunning.Operation
1025 pollPath string
1026 }
1027
1028 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
1029 //
1030 // See documentation of Poll for error-handling information.
1031 func (op *RestoreFromCloudSQLOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Cluster, error) {
1032 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
1033 var resp alloydbpb.Cluster
1034 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
1035 return nil, err
1036 }
1037 return &resp, nil
1038 }
1039
1040 // Poll fetches the latest state of the long-running operation.
1041 //
1042 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
1043 //
1044 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
1045 // the operation has completed with failure, the error is returned and op.Done will return true.
1046 // If Poll succeeds and the operation has completed successfully,
1047 // op.Done will return true, and the response of the operation is returned.
1048 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
1049 func (op *RestoreFromCloudSQLOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Cluster, error) {
1050 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
1051 var resp alloydbpb.Cluster
1052 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
1053 return nil, err
1054 }
1055 if !op.Done() {
1056 return nil, nil
1057 }
1058 return &resp, nil
1059 }
1060
1061 // Metadata returns metadata associated with the long-running operation.
1062 // Metadata itself does not contact the server, but Poll does.
1063 // To get the latest metadata, call this method after a successful call to Poll.
1064 // If the metadata is not available, the returned metadata and error are both nil.
1065 func (op *RestoreFromCloudSQLOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
1066 var meta alloydbpb.OperationMetadata
1067 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
1068 return nil, nil
1069 } else if err != nil {
1070 return nil, err
1071 }
1072 return &meta, nil
1073 }
1074
1075 // Done reports whether the long-running operation has completed.
1076 func (op *RestoreFromCloudSQLOperation) Done() bool {
1077 return op.lro.Done()
1078 }
1079
1080 // Name returns the name of the long-running operation.
1081 // The name is assigned by the server and is unique within the service from which the operation is created.
1082 func (op *RestoreFromCloudSQLOperation) Name() string {
1083 return op.lro.Name()
1084 }
1085
1086 // SwitchoverClusterOperation manages a long-running operation from SwitchoverCluster.
1087 type SwitchoverClusterOperation struct {
1088 lro *longrunning.Operation
1089 pollPath string
1090 }
1091
1092 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
1093 //
1094 // See documentation of Poll for error-handling information.
1095 func (op *SwitchoverClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Cluster, error) {
1096 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
1097 var resp alloydbpb.Cluster
1098 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
1099 return nil, err
1100 }
1101 return &resp, nil
1102 }
1103
1104 // Poll fetches the latest state of the long-running operation.
1105 //
1106 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
1107 //
1108 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
1109 // the operation has completed with failure, the error is returned and op.Done will return true.
1110 // If Poll succeeds and the operation has completed successfully,
1111 // op.Done will return true, and the response of the operation is returned.
1112 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
1113 func (op *SwitchoverClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Cluster, error) {
1114 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
1115 var resp alloydbpb.Cluster
1116 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
1117 return nil, err
1118 }
1119 if !op.Done() {
1120 return nil, nil
1121 }
1122 return &resp, nil
1123 }
1124
1125 // Metadata returns metadata associated with the long-running operation.
1126 // Metadata itself does not contact the server, but Poll does.
1127 // To get the latest metadata, call this method after a successful call to Poll.
1128 // If the metadata is not available, the returned metadata and error are both nil.
1129 func (op *SwitchoverClusterOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
1130 var meta alloydbpb.OperationMetadata
1131 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
1132 return nil, nil
1133 } else if err != nil {
1134 return nil, err
1135 }
1136 return &meta, nil
1137 }
1138
1139 // Done reports whether the long-running operation has completed.
1140 func (op *SwitchoverClusterOperation) Done() bool {
1141 return op.lro.Done()
1142 }
1143
1144 // Name returns the name of the long-running operation.
1145 // The name is assigned by the server and is unique within the service from which the operation is created.
1146 func (op *SwitchoverClusterOperation) Name() string {
1147 return op.lro.Name()
1148 }
1149
1150 // UpdateBackupOperation manages a long-running operation from UpdateBackup.
1151 type UpdateBackupOperation struct {
1152 lro *longrunning.Operation
1153 pollPath string
1154 }
1155
1156 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
1157 //
1158 // See documentation of Poll for error-handling information.
1159 func (op *UpdateBackupOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Backup, error) {
1160 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
1161 var resp alloydbpb.Backup
1162 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
1163 return nil, err
1164 }
1165 return &resp, nil
1166 }
1167
1168 // Poll fetches the latest state of the long-running operation.
1169 //
1170 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
1171 //
1172 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
1173 // the operation has completed with failure, the error is returned and op.Done will return true.
1174 // If Poll succeeds and the operation has completed successfully,
1175 // op.Done will return true, and the response of the operation is returned.
1176 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
1177 func (op *UpdateBackupOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Backup, error) {
1178 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
1179 var resp alloydbpb.Backup
1180 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
1181 return nil, err
1182 }
1183 if !op.Done() {
1184 return nil, nil
1185 }
1186 return &resp, nil
1187 }
1188
1189 // Metadata returns metadata associated with the long-running operation.
1190 // Metadata itself does not contact the server, but Poll does.
1191 // To get the latest metadata, call this method after a successful call to Poll.
1192 // If the metadata is not available, the returned metadata and error are both nil.
1193 func (op *UpdateBackupOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
1194 var meta alloydbpb.OperationMetadata
1195 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
1196 return nil, nil
1197 } else if err != nil {
1198 return nil, err
1199 }
1200 return &meta, nil
1201 }
1202
1203 // Done reports whether the long-running operation has completed.
1204 func (op *UpdateBackupOperation) Done() bool {
1205 return op.lro.Done()
1206 }
1207
1208 // Name returns the name of the long-running operation.
1209 // The name is assigned by the server and is unique within the service from which the operation is created.
1210 func (op *UpdateBackupOperation) Name() string {
1211 return op.lro.Name()
1212 }
1213
1214 // UpdateClusterOperation manages a long-running operation from UpdateCluster.
1215 type UpdateClusterOperation struct {
1216 lro *longrunning.Operation
1217 pollPath string
1218 }
1219
1220 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
1221 //
1222 // See documentation of Poll for error-handling information.
1223 func (op *UpdateClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Cluster, error) {
1224 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
1225 var resp alloydbpb.Cluster
1226 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
1227 return nil, err
1228 }
1229 return &resp, nil
1230 }
1231
1232 // Poll fetches the latest state of the long-running operation.
1233 //
1234 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
1235 //
1236 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
1237 // the operation has completed with failure, the error is returned and op.Done will return true.
1238 // If Poll succeeds and the operation has completed successfully,
1239 // op.Done will return true, and the response of the operation is returned.
1240 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
1241 func (op *UpdateClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Cluster, error) {
1242 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
1243 var resp alloydbpb.Cluster
1244 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
1245 return nil, err
1246 }
1247 if !op.Done() {
1248 return nil, nil
1249 }
1250 return &resp, nil
1251 }
1252
1253 // Metadata returns metadata associated with the long-running operation.
1254 // Metadata itself does not contact the server, but Poll does.
1255 // To get the latest metadata, call this method after a successful call to Poll.
1256 // If the metadata is not available, the returned metadata and error are both nil.
1257 func (op *UpdateClusterOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
1258 var meta alloydbpb.OperationMetadata
1259 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
1260 return nil, nil
1261 } else if err != nil {
1262 return nil, err
1263 }
1264 return &meta, nil
1265 }
1266
1267 // Done reports whether the long-running operation has completed.
1268 func (op *UpdateClusterOperation) Done() bool {
1269 return op.lro.Done()
1270 }
1271
1272 // Name returns the name of the long-running operation.
1273 // The name is assigned by the server and is unique within the service from which the operation is created.
1274 func (op *UpdateClusterOperation) Name() string {
1275 return op.lro.Name()
1276 }
1277
1278 // UpdateInstanceOperation manages a long-running operation from UpdateInstance.
1279 type UpdateInstanceOperation struct {
1280 lro *longrunning.Operation
1281 pollPath string
1282 }
1283
1284 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
1285 //
1286 // See documentation of Poll for error-handling information.
1287 func (op *UpdateInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Instance, error) {
1288 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
1289 var resp alloydbpb.Instance
1290 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
1291 return nil, err
1292 }
1293 return &resp, nil
1294 }
1295
1296 // Poll fetches the latest state of the long-running operation.
1297 //
1298 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
1299 //
1300 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
1301 // the operation has completed with failure, the error is returned and op.Done will return true.
1302 // If Poll succeeds and the operation has completed successfully,
1303 // op.Done will return true, and the response of the operation is returned.
1304 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
1305 func (op *UpdateInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Instance, error) {
1306 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
1307 var resp alloydbpb.Instance
1308 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
1309 return nil, err
1310 }
1311 if !op.Done() {
1312 return nil, nil
1313 }
1314 return &resp, nil
1315 }
1316
1317 // Metadata returns metadata associated with the long-running operation.
1318 // Metadata itself does not contact the server, but Poll does.
1319 // To get the latest metadata, call this method after a successful call to Poll.
1320 // If the metadata is not available, the returned metadata and error are both nil.
1321 func (op *UpdateInstanceOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
1322 var meta alloydbpb.OperationMetadata
1323 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
1324 return nil, nil
1325 } else if err != nil {
1326 return nil, err
1327 }
1328 return &meta, nil
1329 }
1330
1331 // Done reports whether the long-running operation has completed.
1332 func (op *UpdateInstanceOperation) Done() bool {
1333 return op.lro.Done()
1334 }
1335
1336 // Name returns the name of the long-running operation.
1337 // The name is assigned by the server and is unique within the service from which the operation is created.
1338 func (op *UpdateInstanceOperation) Name() string {
1339 return op.lro.Name()
1340 }
1341
1342 // UpgradeClusterOperation manages a long-running operation from UpgradeCluster.
1343 type UpgradeClusterOperation struct {
1344 lro *longrunning.Operation
1345 pollPath string
1346 }
1347
1348 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
1349 //
1350 // See documentation of Poll for error-handling information.
1351 func (op *UpgradeClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.UpgradeClusterResponse, error) {
1352 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
1353 var resp alloydbpb.UpgradeClusterResponse
1354 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
1355 return nil, err
1356 }
1357 return &resp, nil
1358 }
1359
1360 // Poll fetches the latest state of the long-running operation.
1361 //
1362 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
1363 //
1364 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
1365 // the operation has completed with failure, the error is returned and op.Done will return true.
1366 // If Poll succeeds and the operation has completed successfully,
1367 // op.Done will return true, and the response of the operation is returned.
1368 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
1369 func (op *UpgradeClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.UpgradeClusterResponse, error) {
1370 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
1371 var resp alloydbpb.UpgradeClusterResponse
1372 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
1373 return nil, err
1374 }
1375 if !op.Done() {
1376 return nil, nil
1377 }
1378 return &resp, nil
1379 }
1380
1381 // Metadata returns metadata associated with the long-running operation.
1382 // Metadata itself does not contact the server, but Poll does.
1383 // To get the latest metadata, call this method after a successful call to Poll.
1384 // If the metadata is not available, the returned metadata and error are both nil.
1385 func (op *UpgradeClusterOperation) Metadata() (*alloydbpb.OperationMetadata, error) {
1386 var meta alloydbpb.OperationMetadata
1387 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
1388 return nil, nil
1389 } else if err != nil {
1390 return nil, err
1391 }
1392 return &meta, nil
1393 }
1394
1395 // Done reports whether the long-running operation has completed.
1396 func (op *UpgradeClusterOperation) Done() bool {
1397 return op.lro.Done()
1398 }
1399
1400 // Name returns the name of the long-running operation.
1401 // The name is assigned by the server and is unique within the service from which the operation is created.
1402 func (op *UpgradeClusterOperation) Name() string {
1403 return op.lro.Name()
1404 }
1405
1406 // BackupIterator manages a stream of *alloydbpb.Backup.
1407 type BackupIterator struct {
1408 items []*alloydbpb.Backup
1409 pageInfo *iterator.PageInfo
1410 nextFunc func() error
1411
1412 // Response is the raw response for the current page.
1413 // It must be cast to the RPC response type.
1414 // Calling Next() or InternalFetch() updates this value.
1415 Response interface{}
1416
1417 // InternalFetch is for use by the Google Cloud Libraries only.
1418 // It is not part of the stable interface of this package.
1419 //
1420 // InternalFetch returns results from a single call to the underlying RPC.
1421 // The number of results is no greater than pageSize.
1422 // If there are no more results, nextPageToken is empty and err is nil.
1423 InternalFetch func(pageSize int, pageToken string) (results []*alloydbpb.Backup, nextPageToken string, err error)
1424 }
1425
1426 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
1427 func (it *BackupIterator) PageInfo() *iterator.PageInfo {
1428 return it.pageInfo
1429 }
1430
1431 // Next returns the next result. Its second return value is iterator.Done if there are no more
1432 // results. Once Next returns Done, all subsequent calls will return Done.
1433 func (it *BackupIterator) Next() (*alloydbpb.Backup, error) {
1434 var item *alloydbpb.Backup
1435 if err := it.nextFunc(); err != nil {
1436 return item, err
1437 }
1438 item = it.items[0]
1439 it.items = it.items[1:]
1440 return item, nil
1441 }
1442
1443 func (it *BackupIterator) bufLen() int {
1444 return len(it.items)
1445 }
1446
1447 func (it *BackupIterator) takeBuf() interface{} {
1448 b := it.items
1449 it.items = nil
1450 return b
1451 }
1452
1453 // ClusterIterator manages a stream of *alloydbpb.Cluster.
1454 type ClusterIterator struct {
1455 items []*alloydbpb.Cluster
1456 pageInfo *iterator.PageInfo
1457 nextFunc func() error
1458
1459 // Response is the raw response for the current page.
1460 // It must be cast to the RPC response type.
1461 // Calling Next() or InternalFetch() updates this value.
1462 Response interface{}
1463
1464 // InternalFetch is for use by the Google Cloud Libraries only.
1465 // It is not part of the stable interface of this package.
1466 //
1467 // InternalFetch returns results from a single call to the underlying RPC.
1468 // The number of results is no greater than pageSize.
1469 // If there are no more results, nextPageToken is empty and err is nil.
1470 InternalFetch func(pageSize int, pageToken string) (results []*alloydbpb.Cluster, nextPageToken string, err error)
1471 }
1472
1473 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
1474 func (it *ClusterIterator) PageInfo() *iterator.PageInfo {
1475 return it.pageInfo
1476 }
1477
1478 // Next returns the next result. Its second return value is iterator.Done if there are no more
1479 // results. Once Next returns Done, all subsequent calls will return Done.
1480 func (it *ClusterIterator) Next() (*alloydbpb.Cluster, error) {
1481 var item *alloydbpb.Cluster
1482 if err := it.nextFunc(); err != nil {
1483 return item, err
1484 }
1485 item = it.items[0]
1486 it.items = it.items[1:]
1487 return item, nil
1488 }
1489
1490 func (it *ClusterIterator) bufLen() int {
1491 return len(it.items)
1492 }
1493
1494 func (it *ClusterIterator) takeBuf() interface{} {
1495 b := it.items
1496 it.items = nil
1497 return b
1498 }
1499
1500 // DatabaseIterator manages a stream of *alloydbpb.Database.
1501 type DatabaseIterator struct {
1502 items []*alloydbpb.Database
1503 pageInfo *iterator.PageInfo
1504 nextFunc func() error
1505
1506 // Response is the raw response for the current page.
1507 // It must be cast to the RPC response type.
1508 // Calling Next() or InternalFetch() updates this value.
1509 Response interface{}
1510
1511 // InternalFetch is for use by the Google Cloud Libraries only.
1512 // It is not part of the stable interface of this package.
1513 //
1514 // InternalFetch returns results from a single call to the underlying RPC.
1515 // The number of results is no greater than pageSize.
1516 // If there are no more results, nextPageToken is empty and err is nil.
1517 InternalFetch func(pageSize int, pageToken string) (results []*alloydbpb.Database, nextPageToken string, err error)
1518 }
1519
1520 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
1521 func (it *DatabaseIterator) PageInfo() *iterator.PageInfo {
1522 return it.pageInfo
1523 }
1524
1525 // Next returns the next result. Its second return value is iterator.Done if there are no more
1526 // results. Once Next returns Done, all subsequent calls will return Done.
1527 func (it *DatabaseIterator) Next() (*alloydbpb.Database, error) {
1528 var item *alloydbpb.Database
1529 if err := it.nextFunc(); err != nil {
1530 return item, err
1531 }
1532 item = it.items[0]
1533 it.items = it.items[1:]
1534 return item, nil
1535 }
1536
1537 func (it *DatabaseIterator) bufLen() int {
1538 return len(it.items)
1539 }
1540
1541 func (it *DatabaseIterator) takeBuf() interface{} {
1542 b := it.items
1543 it.items = nil
1544 return b
1545 }
1546
1547 // InstanceIterator manages a stream of *alloydbpb.Instance.
1548 type InstanceIterator struct {
1549 items []*alloydbpb.Instance
1550 pageInfo *iterator.PageInfo
1551 nextFunc func() error
1552
1553 // Response is the raw response for the current page.
1554 // It must be cast to the RPC response type.
1555 // Calling Next() or InternalFetch() updates this value.
1556 Response interface{}
1557
1558 // InternalFetch is for use by the Google Cloud Libraries only.
1559 // It is not part of the stable interface of this package.
1560 //
1561 // InternalFetch returns results from a single call to the underlying RPC.
1562 // The number of results is no greater than pageSize.
1563 // If there are no more results, nextPageToken is empty and err is nil.
1564 InternalFetch func(pageSize int, pageToken string) (results []*alloydbpb.Instance, nextPageToken string, err error)
1565 }
1566
1567 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
1568 func (it *InstanceIterator) PageInfo() *iterator.PageInfo {
1569 return it.pageInfo
1570 }
1571
1572 // Next returns the next result. Its second return value is iterator.Done if there are no more
1573 // results. Once Next returns Done, all subsequent calls will return Done.
1574 func (it *InstanceIterator) Next() (*alloydbpb.Instance, error) {
1575 var item *alloydbpb.Instance
1576 if err := it.nextFunc(); err != nil {
1577 return item, err
1578 }
1579 item = it.items[0]
1580 it.items = it.items[1:]
1581 return item, nil
1582 }
1583
1584 func (it *InstanceIterator) bufLen() int {
1585 return len(it.items)
1586 }
1587
1588 func (it *InstanceIterator) takeBuf() interface{} {
1589 b := it.items
1590 it.items = nil
1591 return b
1592 }
1593
1594 // LocationIterator manages a stream of *locationpb.Location.
1595 type LocationIterator struct {
1596 items []*locationpb.Location
1597 pageInfo *iterator.PageInfo
1598 nextFunc func() error
1599
1600 // Response is the raw response for the current page.
1601 // It must be cast to the RPC response type.
1602 // Calling Next() or InternalFetch() updates this value.
1603 Response interface{}
1604
1605 // InternalFetch is for use by the Google Cloud Libraries only.
1606 // It is not part of the stable interface of this package.
1607 //
1608 // InternalFetch returns results from a single call to the underlying RPC.
1609 // The number of results is no greater than pageSize.
1610 // If there are no more results, nextPageToken is empty and err is nil.
1611 InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error)
1612 }
1613
1614 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
1615 func (it *LocationIterator) PageInfo() *iterator.PageInfo {
1616 return it.pageInfo
1617 }
1618
1619 // Next returns the next result. Its second return value is iterator.Done if there are no more
1620 // results. Once Next returns Done, all subsequent calls will return Done.
1621 func (it *LocationIterator) Next() (*locationpb.Location, error) {
1622 var item *locationpb.Location
1623 if err := it.nextFunc(); err != nil {
1624 return item, err
1625 }
1626 item = it.items[0]
1627 it.items = it.items[1:]
1628 return item, nil
1629 }
1630
1631 func (it *LocationIterator) bufLen() int {
1632 return len(it.items)
1633 }
1634
1635 func (it *LocationIterator) takeBuf() interface{} {
1636 b := it.items
1637 it.items = nil
1638 return b
1639 }
1640
1641 // OperationIterator manages a stream of *longrunningpb.Operation.
1642 type OperationIterator struct {
1643 items []*longrunningpb.Operation
1644 pageInfo *iterator.PageInfo
1645 nextFunc func() error
1646
1647 // Response is the raw response for the current page.
1648 // It must be cast to the RPC response type.
1649 // Calling Next() or InternalFetch() updates this value.
1650 Response interface{}
1651
1652 // InternalFetch is for use by the Google Cloud Libraries only.
1653 // It is not part of the stable interface of this package.
1654 //
1655 // InternalFetch returns results from a single call to the underlying RPC.
1656 // The number of results is no greater than pageSize.
1657 // If there are no more results, nextPageToken is empty and err is nil.
1658 InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error)
1659 }
1660
1661 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
1662 func (it *OperationIterator) PageInfo() *iterator.PageInfo {
1663 return it.pageInfo
1664 }
1665
1666 // Next returns the next result. Its second return value is iterator.Done if there are no more
1667 // results. Once Next returns Done, all subsequent calls will return Done.
1668 func (it *OperationIterator) Next() (*longrunningpb.Operation, error) {
1669 var item *longrunningpb.Operation
1670 if err := it.nextFunc(); err != nil {
1671 return item, err
1672 }
1673 item = it.items[0]
1674 it.items = it.items[1:]
1675 return item, nil
1676 }
1677
1678 func (it *OperationIterator) bufLen() int {
1679 return len(it.items)
1680 }
1681
1682 func (it *OperationIterator) takeBuf() interface{} {
1683 b := it.items
1684 it.items = nil
1685 return b
1686 }
1687
1688 // SupportedDatabaseFlagIterator manages a stream of *alloydbpb.SupportedDatabaseFlag.
1689 type SupportedDatabaseFlagIterator struct {
1690 items []*alloydbpb.SupportedDatabaseFlag
1691 pageInfo *iterator.PageInfo
1692 nextFunc func() error
1693
1694 // Response is the raw response for the current page.
1695 // It must be cast to the RPC response type.
1696 // Calling Next() or InternalFetch() updates this value.
1697 Response interface{}
1698
1699 // InternalFetch is for use by the Google Cloud Libraries only.
1700 // It is not part of the stable interface of this package.
1701 //
1702 // InternalFetch returns results from a single call to the underlying RPC.
1703 // The number of results is no greater than pageSize.
1704 // If there are no more results, nextPageToken is empty and err is nil.
1705 InternalFetch func(pageSize int, pageToken string) (results []*alloydbpb.SupportedDatabaseFlag, nextPageToken string, err error)
1706 }
1707
1708 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
1709 func (it *SupportedDatabaseFlagIterator) PageInfo() *iterator.PageInfo {
1710 return it.pageInfo
1711 }
1712
1713 // Next returns the next result. Its second return value is iterator.Done if there are no more
1714 // results. Once Next returns Done, all subsequent calls will return Done.
1715 func (it *SupportedDatabaseFlagIterator) Next() (*alloydbpb.SupportedDatabaseFlag, error) {
1716 var item *alloydbpb.SupportedDatabaseFlag
1717 if err := it.nextFunc(); err != nil {
1718 return item, err
1719 }
1720 item = it.items[0]
1721 it.items = it.items[1:]
1722 return item, nil
1723 }
1724
1725 func (it *SupportedDatabaseFlagIterator) bufLen() int {
1726 return len(it.items)
1727 }
1728
1729 func (it *SupportedDatabaseFlagIterator) takeBuf() interface{} {
1730 b := it.items
1731 it.items = nil
1732 return b
1733 }
1734
1735 // UserIterator manages a stream of *alloydbpb.User.
1736 type UserIterator struct {
1737 items []*alloydbpb.User
1738 pageInfo *iterator.PageInfo
1739 nextFunc func() error
1740
1741 // Response is the raw response for the current page.
1742 // It must be cast to the RPC response type.
1743 // Calling Next() or InternalFetch() updates this value.
1744 Response interface{}
1745
1746 // InternalFetch is for use by the Google Cloud Libraries only.
1747 // It is not part of the stable interface of this package.
1748 //
1749 // InternalFetch returns results from a single call to the underlying RPC.
1750 // The number of results is no greater than pageSize.
1751 // If there are no more results, nextPageToken is empty and err is nil.
1752 InternalFetch func(pageSize int, pageToken string) (results []*alloydbpb.User, nextPageToken string, err error)
1753 }
1754
1755 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
1756 func (it *UserIterator) PageInfo() *iterator.PageInfo {
1757 return it.pageInfo
1758 }
1759
1760 // Next returns the next result. Its second return value is iterator.Done if there are no more
1761 // results. Once Next returns Done, all subsequent calls will return Done.
1762 func (it *UserIterator) Next() (*alloydbpb.User, error) {
1763 var item *alloydbpb.User
1764 if err := it.nextFunc(); err != nil {
1765 return item, err
1766 }
1767 item = it.items[0]
1768 it.items = it.items[1:]
1769 return item, nil
1770 }
1771
1772 func (it *UserIterator) bufLen() int {
1773 return len(it.items)
1774 }
1775
1776 func (it *UserIterator) takeBuf() interface{} {
1777 b := it.items
1778 it.items = nil
1779 return b
1780 }