| 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 schemaregistry |
| 18 | |
| 19 | import ( |
| 20 | longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 21 | "google.golang.org/api/iterator" |
| 22 | locationpb "google.golang.org/genproto/googleapis/cloud/location" |
| 23 | ) |
| 24 | |
| 25 | // LocationIterator manages a stream of *locationpb.Location. |
| 26 | type LocationIterator struct { |
| 27 | items []*locationpb.Location |
| 28 | pageInfo *iterator.PageInfo |
| 29 | nextFunc func() error |
| 30 | |
| 31 | // Response is the raw response for the current page. |
| 32 | // It must be cast to the RPC response type. |
| 33 | // Calling Next() or InternalFetch() updates this value. |
| 34 | Response interface{} |
| 35 | |
| 36 | // InternalFetch is for use by the Google Cloud Libraries only. |
| 37 | // It is not part of the stable interface of this package. |
| 38 | // |
| 39 | // InternalFetch returns results from a single call to the underlying RPC. |
| 40 | // The number of results is no greater than pageSize. |
| 41 | // If there are no more results, nextPageToken is empty and err is nil. |
| 42 | InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error) |
| 43 | } |
| 44 | |
| 45 | // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 46 | func (it *LocationIterator) PageInfo() *iterator.PageInfo { |
| 47 | return it.pageInfo |
| 48 | } |
| 49 | |
| 50 | // Next returns the next result. Its second return value is iterator.Done if there are no more |
| 51 | // results. Once Next returns Done, all subsequent calls will return Done. |
| 52 | func (it *LocationIterator) Next() (*locationpb.Location, error) { |
| 53 | var item *locationpb.Location |
| 54 | if err := it.nextFunc(); err != nil { |
| 55 | return item, err |
| 56 | } |
| 57 | item = it.items[0] |
| 58 | it.items = it.items[1:] |
| 59 | return item, nil |
| 60 | } |
| 61 | |
| 62 | func (it *LocationIterator) bufLen() int { |
| 63 | return len(it.items) |
| 64 | } |
| 65 | |
| 66 | func (it *LocationIterator) takeBuf() interface{} { |
| 67 | b := it.items |
| 68 | it.items = nil |
| 69 | return b |
| 70 | } |
| 71 | |
| 72 | // OperationIterator manages a stream of *longrunningpb.Operation. |
| 73 | type OperationIterator struct { |
| 74 | items []*longrunningpb.Operation |
| 75 | pageInfo *iterator.PageInfo |
| 76 | nextFunc func() error |
| 77 | |
| 78 | // Response is the raw response for the current page. |
| 79 | // It must be cast to the RPC response type. |
| 80 | // Calling Next() or InternalFetch() updates this value. |
| 81 | Response interface{} |
| 82 | |
| 83 | // InternalFetch is for use by the Google Cloud Libraries only. |
| 84 | // It is not part of the stable interface of this package. |
| 85 | // |
| 86 | // InternalFetch returns results from a single call to the underlying RPC. |
| 87 | // The number of results is no greater than pageSize. |
| 88 | // If there are no more results, nextPageToken is empty and err is nil. |
| 89 | InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error) |
| 90 | } |
| 91 | |
| 92 | // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 93 | func (it *OperationIterator) PageInfo() *iterator.PageInfo { |
| 94 | return it.pageInfo |
| 95 | } |
| 96 | |
| 97 | // Next returns the next result. Its second return value is iterator.Done if there are no more |
| 98 | // results. Once Next returns Done, all subsequent calls will return Done. |
| 99 | func (it *OperationIterator) Next() (*longrunningpb.Operation, error) { |
| 100 | var item *longrunningpb.Operation |
| 101 | if err := it.nextFunc(); err != nil { |
| 102 | return item, err |
| 103 | } |
| 104 | item = it.items[0] |
| 105 | it.items = it.items[1:] |
| 106 | return item, nil |
| 107 | } |
| 108 | |
| 109 | func (it *OperationIterator) bufLen() int { |
| 110 | return len(it.items) |
| 111 | } |
| 112 | |
| 113 | func (it *OperationIterator) takeBuf() interface{} { |
| 114 | b := it.items |
| 115 | it.items = nil |
| 116 | return b |
| 117 | } |