Debian Codegraph @

datacatalog/lineage/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 lineage
18
19 import (
20 "context"
21 "time"
22
23 lineagepb "cloud.google.com/go/datacatalog/lineage/apiv1/lineagepb"
24 "cloud.google.com/go/longrunning"
25 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
26 gax "github.com/googleapis/gax-go/v2"
27 "google.golang.org/api/iterator"
28 )
29
30 // DeleteProcessOperation manages a long-running operation from DeleteProcess.
31 type DeleteProcessOperation struct {
32 lro *longrunning.Operation
33 pollPath string
34 }
35
36 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
37 //
38 // See documentation of Poll for error-handling information.
39 func (op *DeleteProcessOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
40 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
41 return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
42 }
43
44 // Poll fetches the latest state of the long-running operation.
45 //
46 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
47 //
48 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
49 // the operation has completed with failure, the error is returned and op.Done will return true.
50 // If Poll succeeds and the operation has completed successfully,
51 // op.Done will return true, and the response of the operation is returned.
52 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
53 func (op *DeleteProcessOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
54 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
55 return op.lro.Poll(ctx, nil, opts...)
56 }
57
58 // Metadata returns metadata associated with the long-running operation.
59 // Metadata itself does not contact the server, but Poll does.
60 // To get the latest metadata, call this method after a successful call to Poll.
61 // If the metadata is not available, the returned metadata and error are both nil.
62 func (op *DeleteProcessOperation) Metadata() (*lineagepb.OperationMetadata, error) {
63 var meta lineagepb.OperationMetadata
64 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
65 return nil, nil
66 } else if err != nil {
67 return nil, err
68 }
69 return &meta, nil
70 }
71
72 // Done reports whether the long-running operation has completed.
73 func (op *DeleteProcessOperation) Done() bool {
74 return op.lro.Done()
75 }
76
77 // Name returns the name of the long-running operation.
78 // The name is assigned by the server and is unique within the service from which the operation is created.
79 func (op *DeleteProcessOperation) Name() string {
80 return op.lro.Name()
81 }
82
83 // DeleteRunOperation manages a long-running operation from DeleteRun.
84 type DeleteRunOperation struct {
85 lro *longrunning.Operation
86 pollPath string
87 }
88
89 // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
90 //
91 // See documentation of Poll for error-handling information.
92 func (op *DeleteRunOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
93 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
94 return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
95 }
96
97 // Poll fetches the latest state of the long-running operation.
98 //
99 // Poll also fetches the latest metadata, which can be retrieved by Metadata.
100 //
101 // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
102 // the operation has completed with failure, the error is returned and op.Done will return true.
103 // If Poll succeeds and the operation has completed successfully,
104 // op.Done will return true, and the response of the operation is returned.
105 // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
106 func (op *DeleteRunOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
107 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
108 return op.lro.Poll(ctx, nil, opts...)
109 }
110
111 // Metadata returns metadata associated with the long-running operation.
112 // Metadata itself does not contact the server, but Poll does.
113 // To get the latest metadata, call this method after a successful call to Poll.
114 // If the metadata is not available, the returned metadata and error are both nil.
115 func (op *DeleteRunOperation) Metadata() (*lineagepb.OperationMetadata, error) {
116 var meta lineagepb.OperationMetadata
117 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
118 return nil, nil
119 } else if err != nil {
120 return nil, err
121 }
122 return &meta, nil
123 }
124
125 // Done reports whether the long-running operation has completed.
126 func (op *DeleteRunOperation) Done() bool {
127 return op.lro.Done()
128 }
129
130 // Name returns the name of the long-running operation.
131 // The name is assigned by the server and is unique within the service from which the operation is created.
132 func (op *DeleteRunOperation) Name() string {
133 return op.lro.Name()
134 }
135
136 // LineageEventIterator manages a stream of *lineagepb.LineageEvent.
137 type LineageEventIterator struct {
138 items []*lineagepb.LineageEvent
139 pageInfo *iterator.PageInfo
140 nextFunc func() error
141
142 // Response is the raw response for the current page.
143 // It must be cast to the RPC response type.
144 // Calling Next() or InternalFetch() updates this value.
145 Response interface{}
146
147 // InternalFetch is for use by the Google Cloud Libraries only.
148 // It is not part of the stable interface of this package.
149 //
150 // InternalFetch returns results from a single call to the underlying RPC.
151 // The number of results is no greater than pageSize.
152 // If there are no more results, nextPageToken is empty and err is nil.
153 InternalFetch func(pageSize int, pageToken string) (results []*lineagepb.LineageEvent, nextPageToken string, err error)
154 }
155
156 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
157 func (it *LineageEventIterator) PageInfo() *iterator.PageInfo {
158 return it.pageInfo
159 }
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 *LineageEventIterator) Next() (*lineagepb.LineageEvent, error) {
164 var item *lineagepb.LineageEvent
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
173 func (it *LineageEventIterator) bufLen() int {
174 return len(it.items)
175 }
176
177 func (it *LineageEventIterator) takeBuf() interface{} {
178 b := it.items
179 it.items = nil
180 return b
181 }
182
183 // LinkIterator manages a stream of *lineagepb.Link.
184 type LinkIterator struct {
185 items []*lineagepb.Link
186 pageInfo *iterator.PageInfo
187 nextFunc func() error
188
189 // Response is the raw response for the current page.
190 // It must be cast to the RPC response type.
191 // Calling Next() or InternalFetch() updates this value.
192 Response interface{}
193
194 // InternalFetch is for use by the Google Cloud Libraries only.
195 // It is not part of the stable interface of this package.
196 //
197 // InternalFetch returns results from a single call to the underlying RPC.
198 // The number of results is no greater than pageSize.
199 // If there are no more results, nextPageToken is empty and err is nil.
200 InternalFetch func(pageSize int, pageToken string) (results []*lineagepb.Link, nextPageToken string, err error)
201 }
202
203 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
204 func (it *LinkIterator) PageInfo() *iterator.PageInfo {
205 return it.pageInfo
206 }
207
208 // Next returns the next result. Its second return value is iterator.Done if there are no more
209 // results. Once Next returns Done, all subsequent calls will return Done.
210 func (it *LinkIterator) Next() (*lineagepb.Link, error) {
211 var item *lineagepb.Link
212 if err := it.nextFunc(); err != nil {
213 return item, err
214 }
215 item = it.items[0]
216 it.items = it.items[1:]
217 return item, nil
218 }
219
220 func (it *LinkIterator) bufLen() int {
221 return len(it.items)
222 }
223
224 func (it *LinkIterator) takeBuf() interface{} {
225 b := it.items
226 it.items = nil
227 return b
228 }
229
230 // OperationIterator manages a stream of *longrunningpb.Operation.
231 type OperationIterator struct {
232 items []*longrunningpb.Operation
233 pageInfo *iterator.PageInfo
234 nextFunc func() error
235
236 // Response is the raw response for the current page.
237 // It must be cast to the RPC response type.
238 // Calling Next() or InternalFetch() updates this value.
239 Response interface{}
240
241 // InternalFetch is for use by the Google Cloud Libraries only.
242 // It is not part of the stable interface of this package.
243 //
244 // InternalFetch returns results from a single call to the underlying RPC.
245 // The number of results is no greater than pageSize.
246 // If there are no more results, nextPageToken is empty and err is nil.
247 InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error)
248 }
249
250 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
251 func (it *OperationIterator) PageInfo() *iterator.PageInfo {
252 return it.pageInfo
253 }
254
255 // Next returns the next result. Its second return value is iterator.Done if there are no more
256 // results. Once Next returns Done, all subsequent calls will return Done.
257 func (it *OperationIterator) Next() (*longrunningpb.Operation, error) {
258 var item *longrunningpb.Operation
259 if err := it.nextFunc(); err != nil {
260 return item, err
261 }
262 item = it.items[0]
263 it.items = it.items[1:]
264 return item, nil
265 }
266
267 func (it *OperationIterator) bufLen() int {
268 return len(it.items)
269 }
270
271 func (it *OperationIterator) takeBuf() interface{} {
272 b := it.items
273 it.items = nil
274 return b
275 }
276
277 // ProcessIterator manages a stream of *lineagepb.Process.
278 type ProcessIterator struct {
279 items []*lineagepb.Process
280 pageInfo *iterator.PageInfo
281 nextFunc func() error
282
283 // Response is the raw response for the current page.
284 // It must be cast to the RPC response type.
285 // Calling Next() or InternalFetch() updates this value.
286 Response interface{}
287
288 // InternalFetch is for use by the Google Cloud Libraries only.
289 // It is not part of the stable interface of this package.
290 //
291 // InternalFetch returns results from a single call to the underlying RPC.
292 // The number of results is no greater than pageSize.
293 // If there are no more results, nextPageToken is empty and err is nil.
294 InternalFetch func(pageSize int, pageToken string) (results []*lineagepb.Process, nextPageToken string, err error)
295 }
296
297 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
298 func (it *ProcessIterator) PageInfo() *iterator.PageInfo {
299 return it.pageInfo
300 }
301
302 // Next returns the next result. Its second return value is iterator.Done if there are no more
303 // results. Once Next returns Done, all subsequent calls will return Done.
304 func (it *ProcessIterator) Next() (*lineagepb.Process, error) {
305 var item *lineagepb.Process
306 if err := it.nextFunc(); err != nil {
307 return item, err
308 }
309 item = it.items[0]
310 it.items = it.items[1:]
311 return item, nil
312 }
313
314 func (it *ProcessIterator) bufLen() int {
315 return len(it.items)
316 }
317
318 func (it *ProcessIterator) takeBuf() interface{} {
319 b := it.items
320 it.items = nil
321 return b
322 }
323
324 // ProcessLinksIterator manages a stream of *lineagepb.ProcessLinks.
325 type ProcessLinksIterator struct {
326 items []*lineagepb.ProcessLinks
327 pageInfo *iterator.PageInfo
328 nextFunc func() error
329
330 // Response is the raw response for the current page.
331 // It must be cast to the RPC response type.
332 // Calling Next() or InternalFetch() updates this value.
333 Response interface{}
334
335 // InternalFetch is for use by the Google Cloud Libraries only.
336 // It is not part of the stable interface of this package.
337 //
338 // InternalFetch returns results from a single call to the underlying RPC.
339 // The number of results is no greater than pageSize.
340 // If there are no more results, nextPageToken is empty and err is nil.
341 InternalFetch func(pageSize int, pageToken string) (results []*lineagepb.ProcessLinks, nextPageToken string, err error)
342 }
343
344 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
345 func (it *ProcessLinksIterator) PageInfo() *iterator.PageInfo {
346 return it.pageInfo
347 }
348
349 // Next returns the next result. Its second return value is iterator.Done if there are no more
350 // results. Once Next returns Done, all subsequent calls will return Done.
351 func (it *ProcessLinksIterator) Next() (*lineagepb.ProcessLinks, error) {
352 var item *lineagepb.ProcessLinks
353 if err := it.nextFunc(); err != nil {
354 return item, err
355 }
356 item = it.items[0]
357 it.items = it.items[1:]
358 return item, nil
359 }
360
361 func (it *ProcessLinksIterator) bufLen() int {
362 return len(it.items)
363 }
364
365 func (it *ProcessLinksIterator) takeBuf() interface{} {
366 b := it.items
367 it.items = nil
368 return b
369 }
370
371 // RunIterator manages a stream of *lineagepb.Run.
372 type RunIterator struct {
373 items []*lineagepb.Run
374 pageInfo *iterator.PageInfo
375 nextFunc func() error
376
377 // Response is the raw response for the current page.
378 // It must be cast to the RPC response type.
379 // Calling Next() or InternalFetch() updates this value.
380 Response interface{}
381
382 // InternalFetch is for use by the Google Cloud Libraries only.
383 // It is not part of the stable interface of this package.
384 //
385 // InternalFetch returns results from a single call to the underlying RPC.
386 // The number of results is no greater than pageSize.
387 // If there are no more results, nextPageToken is empty and err is nil.
388 InternalFetch func(pageSize int, pageToken string) (results []*lineagepb.Run, nextPageToken string, err error)
389 }
390
391 // PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
392 func (it *RunIterator) PageInfo() *iterator.PageInfo {
393 return it.pageInfo
394 }
395
396 // Next returns the next result. Its second return value is iterator.Done if there are no more
397 // results. Once Next returns Done, all subsequent calls will return Done.
398 func (it *RunIterator) Next() (*lineagepb.Run, error) {
399 var item *lineagepb.Run
400 if err := it.nextFunc(); err != nil {
401 return item, err
402 }
403 item = it.items[0]
404 it.items = it.items[1:]
405 return item, nil
406 }
407
408 func (it *RunIterator) bufLen() int {
409 return len(it.items)
410 }
411
412 func (it *RunIterator) takeBuf() interface{} {
413 b := it.items
414 it.items = nil
415 return b
416 }