Debian Codegraph @

metastore/apiv1/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 metastore
18
19 import (
20 "context"
21 "time"
22
23 "cloud.google.com/go/longrunning"
24 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
25 metastorepb "cloud.google.com/go/metastore/apiv1/metastorepb"
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 // AlterMetadataResourceLocationOperation manages a long-running operation from AlterMetadataResourceLocation.
32 type AlterMetadataResourceLocationOperation 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 *AlterMetadataResourceLocationOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.AlterMetadataResourceLocationResponse, error) {
41 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
42 var resp metastorepb.AlterMetadataResourceLocationResponse
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 *AlterMetadataResourceLocationOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.AlterMetadataResourceLocationResponse, error) {
59 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
60 var resp metastorepb.AlterMetadataResourceLocationResponse
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 *AlterMetadataResourceLocationOperation) Metadata() (*metastorepb.OperationMetadata, error) {
75 var meta metastorepb.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 *AlterMetadataResourceLocationOperation) 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 *AlterMetadataResourceLocationOperation) 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) (*metastorepb.Backup, error) {
105 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
106 var resp metastorepb.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) (*metastorepb.Backup, error) {
123 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
124 var resp metastorepb.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() (*metastorepb.OperationMetadata, error) {
139 var meta metastorepb.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 // CreateFederationOperation manages a long-running operation from CreateFederation.
160 type CreateFederationOperation 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 *CreateFederationOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Federation, error) {
169 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
170 var resp metastorepb.Federation
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 *CreateFederationOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Federation, error) {
187 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
188 var resp metastorepb.Federation
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 *CreateFederationOperation) Metadata() (*metastorepb.OperationMetadata, error) {
203 var meta metastorepb.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 *CreateFederationOperation) 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 *CreateFederationOperation) Name() string {
220 return op.lro.Name()
221 }
222
223 // CreateMetadataImportOperation manages a long-running operation from CreateMetadataImport.
224 type CreateMetadataImportOperation 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 *CreateMetadataImportOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.MetadataImport, error) {
233 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
234 var resp metastorepb.MetadataImport
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 *CreateMetadataImportOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.MetadataImport, error) {
251 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
252 var resp metastorepb.MetadataImport
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 *CreateMetadataImportOperation) Metadata() (*metastorepb.OperationMetadata, error) {
267 var meta metastorepb.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 *CreateMetadataImportOperation) 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 *CreateMetadataImportOperation) Name() string {
284 return op.lro.Name()
285 }
286
287 // CreateServiceOperation manages a long-running operation from CreateService.
288 type CreateServiceOperation 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 *CreateServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Service, error) {
297 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
298 var resp metastorepb.Service
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 *CreateServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Service, error) {
315 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
316 var resp metastorepb.Service
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 *CreateServiceOperation) Metadata() (*metastorepb.OperationMetadata, error) {
331 var meta metastorepb.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 *CreateServiceOperation) 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 *CreateServiceOperation) Name() string {
348 return op.lro.Name()
349 }
350
351 // DeleteBackupOperation manages a long-running operation from DeleteBackup.
352 type DeleteBackupOperation 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 *DeleteBackupOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
361 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
362 return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
363 }
364
365 // Poll fetches the latest state of the long-running operation.
366 //
367 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
368 //
369 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
370 // the operation has completed with failure, the error is returned and op.Done will return true.
371 // If Poll succeeds and the operation has completed successfully,
372 // op.Done will return true, and the response of the operation is returned.
373 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
374 func (op *DeleteBackupOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
375 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
376 return op.lro.Poll(ctx, nil, opts...)
377 }
378
379 // Metadata returns metadata associated with the long-running operation.
380 // Metadata itself does not contact the server, but Poll does.
381 // To get the latest metadata, call this method after a successful call to Poll.
382 // If the metadata is not available, the returned metadata and error are both nil.
383 func (op *DeleteBackupOperation) Metadata() (*metastorepb.OperationMetadata, error) {
384 var meta metastorepb.OperationMetadata
385 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
386 return nil, nil
387 } else if err != nil {
388 return nil, err
389 }
390 return &meta, nil
391 }
392
393 // Done reports whether the long-running operation has completed.
394 func (op *DeleteBackupOperation) Done() bool {
395 return op.lro.Done()
396 }
397
398 // Name returns the name of the long-running operation.
399 // The name is assigned by the server and is unique within the service from which the operation is created.
400 func (op *DeleteBackupOperation) Name() string {
401 return op.lro.Name()
402 }
403
404 // DeleteFederationOperation manages a long-running operation from DeleteFederation.
405 type DeleteFederationOperation struct {
406 lro *longrunning.Operation
407 pollPath string
408 }
409
410 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
411 //
412 // See documentation of Poll for error-handling information.
413 func (op *DeleteFederationOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
414 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
415 return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
416 }
417
418 // Poll fetches the latest state of the long-running operation.
419 //
420 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
421 //
422 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
423 // the operation has completed with failure, the error is returned and op.Done will return true.
424 // If Poll succeeds and the operation has completed successfully,
425 // op.Done will return true, and the response of the operation is returned.
426 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
427 func (op *DeleteFederationOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
428 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
429 return op.lro.Poll(ctx, nil, opts...)
430 }
431
432 // Metadata returns metadata associated with the long-running operation.
433 // Metadata itself does not contact the server, but Poll does.
434 // To get the latest metadata, call this method after a successful call to Poll.
435 // If the metadata is not available, the returned metadata and error are both nil.
436 func (op *DeleteFederationOperation) Metadata() (*metastorepb.OperationMetadata, error) {
437 var meta metastorepb.OperationMetadata
438 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
439 return nil, nil
440 } else if err != nil {
441 return nil, err
442 }
443 return &meta, nil
444 }
445
446 // Done reports whether the long-running operation has completed.
447 func (op *DeleteFederationOperation) Done() bool {
448 return op.lro.Done()
449 }
450
451 // Name returns the name of the long-running operation.
452 // The name is assigned by the server and is unique within the service from which the operation is created.
453 func (op *DeleteFederationOperation) Name() string {
454 return op.lro.Name()
455 }
456
457 // DeleteServiceOperation manages a long-running operation from DeleteService.
458 type DeleteServiceOperation struct {
459 lro *longrunning.Operation
460 pollPath string
461 }
462
463 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
464 //
465 // See documentation of Poll for error-handling information.
466 func (op *DeleteServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
467 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
468 return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
469 }
470
471 // Poll fetches the latest state of the long-running operation.
472 //
473 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
474 //
475 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
476 // the operation has completed with failure, the error is returned and op.Done will return true.
477 // If Poll succeeds and the operation has completed successfully,
478 // op.Done will return true, and the response of the operation is returned.
479 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
480 func (op *DeleteServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
481 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
482 return op.lro.Poll(ctx, nil, opts...)
483 }
484
485 // Metadata returns metadata associated with the long-running operation.
486 // Metadata itself does not contact the server, but Poll does.
487 // To get the latest metadata, call this method after a successful call to Poll.
488 // If the metadata is not available, the returned metadata and error are both nil.
489 func (op *DeleteServiceOperation) Metadata() (*metastorepb.OperationMetadata, error) {
490 var meta metastorepb.OperationMetadata
491 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
492 return nil, nil
493 } else if err != nil {
494 return nil, err
495 }
496 return &meta, nil
497 }
498
499 // Done reports whether the long-running operation has completed.
500 func (op *DeleteServiceOperation) Done() bool {
501 return op.lro.Done()
502 }
503
504 // Name returns the name of the long-running operation.
505 // The name is assigned by the server and is unique within the service from which the operation is created.
506 func (op *DeleteServiceOperation) Name() string {
507 return op.lro.Name()
508 }
509
510 // ExportMetadataOperation manages a long-running operation from ExportMetadata.
511 type ExportMetadataOperation struct {
512 lro *longrunning.Operation
513 pollPath string
514 }
515
516 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
517 //
518 // See documentation of Poll for error-handling information.
519 func (op *ExportMetadataOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.MetadataExport, error) {
520 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
521 var resp metastorepb.MetadataExport
522 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
523 return nil, err
524 }
525 return &resp, nil
526 }
527
528 // Poll fetches the latest state of the long-running operation.
529 //
530 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
531 //
532 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
533 // the operation has completed with failure, the error is returned and op.Done will return true.
534 // If Poll succeeds and the operation has completed successfully,
535 // op.Done will return true, and the response of the operation is returned.
536 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
537 func (op *ExportMetadataOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.MetadataExport, error) {
538 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
539 var resp metastorepb.MetadataExport
540 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
541 return nil, err
542 }
543 if !op.Done() {
544 return nil, nil
545 }
546 return &resp, nil
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 *ExportMetadataOperation) Metadata() (*metastorepb.OperationMetadata, error) {
554 var meta metastorepb.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 *ExportMetadataOperation) 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 *ExportMetadataOperation) Name() string {
571 return op.lro.Name()
572 }
573
574 // MoveTableToDatabaseOperation manages a long-running operation from MoveTableToDatabase.
575 type MoveTableToDatabaseOperation 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 *MoveTableToDatabaseOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.MoveTableToDatabaseResponse, error) {
584 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
585 var resp metastorepb.MoveTableToDatabaseResponse
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 *MoveTableToDatabaseOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.MoveTableToDatabaseResponse, error) {
602 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
603 var resp metastorepb.MoveTableToDatabaseResponse
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 *MoveTableToDatabaseOperation) Metadata() (*metastorepb.OperationMetadata, error) {
618 var meta metastorepb.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 *MoveTableToDatabaseOperation) 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 *MoveTableToDatabaseOperation) Name() string {
635 return op.lro.Name()
636 }
637
638 // QueryMetadataOperation manages a long-running operation from QueryMetadata.
639 type QueryMetadataOperation 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 *QueryMetadataOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.QueryMetadataResponse, error) {
648 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
649 var resp metastorepb.QueryMetadataResponse
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 *QueryMetadataOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.QueryMetadataResponse, error) {
666 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
667 var resp metastorepb.QueryMetadataResponse
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 *QueryMetadataOperation) Metadata() (*metastorepb.OperationMetadata, error) {
682 var meta metastorepb.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 *QueryMetadataOperation) 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 *QueryMetadataOperation) Name() string {
699 return op.lro.Name()
700 }
701
702 // RestoreServiceOperation manages a long-running operation from RestoreService.
703 type RestoreServiceOperation 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 *RestoreServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Restore, error) {
712 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
713 var resp metastorepb.Restore
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 *RestoreServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Restore, error) {
730 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
731 var resp metastorepb.Restore
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 *RestoreServiceOperation) Metadata() (*metastorepb.OperationMetadata, error) {
746 var meta metastorepb.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 *RestoreServiceOperation) 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 *RestoreServiceOperation) Name() string {
763 return op.lro.Name()
764 }
765
766 // UpdateFederationOperation manages a long-running operation from UpdateFederation.
767 type UpdateFederationOperation 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 *UpdateFederationOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Federation, error) {
776 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
777 var resp metastorepb.Federation
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 *UpdateFederationOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Federation, error) {
794 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
795 var resp metastorepb.Federation
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 *UpdateFederationOperation) Metadata() (*metastorepb.OperationMetadata, error) {
810 var meta metastorepb.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 *UpdateFederationOperation) 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 *UpdateFederationOperation) Name() string {
827 return op.lro.Name()
828 }
829
830 // UpdateMetadataImportOperation manages a long-running operation from UpdateMetadataImport.
831 type UpdateMetadataImportOperation 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 *UpdateMetadataImportOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.MetadataImport, error) {
840 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
841 var resp metastorepb.MetadataImport
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 *UpdateMetadataImportOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.MetadataImport, error) {
858 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
859 var resp metastorepb.MetadataImport
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 *UpdateMetadataImportOperation) Metadata() (*metastorepb.OperationMetadata, error) {
874 var meta metastorepb.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 *UpdateMetadataImportOperation) 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 *UpdateMetadataImportOperation) Name() string {
891 return op.lro.Name()
892 }
893
894 // UpdateServiceOperation manages a long-running operation from UpdateService.
895 type UpdateServiceOperation 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 *UpdateServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Service, error) {
904 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
905 var resp metastorepb.Service
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 *UpdateServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Service, error) {
922 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
923 var resp metastorepb.Service
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 *UpdateServiceOperation) Metadata() (*metastorepb.OperationMetadata, error) {
938 var meta metastorepb.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 *UpdateServiceOperation) 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 *UpdateServiceOperation) Name() string {
955 return op.lro.Name()
956 }
957
958 // BackupIterator manages a stream of *metastorepb.Backup.
959 type BackupIterator struct {
960 items []*metastorepb.Backup
961 pageInfo *iterator.PageInfo
962 nextFunc func() error
963
964 // Response is the raw response for the current page.
965 // It must be cast to the RPC response type.
966 // Calling Next() or InternalFetch() updates this value.
967 Response interface{}
968
969 // InternalFetch is for use by the Google Cloud Libraries only.
970 // It is not part of the stable interface of this package.
971 //
972 // InternalFetch returns results from a single call to the underlying RPC.
973 // The number of results is no greater than pageSize.
974 // If there are no more results, nextPageToken is empty and err is nil.
975 InternalFetch func(pageSize int, pageToken string) (results []*metastorepb.Backup, nextPageToken string, err error)
976 }
977
978 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
979 func (it *BackupIterator) PageInfo() *iterator.PageInfo {
980 return it.pageInfo
981 }
982
983 // Next returns the next result. Its second return value is iterator.Done if there are no more
984 // results. Once Next returns Done, all subsequent calls will return Done.
985 func (it *BackupIterator) Next() (*metastorepb.Backup, error) {
986 var item *metastorepb.Backup
987 if err := it.nextFunc(); err != nil {
988 return item, err
989 }
990 item = it.items[0]
991 it.items = it.items[1:]
992 return item, nil
993 }
994
995 func (it *BackupIterator) bufLen() int {
996 return len(it.items)
997 }
998
999 func (it *BackupIterator) takeBuf() interface{} {
1000 b := it.items
1001 it.items = nil
1002 return b
1003 }
1004
1005 // FederationIterator manages a stream of *metastorepb.Federation.
1006 type FederationIterator struct {
1007 items []*metastorepb.Federation
1008 pageInfo *iterator.PageInfo
1009 nextFunc func() error
1010
1011 // Response is the raw response for the current page.
1012 // It must be cast to the RPC response type.
1013 // Calling Next() or InternalFetch() updates this value.
1014 Response interface{}
1015
1016 // InternalFetch is for use by the Google Cloud Libraries only.
1017 // It is not part of the stable interface of this package.
1018 //
1019 // InternalFetch returns results from a single call to the underlying RPC.
1020 // The number of results is no greater than pageSize.
1021 // If there are no more results, nextPageToken is empty and err is nil.
1022 InternalFetch func(pageSize int, pageToken string) (results []*metastorepb.Federation, nextPageToken string, err error)
1023 }
1024
1025 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
1026 func (it *FederationIterator) PageInfo() *iterator.PageInfo {
1027 return it.pageInfo
1028 }
1029
1030 // Next returns the next result. Its second return value is iterator.Done if there are no more
1031 // results. Once Next returns Done, all subsequent calls will return Done.
1032 func (it *FederationIterator) Next() (*metastorepb.Federation, error) {
1033 var item *metastorepb.Federation
1034 if err := it.nextFunc(); err != nil {
1035 return item, err
1036 }
1037 item = it.items[0]
1038 it.items = it.items[1:]
1039 return item, nil
1040 }
1041
1042 func (it *FederationIterator) bufLen() int {
1043 return len(it.items)
1044 }
1045
1046 func (it *FederationIterator) takeBuf() interface{} {
1047 b := it.items
1048 it.items = nil
1049 return b
1050 }
1051
1052 // LocationIterator manages a stream of *locationpb.Location.
1053 type LocationIterator struct {
1054 items []*locationpb.Location
1055 pageInfo *iterator.PageInfo
1056 nextFunc func() error
1057
1058 // Response is the raw response for the current page.
1059 // It must be cast to the RPC response type.
1060 // Calling Next() or InternalFetch() updates this value.
1061 Response interface{}
1062
1063 // InternalFetch is for use by the Google Cloud Libraries only.
1064 // It is not part of the stable interface of this package.
1065 //
1066 // InternalFetch returns results from a single call to the underlying RPC.
1067 // The number of results is no greater than pageSize.
1068 // If there are no more results, nextPageToken is empty and err is nil.
1069 InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error)
1070 }
1071
1072 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
1073 func (it *LocationIterator) PageInfo() *iterator.PageInfo {
1074 return it.pageInfo
1075 }
1076
1077 // Next returns the next result. Its second return value is iterator.Done if there are no more
1078 // results. Once Next returns Done, all subsequent calls will return Done.
1079 func (it *LocationIterator) Next() (*locationpb.Location, error) {
1080 var item *locationpb.Location
1081 if err := it.nextFunc(); err != nil {
1082 return item, err
1083 }
1084 item = it.items[0]
1085 it.items = it.items[1:]
1086 return item, nil
1087 }
1088
1089 func (it *LocationIterator) bufLen() int {
1090 return len(it.items)
1091 }
1092
1093 func (it *LocationIterator) takeBuf() interface{} {
1094 b := it.items
1095 it.items = nil
1096 return b
1097 }
1098
1099 // MetadataImportIterator manages a stream of *metastorepb.MetadataImport.
1100 type MetadataImportIterator struct {
1101 items []*metastorepb.MetadataImport
1102 pageInfo *iterator.PageInfo
1103 nextFunc func() error
1104
1105 // Response is the raw response for the current page.
1106 // It must be cast to the RPC response type.
1107 // Calling Next() or InternalFetch() updates this value.
1108 Response interface{}
1109
1110 // InternalFetch is for use by the Google Cloud Libraries only.
1111 // It is not part of the stable interface of this package.
1112 //
1113 // InternalFetch returns results from a single call to the underlying RPC.
1114 // The number of results is no greater than pageSize.
1115 // If there are no more results, nextPageToken is empty and err is nil.
1116 InternalFetch func(pageSize int, pageToken string) (results []*metastorepb.MetadataImport, nextPageToken string, err error)
1117 }
1118
1119 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
1120 func (it *MetadataImportIterator) PageInfo() *iterator.PageInfo {
1121 return it.pageInfo
1122 }
1123
1124 // Next returns the next result. Its second return value is iterator.Done if there are no more
1125 // results. Once Next returns Done, all subsequent calls will return Done.
1126 func (it *MetadataImportIterator) Next() (*metastorepb.MetadataImport, error) {
1127 var item *metastorepb.MetadataImport
1128 if err := it.nextFunc(); err != nil {
1129 return item, err
1130 }
1131 item = it.items[0]
1132 it.items = it.items[1:]
1133 return item, nil
1134 }
1135
1136 func (it *MetadataImportIterator) bufLen() int {
1137 return len(it.items)
1138 }
1139
1140 func (it *MetadataImportIterator) takeBuf() interface{} {
1141 b := it.items
1142 it.items = nil
1143 return b
1144 }
1145
1146 // OperationIterator manages a stream of *longrunningpb.Operation.
1147 type OperationIterator struct {
1148 items []*longrunningpb.Operation
1149 pageInfo *iterator.PageInfo
1150 nextFunc func() error
1151
1152 // Response is the raw response for the current page.
1153 // It must be cast to the RPC response type.
1154 // Calling Next() or InternalFetch() updates this value.
1155 Response interface{}
1156
1157 // InternalFetch is for use by the Google Cloud Libraries only.
1158 // It is not part of the stable interface of this package.
1159 //
1160 // InternalFetch returns results from a single call to the underlying RPC.
1161 // The number of results is no greater than pageSize.
1162 // If there are no more results, nextPageToken is empty and err is nil.
1163 InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error)
1164 }
1165
1166 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
1167 func (it *OperationIterator) PageInfo() *iterator.PageInfo {
1168 return it.pageInfo
1169 }
1170
1171 // Next returns the next result. Its second return value is iterator.Done if there are no more
1172 // results. Once Next returns Done, all subsequent calls will return Done.
1173 func (it *OperationIterator) Next() (*longrunningpb.Operation, error) {
1174 var item *longrunningpb.Operation
1175 if err := it.nextFunc(); err != nil {
1176 return item, err
1177 }
1178 item = it.items[0]
1179 it.items = it.items[1:]
1180 return item, nil
1181 }
1182
1183 func (it *OperationIterator) bufLen() int {
1184 return len(it.items)
1185 }
1186
1187 func (it *OperationIterator) takeBuf() interface{} {
1188 b := it.items
1189 it.items = nil
1190 return b
1191 }
1192
1193 // ServiceIterator manages a stream of *metastorepb.Service.
1194 type ServiceIterator struct {
1195 items []*metastorepb.Service
1196 pageInfo *iterator.PageInfo
1197 nextFunc func() error
1198
1199 // Response is the raw response for the current page.
1200 // It must be cast to the RPC response type.
1201 // Calling Next() or InternalFetch() updates this value.
1202 Response interface{}
1203
1204 // InternalFetch is for use by the Google Cloud Libraries only.
1205 // It is not part of the stable interface of this package.
1206 //
1207 // InternalFetch returns results from a single call to the underlying RPC.
1208 // The number of results is no greater than pageSize.
1209 // If there are no more results, nextPageToken is empty and err is nil.
1210 InternalFetch func(pageSize int, pageToken string) (results []*metastorepb.Service, nextPageToken string, err error)
1211 }
1212
1213 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
1214 func (it *ServiceIterator) PageInfo() *iterator.PageInfo {
1215 return it.pageInfo
1216 }
1217
1218 // Next returns the next result. Its second return value is iterator.Done if there are no more
1219 // results. Once Next returns Done, all subsequent calls will return Done.
1220 func (it *ServiceIterator) Next() (*metastorepb.Service, error) {
1221 var item *metastorepb.Service
1222 if err := it.nextFunc(); err != nil {
1223 return item, err
1224 }
1225 item = it.items[0]
1226 it.items = it.items[1:]
1227 return item, nil
1228 }
1229
1230 func (it *ServiceIterator) bufLen() int {
1231 return len(it.items)
1232 }
1233
1234 func (it *ServiceIterator) takeBuf() interface{} {
1235 b := it.items
1236 it.items = nil
1237 return b
1238 }