Debian Codegraph @

cloudtasks/apiv2beta2/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 cloudtasks
18
19 import (
20 cloudtaskspb "cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb"
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 // QueueIterator manages a stream of *cloudtaskspb.Queue.
73 type QueueIterator struct {
74 items []*cloudtaskspb.Queue
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 []*cloudtaskspb.Queue, nextPageToken string, err error)
90 }
91
92 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
93 func (it *QueueIterator) 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 *QueueIterator) Next() (*cloudtaskspb.Queue, error) {
100 var item *cloudtaskspb.Queue
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 *QueueIterator) bufLen() int {
110 return len(it.items)
111 }
112
113 func (it *QueueIterator) takeBuf() interface{} {
114 b := it.items
115 it.items = nil
116 return b
117 }
118
119 // TaskIterator manages a stream of *cloudtaskspb.Task.
120 type TaskIterator struct {
121 items []*cloudtaskspb.Task
122 pageInfo *iterator.PageInfo
123 nextFunc func() error
124
125 // Response is the raw response for the current page.
126 // It must be cast to the RPC response type.
127 // Calling Next() or InternalFetch() updates this value.
128 Response interface{}
129
130 // InternalFetch is for use by the Google Cloud Libraries only.
131 // It is not part of the stable interface of this package.
132 //
133 // InternalFetch returns results from a single call to the underlying RPC.
134 // The number of results is no greater than pageSize.
135 // If there are no more results, nextPageToken is empty and err is nil.
136 InternalFetch func(pageSize int, pageToken string) (results []*cloudtaskspb.Task, nextPageToken string, err error)
137 }
138
139 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
140 func (it *TaskIterator) PageInfo() *iterator.PageInfo {
141 return it.pageInfo
142 }
143
144 // Next returns the next result. Its second return value is iterator.Done if there are no more
145 // results. Once Next returns Done, all subsequent calls will return Done.
146 func (it *TaskIterator) Next() (*cloudtaskspb.Task, error) {
147 var item *cloudtaskspb.Task
148 if err := it.nextFunc(); err != nil {
149 return item, err
150 }
151 item = it.items[0]
152 it.items = it.items[1:]
153 return item, nil
154 }
155
156 func (it *TaskIterator) bufLen() int {
157 return len(it.items)
158 }
159
160 func (it *TaskIterator) takeBuf() interface{} {
161 b := it.items
162 it.items = nil
163 return b
164 }