auxiliary.go 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. // Copyright 2024 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // https://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // Code generated by protoc-gen-go_gapic. DO NOT EDIT.
  15. package storage
  16. import (
  17. storagepb "cloud.google.com/go/storage/internal/apiv2/storagepb"
  18. "google.golang.org/api/iterator"
  19. )
  20. // BucketIterator manages a stream of *storagepb.Bucket.
  21. type BucketIterator struct {
  22. items []*storagepb.Bucket
  23. pageInfo *iterator.PageInfo
  24. nextFunc func() error
  25. // Response is the raw response for the current page.
  26. // It must be cast to the RPC response type.
  27. // Calling Next() or InternalFetch() updates this value.
  28. Response interface{}
  29. // InternalFetch is for use by the Google Cloud Libraries only.
  30. // It is not part of the stable interface of this package.
  31. //
  32. // InternalFetch returns results from a single call to the underlying RPC.
  33. // The number of results is no greater than pageSize.
  34. // If there are no more results, nextPageToken is empty and err is nil.
  35. InternalFetch func(pageSize int, pageToken string) (results []*storagepb.Bucket, nextPageToken string, err error)
  36. }
  37. // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
  38. func (it *BucketIterator) PageInfo() *iterator.PageInfo {
  39. return it.pageInfo
  40. }
  41. // Next returns the next result. Its second return value is iterator.Done if there are no more
  42. // results. Once Next returns Done, all subsequent calls will return Done.
  43. func (it *BucketIterator) Next() (*storagepb.Bucket, error) {
  44. var item *storagepb.Bucket
  45. if err := it.nextFunc(); err != nil {
  46. return item, err
  47. }
  48. item = it.items[0]
  49. it.items = it.items[1:]
  50. return item, nil
  51. }
  52. func (it *BucketIterator) bufLen() int {
  53. return len(it.items)
  54. }
  55. func (it *BucketIterator) takeBuf() interface{} {
  56. b := it.items
  57. it.items = nil
  58. return b
  59. }
  60. // HmacKeyMetadataIterator manages a stream of *storagepb.HmacKeyMetadata.
  61. type HmacKeyMetadataIterator struct {
  62. items []*storagepb.HmacKeyMetadata
  63. pageInfo *iterator.PageInfo
  64. nextFunc func() error
  65. // Response is the raw response for the current page.
  66. // It must be cast to the RPC response type.
  67. // Calling Next() or InternalFetch() updates this value.
  68. Response interface{}
  69. // InternalFetch is for use by the Google Cloud Libraries only.
  70. // It is not part of the stable interface of this package.
  71. //
  72. // InternalFetch returns results from a single call to the underlying RPC.
  73. // The number of results is no greater than pageSize.
  74. // If there are no more results, nextPageToken is empty and err is nil.
  75. InternalFetch func(pageSize int, pageToken string) (results []*storagepb.HmacKeyMetadata, nextPageToken string, err error)
  76. }
  77. // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
  78. func (it *HmacKeyMetadataIterator) PageInfo() *iterator.PageInfo {
  79. return it.pageInfo
  80. }
  81. // Next returns the next result. Its second return value is iterator.Done if there are no more
  82. // results. Once Next returns Done, all subsequent calls will return Done.
  83. func (it *HmacKeyMetadataIterator) Next() (*storagepb.HmacKeyMetadata, error) {
  84. var item *storagepb.HmacKeyMetadata
  85. if err := it.nextFunc(); err != nil {
  86. return item, err
  87. }
  88. item = it.items[0]
  89. it.items = it.items[1:]
  90. return item, nil
  91. }
  92. func (it *HmacKeyMetadataIterator) bufLen() int {
  93. return len(it.items)
  94. }
  95. func (it *HmacKeyMetadataIterator) takeBuf() interface{} {
  96. b := it.items
  97. it.items = nil
  98. return b
  99. }
  100. // NotificationConfigIterator manages a stream of *storagepb.NotificationConfig.
  101. type NotificationConfigIterator struct {
  102. items []*storagepb.NotificationConfig
  103. pageInfo *iterator.PageInfo
  104. nextFunc func() error
  105. // Response is the raw response for the current page.
  106. // It must be cast to the RPC response type.
  107. // Calling Next() or InternalFetch() updates this value.
  108. Response interface{}
  109. // InternalFetch is for use by the Google Cloud Libraries only.
  110. // It is not part of the stable interface of this package.
  111. //
  112. // InternalFetch returns results from a single call to the underlying RPC.
  113. // The number of results is no greater than pageSize.
  114. // If there are no more results, nextPageToken is empty and err is nil.
  115. InternalFetch func(pageSize int, pageToken string) (results []*storagepb.NotificationConfig, nextPageToken string, err error)
  116. }
  117. // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
  118. func (it *NotificationConfigIterator) PageInfo() *iterator.PageInfo {
  119. return it.pageInfo
  120. }
  121. // Next returns the next result. Its second return value is iterator.Done if there are no more
  122. // results. Once Next returns Done, all subsequent calls will return Done.
  123. func (it *NotificationConfigIterator) Next() (*storagepb.NotificationConfig, error) {
  124. var item *storagepb.NotificationConfig
  125. if err := it.nextFunc(); err != nil {
  126. return item, err
  127. }
  128. item = it.items[0]
  129. it.items = it.items[1:]
  130. return item, nil
  131. }
  132. func (it *NotificationConfigIterator) bufLen() int {
  133. return len(it.items)
  134. }
  135. func (it *NotificationConfigIterator) takeBuf() interface{} {
  136. b := it.items
  137. it.items = nil
  138. return b
  139. }
  140. // ObjectIterator manages a stream of *storagepb.Object.
  141. type ObjectIterator struct {
  142. items []*storagepb.Object
  143. pageInfo *iterator.PageInfo
  144. nextFunc func() error
  145. // Response is the raw response for the current page.
  146. // It must be cast to the RPC response type.
  147. // Calling Next() or InternalFetch() updates this value.
  148. Response interface{}
  149. // InternalFetch is for use by the Google Cloud Libraries only.
  150. // It is not part of the stable interface of this package.
  151. //
  152. // InternalFetch returns results from a single call to the underlying RPC.
  153. // The number of results is no greater than pageSize.
  154. // If there are no more results, nextPageToken is empty and err is nil.
  155. InternalFetch func(pageSize int, pageToken string) (results []*storagepb.Object, nextPageToken string, err error)
  156. }
  157. // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
  158. func (it *ObjectIterator) PageInfo() *iterator.PageInfo {
  159. return it.pageInfo
  160. }
  161. // Next returns the next result. Its second return value is iterator.Done if there are no more
  162. // results. Once Next returns Done, all subsequent calls will return Done.
  163. func (it *ObjectIterator) Next() (*storagepb.Object, error) {
  164. var item *storagepb.Object
  165. if err := it.nextFunc(); err != nil {
  166. return item, err
  167. }
  168. item = it.items[0]
  169. it.items = it.items[1:]
  170. return item, nil
  171. }
  172. func (it *ObjectIterator) bufLen() int {
  173. return len(it.items)
  174. }
  175. func (it *ObjectIterator) takeBuf() interface{} {
  176. b := it.items
  177. it.items = nil
  178. return b
  179. }