// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Code generated by protoc-gen-go_gapic. DO NOT EDIT. package pubsub import ( pubsubpb "cloud.google.com/go/pubsub/v2/apiv1/pubsubpb" "google.golang.org/api/iterator" ) // SchemaIterator manages a stream of *pubsubpb.Schema. type SchemaIterator struct { items []*pubsubpb.Schema pageInfo *iterator.PageInfo nextFunc func() error // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*pubsubpb.Schema, nextPageToken string, err error) } // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. func (it *SchemaIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } // Next returns the next result. Its second return value is iterator.Done if there are no more // results. Once Next returns Done, all subsequent calls will return Done. func (it *SchemaIterator) Next() (*pubsubpb.Schema, error) { var item *pubsubpb.Schema if err := it.nextFunc(); err != nil { return item, err } item = it.items[0] it.items = it.items[1:] return item, nil } func (it *SchemaIterator) bufLen() int { return len(it.items) } func (it *SchemaIterator) takeBuf() interface{} { b := it.items it.items = nil return b } // SnapshotIterator manages a stream of *pubsubpb.Snapshot. type SnapshotIterator struct { items []*pubsubpb.Snapshot pageInfo *iterator.PageInfo nextFunc func() error // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*pubsubpb.Snapshot, nextPageToken string, err error) } // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. func (it *SnapshotIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } // Next returns the next result. Its second return value is iterator.Done if there are no more // results. Once Next returns Done, all subsequent calls will return Done. func (it *SnapshotIterator) Next() (*pubsubpb.Snapshot, error) { var item *pubsubpb.Snapshot if err := it.nextFunc(); err != nil { return item, err } item = it.items[0] it.items = it.items[1:] return item, nil } func (it *SnapshotIterator) bufLen() int { return len(it.items) } func (it *SnapshotIterator) takeBuf() interface{} { b := it.items it.items = nil return b } // StringIterator manages a stream of string. type StringIterator struct { items []string pageInfo *iterator.PageInfo nextFunc func() error // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []string, nextPageToken string, err error) } // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. func (it *StringIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } // Next returns the next result. Its second return value is iterator.Done if there are no more // results. Once Next returns Done, all subsequent calls will return Done. func (it *StringIterator) Next() (string, error) { var item string if err := it.nextFunc(); err != nil { return item, err } item = it.items[0] it.items = it.items[1:] return item, nil } func (it *StringIterator) bufLen() int { return len(it.items) } func (it *StringIterator) takeBuf() interface{} { b := it.items it.items = nil return b } // SubscriptionIterator manages a stream of *pubsubpb.Subscription. type SubscriptionIterator struct { items []*pubsubpb.Subscription pageInfo *iterator.PageInfo nextFunc func() error // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*pubsubpb.Subscription, nextPageToken string, err error) } // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. func (it *SubscriptionIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } // Next returns the next result. Its second return value is iterator.Done if there are no more // results. Once Next returns Done, all subsequent calls will return Done. func (it *SubscriptionIterator) Next() (*pubsubpb.Subscription, error) { var item *pubsubpb.Subscription if err := it.nextFunc(); err != nil { return item, err } item = it.items[0] it.items = it.items[1:] return item, nil } func (it *SubscriptionIterator) bufLen() int { return len(it.items) } func (it *SubscriptionIterator) takeBuf() interface{} { b := it.items it.items = nil return b } // TopicIterator manages a stream of *pubsubpb.Topic. type TopicIterator struct { items []*pubsubpb.Topic pageInfo *iterator.PageInfo nextFunc func() error // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*pubsubpb.Topic, nextPageToken string, err error) } // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. func (it *TopicIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } // Next returns the next result. Its second return value is iterator.Done if there are no more // results. Once Next returns Done, all subsequent calls will return Done. func (it *TopicIterator) Next() (*pubsubpb.Topic, error) { var item *pubsubpb.Topic if err := it.nextFunc(); err != nil { return item, err } item = it.items[0] it.items = it.items[1:] return item, nil } func (it *TopicIterator) bufLen() int { return len(it.items) } func (it *TopicIterator) takeBuf() interface{} { b := it.items it.items = nil return b }