Debian Codegraph @

datacatalog/lineage/apiv1/lineage_client.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 "bytes"
21 "context"
22 "fmt"
23 "log/slog"
24 "math"
25 "net/http"
26 "net/url"
27 "time"
28
29 lineagepb "cloud.google.com/go/datacatalog/lineage/apiv1/lineagepb"
30 "cloud.google.com/go/longrunning"
31 lroauto "cloud.google.com/go/longrunning/autogen"
32 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
33 gax "github.com/googleapis/gax-go/v2"
34 "google.golang.org/api/iterator"
35 "google.golang.org/api/option"
36 "google.golang.org/api/option/internaloption"
37 gtransport "google.golang.org/api/transport/grpc"
38 httptransport "google.golang.org/api/transport/http"
39 "google.golang.org/grpc"
40 "google.golang.org/grpc/codes"
41 "google.golang.org/protobuf/encoding/protojson"
42 "google.golang.org/protobuf/proto"
43 )
44
45 var newClientHook clientHook
46
47 // CallOptions contains the retry settings for each method of Client.
48 type CallOptions struct {
49 ProcessOpenLineageRunEvent []gax.CallOption
50 CreateProcess []gax.CallOption
51 UpdateProcess []gax.CallOption
52 GetProcess []gax.CallOption
53 ListProcesses []gax.CallOption
54 DeleteProcess []gax.CallOption
55 CreateRun []gax.CallOption
56 UpdateRun []gax.CallOption
57 GetRun []gax.CallOption
58 ListRuns []gax.CallOption
59 DeleteRun []gax.CallOption
60 CreateLineageEvent []gax.CallOption
61 GetLineageEvent []gax.CallOption
62 ListLineageEvents []gax.CallOption
63 DeleteLineageEvent []gax.CallOption
64 SearchLinks []gax.CallOption
65 BatchSearchLinkProcesses []gax.CallOption
66 CancelOperation []gax.CallOption
67 DeleteOperation []gax.CallOption
68 GetOperation []gax.CallOption
69 ListOperations []gax.CallOption
70 }
71
72 func defaultGRPCClientOptions() []option.ClientOption {
73 return []option.ClientOption{
74 internaloption.WithDefaultEndpoint("datalineage.googleapis.com:443"),
75 internaloption.WithDefaultEndpointTemplate("datalineage.UNIVERSE_DOMAIN:443"),
76 internaloption.WithDefaultMTLSEndpoint("datalineage.mtls.googleapis.com:443"),
77 internaloption.WithDefaultUniverseDomain("googleapis.com"),
78 internaloption.WithDefaultAudience("https://datalineage.googleapis.com/"),
79 internaloption.WithDefaultScopes(DefaultAuthScopes()...),
80 internaloption.EnableJwtWithScope(),
81 internaloption.EnableNewAuthLibrary(),
82 option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
83 grpc.MaxCallRecvMsgSize(math.MaxInt32))),
84 }
85 }
86
87 func defaultCallOptions() *CallOptions {
88 return &CallOptions{
89 ProcessOpenLineageRunEvent: []gax.CallOption{
90 gax.WithTimeout(60000 * time.Millisecond),
91 gax.WithRetry(func() gax.Retryer {
92 return gax.OnCodes([]codes.Code{
93 codes.Unavailable,
94 }, gax.Backoff{
95 Initial: 100 * time.Millisecond,
96 Max: 60000 * time.Millisecond,
97 Multiplier: 1.30,
98 })
99 }),
100 },
101 CreateProcess: []gax.CallOption{
102 gax.WithTimeout(60000 * time.Millisecond),
103 gax.WithRetry(func() gax.Retryer {
104 return gax.OnCodes([]codes.Code{
105 codes.Unavailable,
106 }, gax.Backoff{
107 Initial: 100 * time.Millisecond,
108 Max: 60000 * time.Millisecond,
109 Multiplier: 1.30,
110 })
111 }),
112 },
113 UpdateProcess: []gax.CallOption{
114 gax.WithTimeout(60000 * time.Millisecond),
115 gax.WithRetry(func() gax.Retryer {
116 return gax.OnCodes([]codes.Code{
117 codes.Unavailable,
118 }, gax.Backoff{
119 Initial: 100 * time.Millisecond,
120 Max: 60000 * time.Millisecond,
121 Multiplier: 1.30,
122 })
123 }),
124 },
125 GetProcess: []gax.CallOption{
126 gax.WithTimeout(60000 * time.Millisecond),
127 gax.WithRetry(func() gax.Retryer {
128 return gax.OnCodes([]codes.Code{
129 codes.Unavailable,
130 }, gax.Backoff{
131 Initial: 100 * time.Millisecond,
132 Max: 60000 * time.Millisecond,
133 Multiplier: 1.30,
134 })
135 }),
136 },
137 ListProcesses: []gax.CallOption{
138 gax.WithTimeout(60000 * time.Millisecond),
139 gax.WithRetry(func() gax.Retryer {
140 return gax.OnCodes([]codes.Code{
141 codes.Unavailable,
142 }, gax.Backoff{
143 Initial: 100 * time.Millisecond,
144 Max: 60000 * time.Millisecond,
145 Multiplier: 1.30,
146 })
147 }),
148 },
149 DeleteProcess: []gax.CallOption{
150 gax.WithTimeout(60000 * time.Millisecond),
151 gax.WithRetry(func() gax.Retryer {
152 return gax.OnCodes([]codes.Code{
153 codes.Unavailable,
154 }, gax.Backoff{
155 Initial: 100 * time.Millisecond,
156 Max: 60000 * time.Millisecond,
157 Multiplier: 1.30,
158 })
159 }),
160 },
161 CreateRun: []gax.CallOption{
162 gax.WithTimeout(60000 * time.Millisecond),
163 gax.WithRetry(func() gax.Retryer {
164 return gax.OnCodes([]codes.Code{
165 codes.Unavailable,
166 }, gax.Backoff{
167 Initial: 100 * time.Millisecond,
168 Max: 60000 * time.Millisecond,
169 Multiplier: 1.30,
170 })
171 }),
172 },
173 UpdateRun: []gax.CallOption{
174 gax.WithTimeout(60000 * time.Millisecond),
175 gax.WithRetry(func() gax.Retryer {
176 return gax.OnCodes([]codes.Code{
177 codes.Unavailable,
178 }, gax.Backoff{
179 Initial: 100 * time.Millisecond,
180 Max: 60000 * time.Millisecond,
181 Multiplier: 1.30,
182 })
183 }),
184 },
185 GetRun: []gax.CallOption{
186 gax.WithTimeout(60000 * time.Millisecond),
187 gax.WithRetry(func() gax.Retryer {
188 return gax.OnCodes([]codes.Code{
189 codes.Unavailable,
190 }, gax.Backoff{
191 Initial: 100 * time.Millisecond,
192 Max: 60000 * time.Millisecond,
193 Multiplier: 1.30,
194 })
195 }),
196 },
197 ListRuns: []gax.CallOption{
198 gax.WithTimeout(60000 * time.Millisecond),
199 gax.WithRetry(func() gax.Retryer {
200 return gax.OnCodes([]codes.Code{
201 codes.Unavailable,
202 }, gax.Backoff{
203 Initial: 100 * time.Millisecond,
204 Max: 60000 * time.Millisecond,
205 Multiplier: 1.30,
206 })
207 }),
208 },
209 DeleteRun: []gax.CallOption{
210 gax.WithTimeout(60000 * time.Millisecond),
211 gax.WithRetry(func() gax.Retryer {
212 return gax.OnCodes([]codes.Code{
213 codes.Unavailable,
214 }, gax.Backoff{
215 Initial: 100 * time.Millisecond,
216 Max: 60000 * time.Millisecond,
217 Multiplier: 1.30,
218 })
219 }),
220 },
221 CreateLineageEvent: []gax.CallOption{
222 gax.WithTimeout(60000 * time.Millisecond),
223 gax.WithRetry(func() gax.Retryer {
224 return gax.OnCodes([]codes.Code{
225 codes.Unavailable,
226 }, gax.Backoff{
227 Initial: 100 * time.Millisecond,
228 Max: 60000 * time.Millisecond,
229 Multiplier: 1.30,
230 })
231 }),
232 },
233 GetLineageEvent: []gax.CallOption{
234 gax.WithTimeout(60000 * time.Millisecond),
235 gax.WithRetry(func() gax.Retryer {
236 return gax.OnCodes([]codes.Code{
237 codes.Unavailable,
238 }, gax.Backoff{
239 Initial: 100 * time.Millisecond,
240 Max: 60000 * time.Millisecond,
241 Multiplier: 1.30,
242 })
243 }),
244 },
245 ListLineageEvents: []gax.CallOption{
246 gax.WithTimeout(60000 * time.Millisecond),
247 gax.WithRetry(func() gax.Retryer {
248 return gax.OnCodes([]codes.Code{
249 codes.Unavailable,
250 }, gax.Backoff{
251 Initial: 100 * time.Millisecond,
252 Max: 60000 * time.Millisecond,
253 Multiplier: 1.30,
254 })
255 }),
256 },
257 DeleteLineageEvent: []gax.CallOption{
258 gax.WithTimeout(60000 * time.Millisecond),
259 gax.WithRetry(func() gax.Retryer {
260 return gax.OnCodes([]codes.Code{
261 codes.Unavailable,
262 }, gax.Backoff{
263 Initial: 100 * time.Millisecond,
264 Max: 60000 * time.Millisecond,
265 Multiplier: 1.30,
266 })
267 }),
268 },
269 SearchLinks: []gax.CallOption{
270 gax.WithTimeout(60000 * time.Millisecond),
271 gax.WithRetry(func() gax.Retryer {
272 return gax.OnCodes([]codes.Code{
273 codes.Unavailable,
274 }, gax.Backoff{
275 Initial: 100 * time.Millisecond,
276 Max: 60000 * time.Millisecond,
277 Multiplier: 1.30,
278 })
279 }),
280 },
281 BatchSearchLinkProcesses: []gax.CallOption{
282 gax.WithTimeout(60000 * time.Millisecond),
283 gax.WithRetry(func() gax.Retryer {
284 return gax.OnCodes([]codes.Code{
285 codes.Unavailable,
286 }, gax.Backoff{
287 Initial: 100 * time.Millisecond,
288 Max: 60000 * time.Millisecond,
289 Multiplier: 1.30,
290 })
291 }),
292 },
293 CancelOperation: []gax.CallOption{},
294 DeleteOperation: []gax.CallOption{},
295 GetOperation: []gax.CallOption{},
296 ListOperations: []gax.CallOption{},
297 }
298 }
299
300 func defaultRESTCallOptions() *CallOptions {
301 return &CallOptions{
302 ProcessOpenLineageRunEvent: []gax.CallOption{
303 gax.WithTimeout(60000 * time.Millisecond),
304 gax.WithRetry(func() gax.Retryer {
305 return gax.OnHTTPCodes(gax.Backoff{
306 Initial: 100 * time.Millisecond,
307 Max: 60000 * time.Millisecond,
308 Multiplier: 1.30,
309 },
310 http.StatusServiceUnavailable)
311 }),
312 },
313 CreateProcess: []gax.CallOption{
314 gax.WithTimeout(60000 * time.Millisecond),
315 gax.WithRetry(func() gax.Retryer {
316 return gax.OnHTTPCodes(gax.Backoff{
317 Initial: 100 * time.Millisecond,
318 Max: 60000 * time.Millisecond,
319 Multiplier: 1.30,
320 },
321 http.StatusServiceUnavailable)
322 }),
323 },
324 UpdateProcess: []gax.CallOption{
325 gax.WithTimeout(60000 * time.Millisecond),
326 gax.WithRetry(func() gax.Retryer {
327 return gax.OnHTTPCodes(gax.Backoff{
328 Initial: 100 * time.Millisecond,
329 Max: 60000 * time.Millisecond,
330 Multiplier: 1.30,
331 },
332 http.StatusServiceUnavailable)
333 }),
334 },
335 GetProcess: []gax.CallOption{
336 gax.WithTimeout(60000 * time.Millisecond),
337 gax.WithRetry(func() gax.Retryer {
338 return gax.OnHTTPCodes(gax.Backoff{
339 Initial: 100 * time.Millisecond,
340 Max: 60000 * time.Millisecond,
341 Multiplier: 1.30,
342 },
343 http.StatusServiceUnavailable)
344 }),
345 },
346 ListProcesses: []gax.CallOption{
347 gax.WithTimeout(60000 * time.Millisecond),
348 gax.WithRetry(func() gax.Retryer {
349 return gax.OnHTTPCodes(gax.Backoff{
350 Initial: 100 * time.Millisecond,
351 Max: 60000 * time.Millisecond,
352 Multiplier: 1.30,
353 },
354 http.StatusServiceUnavailable)
355 }),
356 },
357 DeleteProcess: []gax.CallOption{
358 gax.WithTimeout(60000 * time.Millisecond),
359 gax.WithRetry(func() gax.Retryer {
360 return gax.OnHTTPCodes(gax.Backoff{
361 Initial: 100 * time.Millisecond,
362 Max: 60000 * time.Millisecond,
363 Multiplier: 1.30,
364 },
365 http.StatusServiceUnavailable)
366 }),
367 },
368 CreateRun: []gax.CallOption{
369 gax.WithTimeout(60000 * time.Millisecond),
370 gax.WithRetry(func() gax.Retryer {
371 return gax.OnHTTPCodes(gax.Backoff{
372 Initial: 100 * time.Millisecond,
373 Max: 60000 * time.Millisecond,
374 Multiplier: 1.30,
375 },
376 http.StatusServiceUnavailable)
377 }),
378 },
379 UpdateRun: []gax.CallOption{
380 gax.WithTimeout(60000 * time.Millisecond),
381 gax.WithRetry(func() gax.Retryer {
382 return gax.OnHTTPCodes(gax.Backoff{
383 Initial: 100 * time.Millisecond,
384 Max: 60000 * time.Millisecond,
385 Multiplier: 1.30,
386 },
387 http.StatusServiceUnavailable)
388 }),
389 },
390 GetRun: []gax.CallOption{
391 gax.WithTimeout(60000 * time.Millisecond),
392 gax.WithRetry(func() gax.Retryer {
393 return gax.OnHTTPCodes(gax.Backoff{
394 Initial: 100 * time.Millisecond,
395 Max: 60000 * time.Millisecond,
396 Multiplier: 1.30,
397 },
398 http.StatusServiceUnavailable)
399 }),
400 },
401 ListRuns: []gax.CallOption{
402 gax.WithTimeout(60000 * time.Millisecond),
403 gax.WithRetry(func() gax.Retryer {
404 return gax.OnHTTPCodes(gax.Backoff{
405 Initial: 100 * time.Millisecond,
406 Max: 60000 * time.Millisecond,
407 Multiplier: 1.30,
408 },
409 http.StatusServiceUnavailable)
410 }),
411 },
412 DeleteRun: []gax.CallOption{
413 gax.WithTimeout(60000 * time.Millisecond),
414 gax.WithRetry(func() gax.Retryer {
415 return gax.OnHTTPCodes(gax.Backoff{
416 Initial: 100 * time.Millisecond,
417 Max: 60000 * time.Millisecond,
418 Multiplier: 1.30,
419 },
420 http.StatusServiceUnavailable)
421 }),
422 },
423 CreateLineageEvent: []gax.CallOption{
424 gax.WithTimeout(60000 * time.Millisecond),
425 gax.WithRetry(func() gax.Retryer {
426 return gax.OnHTTPCodes(gax.Backoff{
427 Initial: 100 * time.Millisecond,
428 Max: 60000 * time.Millisecond,
429 Multiplier: 1.30,
430 },
431 http.StatusServiceUnavailable)
432 }),
433 },
434 GetLineageEvent: []gax.CallOption{
435 gax.WithTimeout(60000 * time.Millisecond),
436 gax.WithRetry(func() gax.Retryer {
437 return gax.OnHTTPCodes(gax.Backoff{
438 Initial: 100 * time.Millisecond,
439 Max: 60000 * time.Millisecond,
440 Multiplier: 1.30,
441 },
442 http.StatusServiceUnavailable)
443 }),
444 },
445 ListLineageEvents: []gax.CallOption{
446 gax.WithTimeout(60000 * time.Millisecond),
447 gax.WithRetry(func() gax.Retryer {
448 return gax.OnHTTPCodes(gax.Backoff{
449 Initial: 100 * time.Millisecond,
450 Max: 60000 * time.Millisecond,
451 Multiplier: 1.30,
452 },
453 http.StatusServiceUnavailable)
454 }),
455 },
456 DeleteLineageEvent: []gax.CallOption{
457 gax.WithTimeout(60000 * time.Millisecond),
458 gax.WithRetry(func() gax.Retryer {
459 return gax.OnHTTPCodes(gax.Backoff{
460 Initial: 100 * time.Millisecond,
461 Max: 60000 * time.Millisecond,
462 Multiplier: 1.30,
463 },
464 http.StatusServiceUnavailable)
465 }),
466 },
467 SearchLinks: []gax.CallOption{
468 gax.WithTimeout(60000 * time.Millisecond),
469 gax.WithRetry(func() gax.Retryer {
470 return gax.OnHTTPCodes(gax.Backoff{
471 Initial: 100 * time.Millisecond,
472 Max: 60000 * time.Millisecond,
473 Multiplier: 1.30,
474 },
475 http.StatusServiceUnavailable)
476 }),
477 },
478 BatchSearchLinkProcesses: []gax.CallOption{
479 gax.WithTimeout(60000 * time.Millisecond),
480 gax.WithRetry(func() gax.Retryer {
481 return gax.OnHTTPCodes(gax.Backoff{
482 Initial: 100 * time.Millisecond,
483 Max: 60000 * time.Millisecond,
484 Multiplier: 1.30,
485 },
486 http.StatusServiceUnavailable)
487 }),
488 },
489 CancelOperation: []gax.CallOption{},
490 DeleteOperation: []gax.CallOption{},
491 GetOperation: []gax.CallOption{},
492 ListOperations: []gax.CallOption{},
493 }
494 }
495
496 // internalClient is an interface that defines the methods available from Data Lineage API.
497 type internalClient interface {
498 Close() error
499 setGoogleClientInfo(...string)
500 Connection() *grpc.ClientConn
501 ProcessOpenLineageRunEvent(context.Context, *lineagepb.ProcessOpenLineageRunEventRequest, ...gax.CallOption) (*lineagepb.ProcessOpenLineageRunEventResponse, error)
502 CreateProcess(context.Context, *lineagepb.CreateProcessRequest, ...gax.CallOption) (*lineagepb.Process, error)
503 UpdateProcess(context.Context, *lineagepb.UpdateProcessRequest, ...gax.CallOption) (*lineagepb.Process, error)
504 GetProcess(context.Context, *lineagepb.GetProcessRequest, ...gax.CallOption) (*lineagepb.Process, error)
505 ListProcesses(context.Context, *lineagepb.ListProcessesRequest, ...gax.CallOption) *ProcessIterator
506 DeleteProcess(context.Context, *lineagepb.DeleteProcessRequest, ...gax.CallOption) (*DeleteProcessOperation, error)
507 DeleteProcessOperation(name string) *DeleteProcessOperation
508 CreateRun(context.Context, *lineagepb.CreateRunRequest, ...gax.CallOption) (*lineagepb.Run, error)
509 UpdateRun(context.Context, *lineagepb.UpdateRunRequest, ...gax.CallOption) (*lineagepb.Run, error)
510 GetRun(context.Context, *lineagepb.GetRunRequest, ...gax.CallOption) (*lineagepb.Run, error)
511 ListRuns(context.Context, *lineagepb.ListRunsRequest, ...gax.CallOption) *RunIterator
512 DeleteRun(context.Context, *lineagepb.DeleteRunRequest, ...gax.CallOption) (*DeleteRunOperation, error)
513 DeleteRunOperation(name string) *DeleteRunOperation
514 CreateLineageEvent(context.Context, *lineagepb.CreateLineageEventRequest, ...gax.CallOption) (*lineagepb.LineageEvent, error)
515 GetLineageEvent(context.Context, *lineagepb.GetLineageEventRequest, ...gax.CallOption) (*lineagepb.LineageEvent, error)
516 ListLineageEvents(context.Context, *lineagepb.ListLineageEventsRequest, ...gax.CallOption) *LineageEventIterator
517 DeleteLineageEvent(context.Context, *lineagepb.DeleteLineageEventRequest, ...gax.CallOption) error
518 SearchLinks(context.Context, *lineagepb.SearchLinksRequest, ...gax.CallOption) *LinkIterator
519 BatchSearchLinkProcesses(context.Context, *lineagepb.BatchSearchLinkProcessesRequest, ...gax.CallOption) *ProcessLinksIterator
520 CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error
521 DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error
522 GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
523 ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator
524 }
525
526 // Client is a client for interacting with Data Lineage API.
527 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
528 //
529 // Lineage is used to track data flows between assets over time. You can
530 // create LineageEvents
531 // to record lineage between multiple sources and a single target, for
532 // example, when table data is based on data from multiple tables.
533 type Client struct {
534 // The internal transport-dependent client.
535 internalClient internalClient
536
537 // The call options for this service.
538 CallOptions *CallOptions
539
540 // LROClient is used internally to handle long-running operations.
541 // It is exposed so that its CallOptions can be modified if required.
542 // Users should not Close this client.
543 LROClient *lroauto.OperationsClient
544 }
545
546 // Wrapper methods routed to the internal client.
547
548 // Close closes the connection to the API service. The user should invoke this when
549 // the client is no longer required.
550 func (c *Client) Close() error {
551 return c.internalClient.Close()
552 }
553
554 // setGoogleClientInfo sets the name and version of the application in
555 // the `x-goog-api-client` header passed on each request. Intended for
556 // use by Google-written clients.
557 func (c *Client) setGoogleClientInfo(keyval ...string) {
558 c.internalClient.setGoogleClientInfo(keyval...)
559 }
560
561 // Connection returns a connection to the API service.
562 //
563 // Deprecated: Connections are now pooled so this method does not always
564 // return the same resource.
565 func (c *Client) Connection() *grpc.ClientConn {
566 return c.internalClient.Connection()
567 }
568
569 // ProcessOpenLineageRunEvent creates new lineage events together with their parents: process and run.
570 // Updates the process and run if they already exist.
571 // Mapped from Open Lineage specification:
572 // https://github.com/OpenLineage/OpenLineage/blob/main/spec/OpenLineage.json (at https://github.com/OpenLineage/OpenLineage/blob/main/spec/OpenLineage.json).
573 func (c *Client) ProcessOpenLineageRunEvent(ctx context.Context, req *lineagepb.ProcessOpenLineageRunEventRequest, opts ...gax.CallOption) (*lineagepb.ProcessOpenLineageRunEventResponse, error) {
574 return c.internalClient.ProcessOpenLineageRunEvent(ctx, req, opts...)
575 }
576
577 // CreateProcess creates a new process.
578 func (c *Client) CreateProcess(ctx context.Context, req *lineagepb.CreateProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) {
579 return c.internalClient.CreateProcess(ctx, req, opts...)
580 }
581
582 // UpdateProcess updates a process.
583 func (c *Client) UpdateProcess(ctx context.Context, req *lineagepb.UpdateProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) {
584 return c.internalClient.UpdateProcess(ctx, req, opts...)
585 }
586
587 // GetProcess gets the details of the specified process.
588 func (c *Client) GetProcess(ctx context.Context, req *lineagepb.GetProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) {
589 return c.internalClient.GetProcess(ctx, req, opts...)
590 }
591
592 // ListProcesses list processes in the given project and location. List order is descending
593 // by insertion time.
594 func (c *Client) ListProcesses(ctx context.Context, req *lineagepb.ListProcessesRequest, opts ...gax.CallOption) *ProcessIterator {
595 return c.internalClient.ListProcesses(ctx, req, opts...)
596 }
597
598 // DeleteProcess deletes the process with the specified name.
599 func (c *Client) DeleteProcess(ctx context.Context, req *lineagepb.DeleteProcessRequest, opts ...gax.CallOption) (*DeleteProcessOperation, error) {
600 return c.internalClient.DeleteProcess(ctx, req, opts...)
601 }
602
603 // DeleteProcessOperation returns a new DeleteProcessOperation from a given name.
604 // The name must be that of a previously created DeleteProcessOperation, possibly from a different process.
605 func (c *Client) DeleteProcessOperation(name string) *DeleteProcessOperation {
606 return c.internalClient.DeleteProcessOperation(name)
607 }
608
609 // CreateRun creates a new run.
610 func (c *Client) CreateRun(ctx context.Context, req *lineagepb.CreateRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) {
611 return c.internalClient.CreateRun(ctx, req, opts...)
612 }
613
614 // UpdateRun updates a run.
615 func (c *Client) UpdateRun(ctx context.Context, req *lineagepb.UpdateRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) {
616 return c.internalClient.UpdateRun(ctx, req, opts...)
617 }
618
619 // GetRun gets the details of the specified run.
620 func (c *Client) GetRun(ctx context.Context, req *lineagepb.GetRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) {
621 return c.internalClient.GetRun(ctx, req, opts...)
622 }
623
624 // ListRuns lists runs in the given project and location. List order is descending by
625 // start_time.
626 func (c *Client) ListRuns(ctx context.Context, req *lineagepb.ListRunsRequest, opts ...gax.CallOption) *RunIterator {
627 return c.internalClient.ListRuns(ctx, req, opts...)
628 }
629
630 // DeleteRun deletes the run with the specified name.
631 func (c *Client) DeleteRun(ctx context.Context, req *lineagepb.DeleteRunRequest, opts ...gax.CallOption) (*DeleteRunOperation, error) {
632 return c.internalClient.DeleteRun(ctx, req, opts...)
633 }
634
635 // DeleteRunOperation returns a new DeleteRunOperation from a given name.
636 // The name must be that of a previously created DeleteRunOperation, possibly from a different process.
637 func (c *Client) DeleteRunOperation(name string) *DeleteRunOperation {
638 return c.internalClient.DeleteRunOperation(name)
639 }
640
641 // CreateLineageEvent creates a new lineage event.
642 func (c *Client) CreateLineageEvent(ctx context.Context, req *lineagepb.CreateLineageEventRequest, opts ...gax.CallOption) (*lineagepb.LineageEvent, error) {
643 return c.internalClient.CreateLineageEvent(ctx, req, opts...)
644 }
645
646 // GetLineageEvent gets details of a specified lineage event.
647 func (c *Client) GetLineageEvent(ctx context.Context, req *lineagepb.GetLineageEventRequest, opts ...gax.CallOption) (*lineagepb.LineageEvent, error) {
648 return c.internalClient.GetLineageEvent(ctx, req, opts...)
649 }
650
651 // ListLineageEvents lists lineage events in the given project and location. The list order is
652 // not defined.
653 func (c *Client) ListLineageEvents(ctx context.Context, req *lineagepb.ListLineageEventsRequest, opts ...gax.CallOption) *LineageEventIterator {
654 return c.internalClient.ListLineageEvents(ctx, req, opts...)
655 }
656
657 // DeleteLineageEvent deletes the lineage event with the specified name.
658 func (c *Client) DeleteLineageEvent(ctx context.Context, req *lineagepb.DeleteLineageEventRequest, opts ...gax.CallOption) error {
659 return c.internalClient.DeleteLineageEvent(ctx, req, opts...)
660 }
661
662 // SearchLinks retrieve a list of links connected to a specific asset.
663 // Links represent the data flow between source (upstream)
664 // and target (downstream) assets in transformation pipelines.
665 // Links are stored in the same project as the Lineage Events that create
666 // them.
667 //
668 // You can retrieve links in every project where you have the
669 // datalineage.events.get permission. The project provided in the URL
670 // is used for Billing and Quota.
671 func (c *Client) SearchLinks(ctx context.Context, req *lineagepb.SearchLinksRequest, opts ...gax.CallOption) *LinkIterator {
672 return c.internalClient.SearchLinks(ctx, req, opts...)
673 }
674
675 // BatchSearchLinkProcesses retrieve information about LineageProcesses associated with specific
676 // links. LineageProcesses are transformation pipelines that result in data
677 // flowing from source to target assets. Links between assets
678 // represent this operation.
679 //
680 // If you have specific link names, you can use this method to
681 // verify which LineageProcesses contribute to creating those links.
682 // See the
683 // SearchLinks
684 // method for more information on how to retrieve link name.
685 //
686 // You can retrieve the LineageProcess information in every project where you
687 // have the datalineage.events.get permission. The project provided in the
688 // URL is used for Billing and Quota.
689 func (c *Client) BatchSearchLinkProcesses(ctx context.Context, req *lineagepb.BatchSearchLinkProcessesRequest, opts ...gax.CallOption) *ProcessLinksIterator {
690 return c.internalClient.BatchSearchLinkProcesses(ctx, req, opts...)
691 }
692
693 // CancelOperation is a utility method from google.longrunning.Operations.
694 func (c *Client) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
695 return c.internalClient.CancelOperation(ctx, req, opts...)
696 }
697
698 // DeleteOperation is a utility method from google.longrunning.Operations.
699 func (c *Client) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
700 return c.internalClient.DeleteOperation(ctx, req, opts...)
701 }
702
703 // GetOperation is a utility method from google.longrunning.Operations.
704 func (c *Client) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
705 return c.internalClient.GetOperation(ctx, req, opts...)
706 }
707
708 // ListOperations is a utility method from google.longrunning.Operations.
709 func (c *Client) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
710 return c.internalClient.ListOperations(ctx, req, opts...)
711 }
712
713 // gRPCClient is a client for interacting with Data Lineage API over gRPC transport.
714 //
715 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
716 type gRPCClient struct {
717 // Connection pool of gRPC connections to the service.
718 connPool gtransport.ConnPool
719
720 // Points back to the CallOptions field of the containing Client
721 CallOptions **CallOptions
722
723 // The gRPC API client.
724 client lineagepb.LineageClient
725
726 // LROClient is used internally to handle long-running operations.
727 // It is exposed so that its CallOptions can be modified if required.
728 // Users should not Close this client.
729 LROClient **lroauto.OperationsClient
730
731 operationsClient longrunningpb.OperationsClient
732
733 // The x-goog-* metadata to be sent with each request.
734 xGoogHeaders []string
735
736 logger *slog.Logger
737 }
738
739 // NewClient creates a new lineage client based on gRPC.
740 // The returned client must be Closed when it is done being used to clean up its underlying connections.
741 //
742 // Lineage is used to track data flows between assets over time. You can
743 // create LineageEvents
744 // to record lineage between multiple sources and a single target, for
745 // example, when table data is based on data from multiple tables.
746 func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
747 clientOpts := defaultGRPCClientOptions()
748 if newClientHook != nil {
749 hookOpts, err := newClientHook(ctx, clientHookParams{})
750 if err != nil {
751 return nil, err
752 }
753 clientOpts = append(clientOpts, hookOpts...)
754 }
755
756 connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
757 if err != nil {
758 return nil, err
759 }
760 client := Client{CallOptions: defaultCallOptions()}
761
762 c := &gRPCClient{
763 connPool: connPool,
764 client: lineagepb.NewLineageClient(connPool),
765 CallOptions: &client.CallOptions,
766 logger: internaloption.GetLogger(opts),
767 operationsClient: longrunningpb.NewOperationsClient(connPool),
768 }
769 c.setGoogleClientInfo()
770
771 client.internalClient = c
772
773 client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
774 if err != nil {
775 // This error "should not happen", since we are just reusing old connection pool
776 // and never actually need to dial.
777 // If this does happen, we could leak connp. However, we cannot close conn:
778 // If the user invoked the constructor with option.WithGRPCConn,
779 // we would close a connection that's still in use.
780 // TODO: investigate error conditions.
781 return nil, err
782 }
783 c.LROClient = &client.LROClient
784 return &client, nil
785 }
786
787 // Connection returns a connection to the API service.
788 //
789 // Deprecated: Connections are now pooled so this method does not always
790 // return the same resource.
791 func (c *gRPCClient) Connection() *grpc.ClientConn {
792 return c.connPool.Conn()
793 }
794
795 // setGoogleClientInfo sets the name and version of the application in
796 // the `x-goog-api-client` header passed on each request. Intended for
797 // use by Google-written clients.
798 func (c *gRPCClient) setGoogleClientInfo(keyval ...string) {
799 kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
800 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion)
801 c.xGoogHeaders = []string{
802 "x-goog-api-client", gax.XGoogHeader(kv...),
803 }
804 }
805
806 // Close closes the connection to the API service. The user should invoke this when
807 // the client is no longer required.
808 func (c *gRPCClient) Close() error {
809 return c.connPool.Close()
810 }
811
812 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
813 type restClient struct {
814 // The http endpoint to connect to.
815 endpoint string
816
817 // The http client.
818 httpClient *http.Client
819
820 // LROClient is used internally to handle long-running operations.
821 // It is exposed so that its CallOptions can be modified if required.
822 // Users should not Close this client.
823 LROClient **lroauto.OperationsClient
824
825 // The x-goog-* headers to be sent with each request.
826 xGoogHeaders []string
827
828 // Points back to the CallOptions field of the containing Client
829 CallOptions **CallOptions
830
831 logger *slog.Logger
832 }
833
834 // NewRESTClient creates a new lineage rest client.
835 //
836 // Lineage is used to track data flows between assets over time. You can
837 // create LineageEvents
838 // to record lineage between multiple sources and a single target, for
839 // example, when table data is based on data from multiple tables.
840 func NewRESTClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
841 clientOpts := append(defaultRESTClientOptions(), opts...)
842 httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
843 if err != nil {
844 return nil, err
845 }
846
847 callOpts := defaultRESTCallOptions()
848 c := &restClient{
849 endpoint: endpoint,
850 httpClient: httpClient,
851 CallOptions: &callOpts,
852 logger: internaloption.GetLogger(opts),
853 }
854 c.setGoogleClientInfo()
855
856 lroOpts := []option.ClientOption{
857 option.WithHTTPClient(httpClient),
858 option.WithEndpoint(endpoint),
859 }
860 opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...)
861 if err != nil {
862 return nil, err
863 }
864 c.LROClient = &opClient
865
866 return &Client{internalClient: c, CallOptions: callOpts}, nil
867 }
868
869 func defaultRESTClientOptions() []option.ClientOption {
870 return []option.ClientOption{
871 internaloption.WithDefaultEndpoint("https://datalineage.googleapis.com"),
872 internaloption.WithDefaultEndpointTemplate("https://datalineage.UNIVERSE_DOMAIN"),
873 internaloption.WithDefaultMTLSEndpoint("https://datalineage.mtls.googleapis.com"),
874 internaloption.WithDefaultUniverseDomain("googleapis.com"),
875 internaloption.WithDefaultAudience("https://datalineage.googleapis.com/"),
876 internaloption.WithDefaultScopes(DefaultAuthScopes()...),
877 internaloption.EnableNewAuthLibrary(),
878 }
879 }
880
881 // setGoogleClientInfo sets the name and version of the application in
882 // the `x-goog-api-client` header passed on each request. Intended for
883 // use by Google-written clients.
884 func (c *restClient) setGoogleClientInfo(keyval ...string) {
885 kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
886 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN", "pb", protoVersion)
887 c.xGoogHeaders = []string{
888 "x-goog-api-client", gax.XGoogHeader(kv...),
889 }
890 }
891
892 // Close closes the connection to the API service. The user should invoke this when
893 // the client is no longer required.
894 func (c *restClient) Close() error {
895 // Replace httpClient with nil to force cleanup.
896 c.httpClient = nil
897 return nil
898 }
899
900 // Connection returns a connection to the API service.
901 //
902 // Deprecated: This method always returns nil.
903 func (c *restClient) Connection() *grpc.ClientConn {
904 return nil
905 }
906 func (c *gRPCClient) ProcessOpenLineageRunEvent(ctx context.Context, req *lineagepb.ProcessOpenLineageRunEventRequest, opts ...gax.CallOption) (*lineagepb.ProcessOpenLineageRunEventResponse, error) {
907 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
908
909 hds = append(c.xGoogHeaders, hds...)
910 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
911 opts = append((*c.CallOptions).ProcessOpenLineageRunEvent[0:len((*c.CallOptions).ProcessOpenLineageRunEvent):len((*c.CallOptions).ProcessOpenLineageRunEvent)], opts...)
912 var resp *lineagepb.ProcessOpenLineageRunEventResponse
913 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
914 var err error
915 resp, err = executeRPC(ctx, c.client.ProcessOpenLineageRunEvent, req, settings.GRPC, c.logger, "ProcessOpenLineageRunEvent")
916 return err
917 }, opts...)
918 if err != nil {
919 return nil, err
920 }
921 return resp, nil
922 }
923
924 func (c *gRPCClient) CreateProcess(ctx context.Context, req *lineagepb.CreateProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) {
925 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
926
927 hds = append(c.xGoogHeaders, hds...)
928 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
929 opts = append((*c.CallOptions).CreateProcess[0:len((*c.CallOptions).CreateProcess):len((*c.CallOptions).CreateProcess)], opts...)
930 var resp *lineagepb.Process
931 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
932 var err error
933 resp, err = executeRPC(ctx, c.client.CreateProcess, req, settings.GRPC, c.logger, "CreateProcess")
934 return err
935 }, opts...)
936 if err != nil {
937 return nil, err
938 }
939 return resp, nil
940 }
941
942 func (c *gRPCClient) UpdateProcess(ctx context.Context, req *lineagepb.UpdateProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) {
943 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "process.name", url.QueryEscape(req.GetProcess().GetName()))}
944
945 hds = append(c.xGoogHeaders, hds...)
946 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
947 opts = append((*c.CallOptions).UpdateProcess[0:len((*c.CallOptions).UpdateProcess):len((*c.CallOptions).UpdateProcess)], opts...)
948 var resp *lineagepb.Process
949 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
950 var err error
951 resp, err = executeRPC(ctx, c.client.UpdateProcess, req, settings.GRPC, c.logger, "UpdateProcess")
952 return err
953 }, opts...)
954 if err != nil {
955 return nil, err
956 }
957 return resp, nil
958 }
959
960 func (c *gRPCClient) GetProcess(ctx context.Context, req *lineagepb.GetProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) {
961 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
962
963 hds = append(c.xGoogHeaders, hds...)
964 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
965 opts = append((*c.CallOptions).GetProcess[0:len((*c.CallOptions).GetProcess):len((*c.CallOptions).GetProcess)], opts...)
966 var resp *lineagepb.Process
967 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
968 var err error
969 resp, err = executeRPC(ctx, c.client.GetProcess, req, settings.GRPC, c.logger, "GetProcess")
970 return err
971 }, opts...)
972 if err != nil {
973 return nil, err
974 }
975 return resp, nil
976 }
977
978 func (c *gRPCClient) ListProcesses(ctx context.Context, req *lineagepb.ListProcessesRequest, opts ...gax.CallOption) *ProcessIterator {
979 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
980
981 hds = append(c.xGoogHeaders, hds...)
982 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
983 opts = append((*c.CallOptions).ListProcesses[0:len((*c.CallOptions).ListProcesses):len((*c.CallOptions).ListProcesses)], opts...)
984 it := &ProcessIterator{}
985 req = proto.Clone(req).(*lineagepb.ListProcessesRequest)
986 it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.Process, string, error) {
987 resp := &lineagepb.ListProcessesResponse{}
988 if pageToken != "" {
989 req.PageToken = pageToken
990 }
991 if pageSize > math.MaxInt32 {
992 req.PageSize = math.MaxInt32
993 } else if pageSize != 0 {
994 req.PageSize = int32(pageSize)
995 }
996 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
997 var err error
998 resp, err = executeRPC(ctx, c.client.ListProcesses, req, settings.GRPC, c.logger, "ListProcesses")
999 return err
1000 }, opts...)
1001 if err != nil {
1002 return nil, "", err
1003 }
1004
1005 it.Response = resp
1006 return resp.GetProcesses(), resp.GetNextPageToken(), nil
1007 }
1008 fetch := func(pageSize int, pageToken string) (string, error) {
1009 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1010 if err != nil {
1011 return "", err
1012 }
1013 it.items = append(it.items, items...)
1014 return nextPageToken, nil
1015 }
1016
1017 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1018 it.pageInfo.MaxSize = int(req.GetPageSize())
1019 it.pageInfo.Token = req.GetPageToken()
1020
1021 return it
1022 }
1023
1024 func (c *gRPCClient) DeleteProcess(ctx context.Context, req *lineagepb.DeleteProcessRequest, opts ...gax.CallOption) (*DeleteProcessOperation, error) {
1025 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1026
1027 hds = append(c.xGoogHeaders, hds...)
1028 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1029 opts = append((*c.CallOptions).DeleteProcess[0:len((*c.CallOptions).DeleteProcess):len((*c.CallOptions).DeleteProcess)], opts...)
1030 var resp *longrunningpb.Operation
1031 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1032 var err error
1033 resp, err = executeRPC(ctx, c.client.DeleteProcess, req, settings.GRPC, c.logger, "DeleteProcess")
1034 return err
1035 }, opts...)
1036 if err != nil {
1037 return nil, err
1038 }
1039 return &DeleteProcessOperation{
1040 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1041 }, nil
1042 }
1043
1044 func (c *gRPCClient) CreateRun(ctx context.Context, req *lineagepb.CreateRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) {
1045 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1046
1047 hds = append(c.xGoogHeaders, hds...)
1048 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1049 opts = append((*c.CallOptions).CreateRun[0:len((*c.CallOptions).CreateRun):len((*c.CallOptions).CreateRun)], opts...)
1050 var resp *lineagepb.Run
1051 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1052 var err error
1053 resp, err = executeRPC(ctx, c.client.CreateRun, req, settings.GRPC, c.logger, "CreateRun")
1054 return err
1055 }, opts...)
1056 if err != nil {
1057 return nil, err
1058 }
1059 return resp, nil
1060 }
1061
1062 func (c *gRPCClient) UpdateRun(ctx context.Context, req *lineagepb.UpdateRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) {
1063 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "run.name", url.QueryEscape(req.GetRun().GetName()))}
1064
1065 hds = append(c.xGoogHeaders, hds...)
1066 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1067 opts = append((*c.CallOptions).UpdateRun[0:len((*c.CallOptions).UpdateRun):len((*c.CallOptions).UpdateRun)], opts...)
1068 var resp *lineagepb.Run
1069 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1070 var err error
1071 resp, err = executeRPC(ctx, c.client.UpdateRun, req, settings.GRPC, c.logger, "UpdateRun")
1072 return err
1073 }, opts...)
1074 if err != nil {
1075 return nil, err
1076 }
1077 return resp, nil
1078 }
1079
1080 func (c *gRPCClient) GetRun(ctx context.Context, req *lineagepb.GetRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) {
1081 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1082
1083 hds = append(c.xGoogHeaders, hds...)
1084 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1085 opts = append((*c.CallOptions).GetRun[0:len((*c.CallOptions).GetRun):len((*c.CallOptions).GetRun)], opts...)
1086 var resp *lineagepb.Run
1087 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1088 var err error
1089 resp, err = executeRPC(ctx, c.client.GetRun, req, settings.GRPC, c.logger, "GetRun")
1090 return err
1091 }, opts...)
1092 if err != nil {
1093 return nil, err
1094 }
1095 return resp, nil
1096 }
1097
1098 func (c *gRPCClient) ListRuns(ctx context.Context, req *lineagepb.ListRunsRequest, opts ...gax.CallOption) *RunIterator {
1099 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1100
1101 hds = append(c.xGoogHeaders, hds...)
1102 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1103 opts = append((*c.CallOptions).ListRuns[0:len((*c.CallOptions).ListRuns):len((*c.CallOptions).ListRuns)], opts...)
1104 it := &RunIterator{}
1105 req = proto.Clone(req).(*lineagepb.ListRunsRequest)
1106 it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.Run, string, error) {
1107 resp := &lineagepb.ListRunsResponse{}
1108 if pageToken != "" {
1109 req.PageToken = pageToken
1110 }
1111 if pageSize > math.MaxInt32 {
1112 req.PageSize = math.MaxInt32
1113 } else if pageSize != 0 {
1114 req.PageSize = int32(pageSize)
1115 }
1116 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1117 var err error
1118 resp, err = executeRPC(ctx, c.client.ListRuns, req, settings.GRPC, c.logger, "ListRuns")
1119 return err
1120 }, opts...)
1121 if err != nil {
1122 return nil, "", err
1123 }
1124
1125 it.Response = resp
1126 return resp.GetRuns(), resp.GetNextPageToken(), nil
1127 }
1128 fetch := func(pageSize int, pageToken string) (string, error) {
1129 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1130 if err != nil {
1131 return "", err
1132 }
1133 it.items = append(it.items, items...)
1134 return nextPageToken, nil
1135 }
1136
1137 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1138 it.pageInfo.MaxSize = int(req.GetPageSize())
1139 it.pageInfo.Token = req.GetPageToken()
1140
1141 return it
1142 }
1143
1144 func (c *gRPCClient) DeleteRun(ctx context.Context, req *lineagepb.DeleteRunRequest, opts ...gax.CallOption) (*DeleteRunOperation, error) {
1145 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1146
1147 hds = append(c.xGoogHeaders, hds...)
1148 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1149 opts = append((*c.CallOptions).DeleteRun[0:len((*c.CallOptions).DeleteRun):len((*c.CallOptions).DeleteRun)], opts...)
1150 var resp *longrunningpb.Operation
1151 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1152 var err error
1153 resp, err = executeRPC(ctx, c.client.DeleteRun, req, settings.GRPC, c.logger, "DeleteRun")
1154 return err
1155 }, opts...)
1156 if err != nil {
1157 return nil, err
1158 }
1159 return &DeleteRunOperation{
1160 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1161 }, nil
1162 }
1163
1164 func (c *gRPCClient) CreateLineageEvent(ctx context.Context, req *lineagepb.CreateLineageEventRequest, opts ...gax.CallOption) (*lineagepb.LineageEvent, error) {
1165 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1166
1167 hds = append(c.xGoogHeaders, hds...)
1168 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1169 opts = append((*c.CallOptions).CreateLineageEvent[0:len((*c.CallOptions).CreateLineageEvent):len((*c.CallOptions).CreateLineageEvent)], opts...)
1170 var resp *lineagepb.LineageEvent
1171 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1172 var err error
1173 resp, err = executeRPC(ctx, c.client.CreateLineageEvent, req, settings.GRPC, c.logger, "CreateLineageEvent")
1174 return err
1175 }, opts...)
1176 if err != nil {
1177 return nil, err
1178 }
1179 return resp, nil
1180 }
1181
1182 func (c *gRPCClient) GetLineageEvent(ctx context.Context, req *lineagepb.GetLineageEventRequest, opts ...gax.CallOption) (*lineagepb.LineageEvent, error) {
1183 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1184
1185 hds = append(c.xGoogHeaders, hds...)
1186 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1187 opts = append((*c.CallOptions).GetLineageEvent[0:len((*c.CallOptions).GetLineageEvent):len((*c.CallOptions).GetLineageEvent)], opts...)
1188 var resp *lineagepb.LineageEvent
1189 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1190 var err error
1191 resp, err = executeRPC(ctx, c.client.GetLineageEvent, req, settings.GRPC, c.logger, "GetLineageEvent")
1192 return err
1193 }, opts...)
1194 if err != nil {
1195 return nil, err
1196 }
1197 return resp, nil
1198 }
1199
1200 func (c *gRPCClient) ListLineageEvents(ctx context.Context, req *lineagepb.ListLineageEventsRequest, opts ...gax.CallOption) *LineageEventIterator {
1201 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1202
1203 hds = append(c.xGoogHeaders, hds...)
1204 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1205 opts = append((*c.CallOptions).ListLineageEvents[0:len((*c.CallOptions).ListLineageEvents):len((*c.CallOptions).ListLineageEvents)], opts...)
1206 it := &LineageEventIterator{}
1207 req = proto.Clone(req).(*lineagepb.ListLineageEventsRequest)
1208 it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.LineageEvent, string, error) {
1209 resp := &lineagepb.ListLineageEventsResponse{}
1210 if pageToken != "" {
1211 req.PageToken = pageToken
1212 }
1213 if pageSize > math.MaxInt32 {
1214 req.PageSize = math.MaxInt32
1215 } else if pageSize != 0 {
1216 req.PageSize = int32(pageSize)
1217 }
1218 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1219 var err error
1220 resp, err = executeRPC(ctx, c.client.ListLineageEvents, req, settings.GRPC, c.logger, "ListLineageEvents")
1221 return err
1222 }, opts...)
1223 if err != nil {
1224 return nil, "", err
1225 }
1226
1227 it.Response = resp
1228 return resp.GetLineageEvents(), resp.GetNextPageToken(), nil
1229 }
1230 fetch := func(pageSize int, pageToken string) (string, error) {
1231 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1232 if err != nil {
1233 return "", err
1234 }
1235 it.items = append(it.items, items...)
1236 return nextPageToken, nil
1237 }
1238
1239 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1240 it.pageInfo.MaxSize = int(req.GetPageSize())
1241 it.pageInfo.Token = req.GetPageToken()
1242
1243 return it
1244 }
1245
1246 func (c *gRPCClient) DeleteLineageEvent(ctx context.Context, req *lineagepb.DeleteLineageEventRequest, opts ...gax.CallOption) error {
1247 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1248
1249 hds = append(c.xGoogHeaders, hds...)
1250 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1251 opts = append((*c.CallOptions).DeleteLineageEvent[0:len((*c.CallOptions).DeleteLineageEvent):len((*c.CallOptions).DeleteLineageEvent)], opts...)
1252 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1253 var err error
1254 _, err = executeRPC(ctx, c.client.DeleteLineageEvent, req, settings.GRPC, c.logger, "DeleteLineageEvent")
1255 return err
1256 }, opts...)
1257 return err
1258 }
1259
1260 func (c *gRPCClient) SearchLinks(ctx context.Context, req *lineagepb.SearchLinksRequest, opts ...gax.CallOption) *LinkIterator {
1261 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1262
1263 hds = append(c.xGoogHeaders, hds...)
1264 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1265 opts = append((*c.CallOptions).SearchLinks[0:len((*c.CallOptions).SearchLinks):len((*c.CallOptions).SearchLinks)], opts...)
1266 it := &LinkIterator{}
1267 req = proto.Clone(req).(*lineagepb.SearchLinksRequest)
1268 it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.Link, string, error) {
1269 resp := &lineagepb.SearchLinksResponse{}
1270 if pageToken != "" {
1271 req.PageToken = pageToken
1272 }
1273 if pageSize > math.MaxInt32 {
1274 req.PageSize = math.MaxInt32
1275 } else if pageSize != 0 {
1276 req.PageSize = int32(pageSize)
1277 }
1278 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1279 var err error
1280 resp, err = executeRPC(ctx, c.client.SearchLinks, req, settings.GRPC, c.logger, "SearchLinks")
1281 return err
1282 }, opts...)
1283 if err != nil {
1284 return nil, "", err
1285 }
1286
1287 it.Response = resp
1288 return resp.GetLinks(), resp.GetNextPageToken(), nil
1289 }
1290 fetch := func(pageSize int, pageToken string) (string, error) {
1291 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1292 if err != nil {
1293 return "", err
1294 }
1295 it.items = append(it.items, items...)
1296 return nextPageToken, nil
1297 }
1298
1299 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1300 it.pageInfo.MaxSize = int(req.GetPageSize())
1301 it.pageInfo.Token = req.GetPageToken()
1302
1303 return it
1304 }
1305
1306 func (c *gRPCClient) BatchSearchLinkProcesses(ctx context.Context, req *lineagepb.BatchSearchLinkProcessesRequest, opts ...gax.CallOption) *ProcessLinksIterator {
1307 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1308
1309 hds = append(c.xGoogHeaders, hds...)
1310 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1311 opts = append((*c.CallOptions).BatchSearchLinkProcesses[0:len((*c.CallOptions).BatchSearchLinkProcesses):len((*c.CallOptions).BatchSearchLinkProcesses)], opts...)
1312 it := &ProcessLinksIterator{}
1313 req = proto.Clone(req).(*lineagepb.BatchSearchLinkProcessesRequest)
1314 it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.ProcessLinks, string, error) {
1315 resp := &lineagepb.BatchSearchLinkProcessesResponse{}
1316 if pageToken != "" {
1317 req.PageToken = pageToken
1318 }
1319 if pageSize > math.MaxInt32 {
1320 req.PageSize = math.MaxInt32
1321 } else if pageSize != 0 {
1322 req.PageSize = int32(pageSize)
1323 }
1324 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1325 var err error
1326 resp, err = executeRPC(ctx, c.client.BatchSearchLinkProcesses, req, settings.GRPC, c.logger, "BatchSearchLinkProcesses")
1327 return err
1328 }, opts...)
1329 if err != nil {
1330 return nil, "", err
1331 }
1332
1333 it.Response = resp
1334 return resp.GetProcessLinks(), resp.GetNextPageToken(), nil
1335 }
1336 fetch := func(pageSize int, pageToken string) (string, error) {
1337 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1338 if err != nil {
1339 return "", err
1340 }
1341 it.items = append(it.items, items...)
1342 return nextPageToken, nil
1343 }
1344
1345 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1346 it.pageInfo.MaxSize = int(req.GetPageSize())
1347 it.pageInfo.Token = req.GetPageToken()
1348
1349 return it
1350 }
1351
1352 func (c *gRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
1353 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1354
1355 hds = append(c.xGoogHeaders, hds...)
1356 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1357 opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...)
1358 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1359 var err error
1360 _, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation")
1361 return err
1362 }, opts...)
1363 return err
1364 }
1365
1366 func (c *gRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
1367 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1368
1369 hds = append(c.xGoogHeaders, hds...)
1370 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1371 opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...)
1372 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1373 var err error
1374 _, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation")
1375 return err
1376 }, opts...)
1377 return err
1378 }
1379
1380 func (c *gRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
1381 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1382
1383 hds = append(c.xGoogHeaders, hds...)
1384 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1385 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
1386 var resp *longrunningpb.Operation
1387 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1388 var err error
1389 resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation")
1390 return err
1391 }, opts...)
1392 if err != nil {
1393 return nil, err
1394 }
1395 return resp, nil
1396 }
1397
1398 func (c *gRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
1399 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1400
1401 hds = append(c.xGoogHeaders, hds...)
1402 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1403 opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...)
1404 it := &OperationIterator{}
1405 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
1406 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
1407 resp := &longrunningpb.ListOperationsResponse{}
1408 if pageToken != "" {
1409 req.PageToken = pageToken
1410 }
1411 if pageSize > math.MaxInt32 {
1412 req.PageSize = math.MaxInt32
1413 } else if pageSize != 0 {
1414 req.PageSize = int32(pageSize)
1415 }
1416 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1417 var err error
1418 resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations")
1419 return err
1420 }, opts...)
1421 if err != nil {
1422 return nil, "", err
1423 }
1424
1425 it.Response = resp
1426 return resp.GetOperations(), resp.GetNextPageToken(), nil
1427 }
1428 fetch := func(pageSize int, pageToken string) (string, error) {
1429 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1430 if err != nil {
1431 return "", err
1432 }
1433 it.items = append(it.items, items...)
1434 return nextPageToken, nil
1435 }
1436
1437 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1438 it.pageInfo.MaxSize = int(req.GetPageSize())
1439 it.pageInfo.Token = req.GetPageToken()
1440
1441 return it
1442 }
1443
1444 // ProcessOpenLineageRunEvent creates new lineage events together with their parents: process and run.
1445 // Updates the process and run if they already exist.
1446 // Mapped from Open Lineage specification:
1447 // https://github.com/OpenLineage/OpenLineage/blob/main/spec/OpenLineage.json (at https://github.com/OpenLineage/OpenLineage/blob/main/spec/OpenLineage.json).
1448 func (c *restClient) ProcessOpenLineageRunEvent(ctx context.Context, req *lineagepb.ProcessOpenLineageRunEventRequest, opts ...gax.CallOption) (*lineagepb.ProcessOpenLineageRunEventResponse, error) {
1449 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1450 body := req.GetOpenLineage()
1451 jsonReq, err := m.Marshal(body)
1452 if err != nil {
1453 return nil, err
1454 }
1455
1456 baseUrl, err := url.Parse(c.endpoint)
1457 if err != nil {
1458 return nil, err
1459 }
1460 baseUrl.Path += fmt.Sprintf("/v1/%v:processOpenLineageRunEvent", req.GetParent())
1461
1462 params := url.Values{}
1463 params.Add("$alt", "json;enum-encoding=int")
1464 if req.GetRequestId() != "" {
1465 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
1466 }
1467
1468 baseUrl.RawQuery = params.Encode()
1469
1470 // Build HTTP headers from client and context metadata.
1471 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1472
1473 hds = append(c.xGoogHeaders, hds...)
1474 hds = append(hds, "Content-Type", "application/json")
1475 headers := gax.BuildHeaders(ctx, hds...)
1476 opts = append((*c.CallOptions).ProcessOpenLineageRunEvent[0:len((*c.CallOptions).ProcessOpenLineageRunEvent):len((*c.CallOptions).ProcessOpenLineageRunEvent)], opts...)
1477 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1478 resp := &lineagepb.ProcessOpenLineageRunEventResponse{}
1479 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1480 if settings.Path != "" {
1481 baseUrl.Path = settings.Path
1482 }
1483 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
1484 if err != nil {
1485 return err
1486 }
1487 httpReq = httpReq.WithContext(ctx)
1488 httpReq.Header = headers
1489
1490 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "ProcessOpenLineageRunEvent")
1491 if err != nil {
1492 return err
1493 }
1494
1495 if err := unm.Unmarshal(buf, resp); err != nil {
1496 return err
1497 }
1498
1499 return nil
1500 }, opts...)
1501 if e != nil {
1502 return nil, e
1503 }
1504 return resp, nil
1505 }
1506
1507 // CreateProcess creates a new process.
1508 func (c *restClient) CreateProcess(ctx context.Context, req *lineagepb.CreateProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) {
1509 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1510 body := req.GetProcess()
1511 jsonReq, err := m.Marshal(body)
1512 if err != nil {
1513 return nil, err
1514 }
1515
1516 baseUrl, err := url.Parse(c.endpoint)
1517 if err != nil {
1518 return nil, err
1519 }
1520 baseUrl.Path += fmt.Sprintf("/v1/%v/processes", req.GetParent())
1521
1522 params := url.Values{}
1523 params.Add("$alt", "json;enum-encoding=int")
1524 if req.GetRequestId() != "" {
1525 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
1526 }
1527
1528 baseUrl.RawQuery = params.Encode()
1529
1530 // Build HTTP headers from client and context metadata.
1531 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1532
1533 hds = append(c.xGoogHeaders, hds...)
1534 hds = append(hds, "Content-Type", "application/json")
1535 headers := gax.BuildHeaders(ctx, hds...)
1536 opts = append((*c.CallOptions).CreateProcess[0:len((*c.CallOptions).CreateProcess):len((*c.CallOptions).CreateProcess)], opts...)
1537 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1538 resp := &lineagepb.Process{}
1539 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1540 if settings.Path != "" {
1541 baseUrl.Path = settings.Path
1542 }
1543 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
1544 if err != nil {
1545 return err
1546 }
1547 httpReq = httpReq.WithContext(ctx)
1548 httpReq.Header = headers
1549
1550 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateProcess")
1551 if err != nil {
1552 return err
1553 }
1554
1555 if err := unm.Unmarshal(buf, resp); err != nil {
1556 return err
1557 }
1558
1559 return nil
1560 }, opts...)
1561 if e != nil {
1562 return nil, e
1563 }
1564 return resp, nil
1565 }
1566
1567 // UpdateProcess updates a process.
1568 func (c *restClient) UpdateProcess(ctx context.Context, req *lineagepb.UpdateProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) {
1569 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1570 body := req.GetProcess()
1571 jsonReq, err := m.Marshal(body)
1572 if err != nil {
1573 return nil, err
1574 }
1575
1576 baseUrl, err := url.Parse(c.endpoint)
1577 if err != nil {
1578 return nil, err
1579 }
1580 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetProcess().GetName())
1581
1582 params := url.Values{}
1583 params.Add("$alt", "json;enum-encoding=int")
1584 if req.GetAllowMissing() {
1585 params.Add("allowMissing", fmt.Sprintf("%v", req.GetAllowMissing()))
1586 }
1587 if req.GetUpdateMask() != nil {
1588 field, err := protojson.Marshal(req.GetUpdateMask())
1589 if err != nil {
1590 return nil, err
1591 }
1592 params.Add("updateMask", string(field[1:len(field)-1]))
1593 }
1594
1595 baseUrl.RawQuery = params.Encode()
1596
1597 // Build HTTP headers from client and context metadata.
1598 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "process.name", url.QueryEscape(req.GetProcess().GetName()))}
1599
1600 hds = append(c.xGoogHeaders, hds...)
1601 hds = append(hds, "Content-Type", "application/json")
1602 headers := gax.BuildHeaders(ctx, hds...)
1603 opts = append((*c.CallOptions).UpdateProcess[0:len((*c.CallOptions).UpdateProcess):len((*c.CallOptions).UpdateProcess)], opts...)
1604 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1605 resp := &lineagepb.Process{}
1606 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1607 if settings.Path != "" {
1608 baseUrl.Path = settings.Path
1609 }
1610 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
1611 if err != nil {
1612 return err
1613 }
1614 httpReq = httpReq.WithContext(ctx)
1615 httpReq.Header = headers
1616
1617 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateProcess")
1618 if err != nil {
1619 return err
1620 }
1621
1622 if err := unm.Unmarshal(buf, resp); err != nil {
1623 return err
1624 }
1625
1626 return nil
1627 }, opts...)
1628 if e != nil {
1629 return nil, e
1630 }
1631 return resp, nil
1632 }
1633
1634 // GetProcess gets the details of the specified process.
1635 func (c *restClient) GetProcess(ctx context.Context, req *lineagepb.GetProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) {
1636 baseUrl, err := url.Parse(c.endpoint)
1637 if err != nil {
1638 return nil, err
1639 }
1640 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
1641
1642 params := url.Values{}
1643 params.Add("$alt", "json;enum-encoding=int")
1644
1645 baseUrl.RawQuery = params.Encode()
1646
1647 // Build HTTP headers from client and context metadata.
1648 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1649
1650 hds = append(c.xGoogHeaders, hds...)
1651 hds = append(hds, "Content-Type", "application/json")
1652 headers := gax.BuildHeaders(ctx, hds...)
1653 opts = append((*c.CallOptions).GetProcess[0:len((*c.CallOptions).GetProcess):len((*c.CallOptions).GetProcess)], opts...)
1654 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1655 resp := &lineagepb.Process{}
1656 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1657 if settings.Path != "" {
1658 baseUrl.Path = settings.Path
1659 }
1660 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
1661 if err != nil {
1662 return err
1663 }
1664 httpReq = httpReq.WithContext(ctx)
1665 httpReq.Header = headers
1666
1667 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetProcess")
1668 if err != nil {
1669 return err
1670 }
1671
1672 if err := unm.Unmarshal(buf, resp); err != nil {
1673 return err
1674 }
1675
1676 return nil
1677 }, opts...)
1678 if e != nil {
1679 return nil, e
1680 }
1681 return resp, nil
1682 }
1683
1684 // ListProcesses list processes in the given project and location. List order is descending
1685 // by insertion time.
1686 func (c *restClient) ListProcesses(ctx context.Context, req *lineagepb.ListProcessesRequest, opts ...gax.CallOption) *ProcessIterator {
1687 it := &ProcessIterator{}
1688 req = proto.Clone(req).(*lineagepb.ListProcessesRequest)
1689 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1690 it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.Process, string, error) {
1691 resp := &lineagepb.ListProcessesResponse{}
1692 if pageToken != "" {
1693 req.PageToken = pageToken
1694 }
1695 if pageSize > math.MaxInt32 {
1696 req.PageSize = math.MaxInt32
1697 } else if pageSize != 0 {
1698 req.PageSize = int32(pageSize)
1699 }
1700 baseUrl, err := url.Parse(c.endpoint)
1701 if err != nil {
1702 return nil, "", err
1703 }
1704 baseUrl.Path += fmt.Sprintf("/v1/%v/processes", req.GetParent())
1705
1706 params := url.Values{}
1707 params.Add("$alt", "json;enum-encoding=int")
1708 if req.GetPageSize() != 0 {
1709 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
1710 }
1711 if req.GetPageToken() != "" {
1712 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
1713 }
1714
1715 baseUrl.RawQuery = params.Encode()
1716
1717 // Build HTTP headers from client and context metadata.
1718 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
1719 headers := gax.BuildHeaders(ctx, hds...)
1720 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1721 if settings.Path != "" {
1722 baseUrl.Path = settings.Path
1723 }
1724 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
1725 if err != nil {
1726 return err
1727 }
1728 httpReq.Header = headers
1729
1730 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListProcesses")
1731 if err != nil {
1732 return err
1733 }
1734 if err := unm.Unmarshal(buf, resp); err != nil {
1735 return err
1736 }
1737
1738 return nil
1739 }, opts...)
1740 if e != nil {
1741 return nil, "", e
1742 }
1743 it.Response = resp
1744 return resp.GetProcesses(), resp.GetNextPageToken(), nil
1745 }
1746
1747 fetch := func(pageSize int, pageToken string) (string, error) {
1748 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1749 if err != nil {
1750 return "", err
1751 }
1752 it.items = append(it.items, items...)
1753 return nextPageToken, nil
1754 }
1755
1756 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1757 it.pageInfo.MaxSize = int(req.GetPageSize())
1758 it.pageInfo.Token = req.GetPageToken()
1759
1760 return it
1761 }
1762
1763 // DeleteProcess deletes the process with the specified name.
1764 func (c *restClient) DeleteProcess(ctx context.Context, req *lineagepb.DeleteProcessRequest, opts ...gax.CallOption) (*DeleteProcessOperation, error) {
1765 baseUrl, err := url.Parse(c.endpoint)
1766 if err != nil {
1767 return nil, err
1768 }
1769 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
1770
1771 params := url.Values{}
1772 params.Add("$alt", "json;enum-encoding=int")
1773 if req.GetAllowMissing() {
1774 params.Add("allowMissing", fmt.Sprintf("%v", req.GetAllowMissing()))
1775 }
1776
1777 baseUrl.RawQuery = params.Encode()
1778
1779 // Build HTTP headers from client and context metadata.
1780 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1781
1782 hds = append(c.xGoogHeaders, hds...)
1783 hds = append(hds, "Content-Type", "application/json")
1784 headers := gax.BuildHeaders(ctx, hds...)
1785 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1786 resp := &longrunningpb.Operation{}
1787 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1788 if settings.Path != "" {
1789 baseUrl.Path = settings.Path
1790 }
1791 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
1792 if err != nil {
1793 return err
1794 }
1795 httpReq = httpReq.WithContext(ctx)
1796 httpReq.Header = headers
1797
1798 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteProcess")
1799 if err != nil {
1800 return err
1801 }
1802 if err := unm.Unmarshal(buf, resp); err != nil {
1803 return err
1804 }
1805
1806 return nil
1807 }, opts...)
1808 if e != nil {
1809 return nil, e
1810 }
1811
1812 override := fmt.Sprintf("/v1/%s", resp.GetName())
1813 return &DeleteProcessOperation{
1814 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1815 pollPath: override,
1816 }, nil
1817 }
1818
1819 // CreateRun creates a new run.
1820 func (c *restClient) CreateRun(ctx context.Context, req *lineagepb.CreateRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) {
1821 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1822 body := req.GetRun()
1823 jsonReq, err := m.Marshal(body)
1824 if err != nil {
1825 return nil, err
1826 }
1827
1828 baseUrl, err := url.Parse(c.endpoint)
1829 if err != nil {
1830 return nil, err
1831 }
1832 baseUrl.Path += fmt.Sprintf("/v1/%v/runs", req.GetParent())
1833
1834 params := url.Values{}
1835 params.Add("$alt", "json;enum-encoding=int")
1836 if req.GetRequestId() != "" {
1837 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
1838 }
1839
1840 baseUrl.RawQuery = params.Encode()
1841
1842 // Build HTTP headers from client and context metadata.
1843 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1844
1845 hds = append(c.xGoogHeaders, hds...)
1846 hds = append(hds, "Content-Type", "application/json")
1847 headers := gax.BuildHeaders(ctx, hds...)
1848 opts = append((*c.CallOptions).CreateRun[0:len((*c.CallOptions).CreateRun):len((*c.CallOptions).CreateRun)], opts...)
1849 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1850 resp := &lineagepb.Run{}
1851 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1852 if settings.Path != "" {
1853 baseUrl.Path = settings.Path
1854 }
1855 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
1856 if err != nil {
1857 return err
1858 }
1859 httpReq = httpReq.WithContext(ctx)
1860 httpReq.Header = headers
1861
1862 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateRun")
1863 if err != nil {
1864 return err
1865 }
1866
1867 if err := unm.Unmarshal(buf, resp); err != nil {
1868 return err
1869 }
1870
1871 return nil
1872 }, opts...)
1873 if e != nil {
1874 return nil, e
1875 }
1876 return resp, nil
1877 }
1878
1879 // UpdateRun updates a run.
1880 func (c *restClient) UpdateRun(ctx context.Context, req *lineagepb.UpdateRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) {
1881 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1882 body := req.GetRun()
1883 jsonReq, err := m.Marshal(body)
1884 if err != nil {
1885 return nil, err
1886 }
1887
1888 baseUrl, err := url.Parse(c.endpoint)
1889 if err != nil {
1890 return nil, err
1891 }
1892 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetRun().GetName())
1893
1894 params := url.Values{}
1895 params.Add("$alt", "json;enum-encoding=int")
1896 if req.GetAllowMissing() {
1897 params.Add("allowMissing", fmt.Sprintf("%v", req.GetAllowMissing()))
1898 }
1899 if req.GetUpdateMask() != nil {
1900 field, err := protojson.Marshal(req.GetUpdateMask())
1901 if err != nil {
1902 return nil, err
1903 }
1904 params.Add("updateMask", string(field[1:len(field)-1]))
1905 }
1906
1907 baseUrl.RawQuery = params.Encode()
1908
1909 // Build HTTP headers from client and context metadata.
1910 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "run.name", url.QueryEscape(req.GetRun().GetName()))}
1911
1912 hds = append(c.xGoogHeaders, hds...)
1913 hds = append(hds, "Content-Type", "application/json")
1914 headers := gax.BuildHeaders(ctx, hds...)
1915 opts = append((*c.CallOptions).UpdateRun[0:len((*c.CallOptions).UpdateRun):len((*c.CallOptions).UpdateRun)], opts...)
1916 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1917 resp := &lineagepb.Run{}
1918 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1919 if settings.Path != "" {
1920 baseUrl.Path = settings.Path
1921 }
1922 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
1923 if err != nil {
1924 return err
1925 }
1926 httpReq = httpReq.WithContext(ctx)
1927 httpReq.Header = headers
1928
1929 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateRun")
1930 if err != nil {
1931 return err
1932 }
1933
1934 if err := unm.Unmarshal(buf, resp); err != nil {
1935 return err
1936 }
1937
1938 return nil
1939 }, opts...)
1940 if e != nil {
1941 return nil, e
1942 }
1943 return resp, nil
1944 }
1945
1946 // GetRun gets the details of the specified run.
1947 func (c *restClient) GetRun(ctx context.Context, req *lineagepb.GetRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) {
1948 baseUrl, err := url.Parse(c.endpoint)
1949 if err != nil {
1950 return nil, err
1951 }
1952 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
1953
1954 params := url.Values{}
1955 params.Add("$alt", "json;enum-encoding=int")
1956
1957 baseUrl.RawQuery = params.Encode()
1958
1959 // Build HTTP headers from client and context metadata.
1960 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1961
1962 hds = append(c.xGoogHeaders, hds...)
1963 hds = append(hds, "Content-Type", "application/json")
1964 headers := gax.BuildHeaders(ctx, hds...)
1965 opts = append((*c.CallOptions).GetRun[0:len((*c.CallOptions).GetRun):len((*c.CallOptions).GetRun)], opts...)
1966 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1967 resp := &lineagepb.Run{}
1968 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1969 if settings.Path != "" {
1970 baseUrl.Path = settings.Path
1971 }
1972 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
1973 if err != nil {
1974 return err
1975 }
1976 httpReq = httpReq.WithContext(ctx)
1977 httpReq.Header = headers
1978
1979 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetRun")
1980 if err != nil {
1981 return err
1982 }
1983
1984 if err := unm.Unmarshal(buf, resp); err != nil {
1985 return err
1986 }
1987
1988 return nil
1989 }, opts...)
1990 if e != nil {
1991 return nil, e
1992 }
1993 return resp, nil
1994 }
1995
1996 // ListRuns lists runs in the given project and location. List order is descending by
1997 // start_time.
1998 func (c *restClient) ListRuns(ctx context.Context, req *lineagepb.ListRunsRequest, opts ...gax.CallOption) *RunIterator {
1999 it := &RunIterator{}
2000 req = proto.Clone(req).(*lineagepb.ListRunsRequest)
2001 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2002 it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.Run, string, error) {
2003 resp := &lineagepb.ListRunsResponse{}
2004 if pageToken != "" {
2005 req.PageToken = pageToken
2006 }
2007 if pageSize > math.MaxInt32 {
2008 req.PageSize = math.MaxInt32
2009 } else if pageSize != 0 {
2010 req.PageSize = int32(pageSize)
2011 }
2012 baseUrl, err := url.Parse(c.endpoint)
2013 if err != nil {
2014 return nil, "", err
2015 }
2016 baseUrl.Path += fmt.Sprintf("/v1/%v/runs", req.GetParent())
2017
2018 params := url.Values{}
2019 params.Add("$alt", "json;enum-encoding=int")
2020 if req.GetPageSize() != 0 {
2021 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
2022 }
2023 if req.GetPageToken() != "" {
2024 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
2025 }
2026
2027 baseUrl.RawQuery = params.Encode()
2028
2029 // Build HTTP headers from client and context metadata.
2030 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2031 headers := gax.BuildHeaders(ctx, hds...)
2032 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2033 if settings.Path != "" {
2034 baseUrl.Path = settings.Path
2035 }
2036 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2037 if err != nil {
2038 return err
2039 }
2040 httpReq.Header = headers
2041
2042 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListRuns")
2043 if err != nil {
2044 return err
2045 }
2046 if err := unm.Unmarshal(buf, resp); err != nil {
2047 return err
2048 }
2049
2050 return nil
2051 }, opts...)
2052 if e != nil {
2053 return nil, "", e
2054 }
2055 it.Response = resp
2056 return resp.GetRuns(), resp.GetNextPageToken(), nil
2057 }
2058
2059 fetch := func(pageSize int, pageToken string) (string, error) {
2060 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2061 if err != nil {
2062 return "", err
2063 }
2064 it.items = append(it.items, items...)
2065 return nextPageToken, nil
2066 }
2067
2068 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2069 it.pageInfo.MaxSize = int(req.GetPageSize())
2070 it.pageInfo.Token = req.GetPageToken()
2071
2072 return it
2073 }
2074
2075 // DeleteRun deletes the run with the specified name.
2076 func (c *restClient) DeleteRun(ctx context.Context, req *lineagepb.DeleteRunRequest, opts ...gax.CallOption) (*DeleteRunOperation, error) {
2077 baseUrl, err := url.Parse(c.endpoint)
2078 if err != nil {
2079 return nil, err
2080 }
2081 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2082
2083 params := url.Values{}
2084 params.Add("$alt", "json;enum-encoding=int")
2085 if req.GetAllowMissing() {
2086 params.Add("allowMissing", fmt.Sprintf("%v", req.GetAllowMissing()))
2087 }
2088
2089 baseUrl.RawQuery = params.Encode()
2090
2091 // Build HTTP headers from client and context metadata.
2092 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2093
2094 hds = append(c.xGoogHeaders, hds...)
2095 hds = append(hds, "Content-Type", "application/json")
2096 headers := gax.BuildHeaders(ctx, hds...)
2097 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2098 resp := &longrunningpb.Operation{}
2099 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2100 if settings.Path != "" {
2101 baseUrl.Path = settings.Path
2102 }
2103 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
2104 if err != nil {
2105 return err
2106 }
2107 httpReq = httpReq.WithContext(ctx)
2108 httpReq.Header = headers
2109
2110 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteRun")
2111 if err != nil {
2112 return err
2113 }
2114 if err := unm.Unmarshal(buf, resp); err != nil {
2115 return err
2116 }
2117
2118 return nil
2119 }, opts...)
2120 if e != nil {
2121 return nil, e
2122 }
2123
2124 override := fmt.Sprintf("/v1/%s", resp.GetName())
2125 return &DeleteRunOperation{
2126 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2127 pollPath: override,
2128 }, nil
2129 }
2130
2131 // CreateLineageEvent creates a new lineage event.
2132 func (c *restClient) CreateLineageEvent(ctx context.Context, req *lineagepb.CreateLineageEventRequest, opts ...gax.CallOption) (*lineagepb.LineageEvent, error) {
2133 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2134 body := req.GetLineageEvent()
2135 jsonReq, err := m.Marshal(body)
2136 if err != nil {
2137 return nil, err
2138 }
2139
2140 baseUrl, err := url.Parse(c.endpoint)
2141 if err != nil {
2142 return nil, err
2143 }
2144 baseUrl.Path += fmt.Sprintf("/v1/%v/lineageEvents", req.GetParent())
2145
2146 params := url.Values{}
2147 params.Add("$alt", "json;enum-encoding=int")
2148 if req.GetRequestId() != "" {
2149 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2150 }
2151
2152 baseUrl.RawQuery = params.Encode()
2153
2154 // Build HTTP headers from client and context metadata.
2155 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2156
2157 hds = append(c.xGoogHeaders, hds...)
2158 hds = append(hds, "Content-Type", "application/json")
2159 headers := gax.BuildHeaders(ctx, hds...)
2160 opts = append((*c.CallOptions).CreateLineageEvent[0:len((*c.CallOptions).CreateLineageEvent):len((*c.CallOptions).CreateLineageEvent)], opts...)
2161 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2162 resp := &lineagepb.LineageEvent{}
2163 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2164 if settings.Path != "" {
2165 baseUrl.Path = settings.Path
2166 }
2167 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2168 if err != nil {
2169 return err
2170 }
2171 httpReq = httpReq.WithContext(ctx)
2172 httpReq.Header = headers
2173
2174 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateLineageEvent")
2175 if err != nil {
2176 return err
2177 }
2178
2179 if err := unm.Unmarshal(buf, resp); err != nil {
2180 return err
2181 }
2182
2183 return nil
2184 }, opts...)
2185 if e != nil {
2186 return nil, e
2187 }
2188 return resp, nil
2189 }
2190
2191 // GetLineageEvent gets details of a specified lineage event.
2192 func (c *restClient) GetLineageEvent(ctx context.Context, req *lineagepb.GetLineageEventRequest, opts ...gax.CallOption) (*lineagepb.LineageEvent, error) {
2193 baseUrl, err := url.Parse(c.endpoint)
2194 if err != nil {
2195 return nil, err
2196 }
2197 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2198
2199 params := url.Values{}
2200 params.Add("$alt", "json;enum-encoding=int")
2201
2202 baseUrl.RawQuery = params.Encode()
2203
2204 // Build HTTP headers from client and context metadata.
2205 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2206
2207 hds = append(c.xGoogHeaders, hds...)
2208 hds = append(hds, "Content-Type", "application/json")
2209 headers := gax.BuildHeaders(ctx, hds...)
2210 opts = append((*c.CallOptions).GetLineageEvent[0:len((*c.CallOptions).GetLineageEvent):len((*c.CallOptions).GetLineageEvent)], opts...)
2211 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2212 resp := &lineagepb.LineageEvent{}
2213 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2214 if settings.Path != "" {
2215 baseUrl.Path = settings.Path
2216 }
2217 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2218 if err != nil {
2219 return err
2220 }
2221 httpReq = httpReq.WithContext(ctx)
2222 httpReq.Header = headers
2223
2224 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetLineageEvent")
2225 if err != nil {
2226 return err
2227 }
2228
2229 if err := unm.Unmarshal(buf, resp); err != nil {
2230 return err
2231 }
2232
2233 return nil
2234 }, opts...)
2235 if e != nil {
2236 return nil, e
2237 }
2238 return resp, nil
2239 }
2240
2241 // ListLineageEvents lists lineage events in the given project and location. The list order is
2242 // not defined.
2243 func (c *restClient) ListLineageEvents(ctx context.Context, req *lineagepb.ListLineageEventsRequest, opts ...gax.CallOption) *LineageEventIterator {
2244 it := &LineageEventIterator{}
2245 req = proto.Clone(req).(*lineagepb.ListLineageEventsRequest)
2246 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2247 it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.LineageEvent, string, error) {
2248 resp := &lineagepb.ListLineageEventsResponse{}
2249 if pageToken != "" {
2250 req.PageToken = pageToken
2251 }
2252 if pageSize > math.MaxInt32 {
2253 req.PageSize = math.MaxInt32
2254 } else if pageSize != 0 {
2255 req.PageSize = int32(pageSize)
2256 }
2257 baseUrl, err := url.Parse(c.endpoint)
2258 if err != nil {
2259 return nil, "", err
2260 }
2261 baseUrl.Path += fmt.Sprintf("/v1/%v/lineageEvents", req.GetParent())
2262
2263 params := url.Values{}
2264 params.Add("$alt", "json;enum-encoding=int")
2265 if req.GetPageSize() != 0 {
2266 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
2267 }
2268 if req.GetPageToken() != "" {
2269 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
2270 }
2271
2272 baseUrl.RawQuery = params.Encode()
2273
2274 // Build HTTP headers from client and context metadata.
2275 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2276 headers := gax.BuildHeaders(ctx, hds...)
2277 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2278 if settings.Path != "" {
2279 baseUrl.Path = settings.Path
2280 }
2281 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2282 if err != nil {
2283 return err
2284 }
2285 httpReq.Header = headers
2286
2287 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListLineageEvents")
2288 if err != nil {
2289 return err
2290 }
2291 if err := unm.Unmarshal(buf, resp); err != nil {
2292 return err
2293 }
2294
2295 return nil
2296 }, opts...)
2297 if e != nil {
2298 return nil, "", e
2299 }
2300 it.Response = resp
2301 return resp.GetLineageEvents(), resp.GetNextPageToken(), nil
2302 }
2303
2304 fetch := func(pageSize int, pageToken string) (string, error) {
2305 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2306 if err != nil {
2307 return "", err
2308 }
2309 it.items = append(it.items, items...)
2310 return nextPageToken, nil
2311 }
2312
2313 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2314 it.pageInfo.MaxSize = int(req.GetPageSize())
2315 it.pageInfo.Token = req.GetPageToken()
2316
2317 return it
2318 }
2319
2320 // DeleteLineageEvent deletes the lineage event with the specified name.
2321 func (c *restClient) DeleteLineageEvent(ctx context.Context, req *lineagepb.DeleteLineageEventRequest, opts ...gax.CallOption) error {
2322 baseUrl, err := url.Parse(c.endpoint)
2323 if err != nil {
2324 return err
2325 }
2326 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2327
2328 params := url.Values{}
2329 params.Add("$alt", "json;enum-encoding=int")
2330 if req.GetAllowMissing() {
2331 params.Add("allowMissing", fmt.Sprintf("%v", req.GetAllowMissing()))
2332 }
2333
2334 baseUrl.RawQuery = params.Encode()
2335
2336 // Build HTTP headers from client and context metadata.
2337 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2338
2339 hds = append(c.xGoogHeaders, hds...)
2340 hds = append(hds, "Content-Type", "application/json")
2341 headers := gax.BuildHeaders(ctx, hds...)
2342 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2343 if settings.Path != "" {
2344 baseUrl.Path = settings.Path
2345 }
2346 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
2347 if err != nil {
2348 return err
2349 }
2350 httpReq = httpReq.WithContext(ctx)
2351 httpReq.Header = headers
2352
2353 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteLineageEvent")
2354 return err
2355 }, opts...)
2356 }
2357
2358 // SearchLinks retrieve a list of links connected to a specific asset.
2359 // Links represent the data flow between source (upstream)
2360 // and target (downstream) assets in transformation pipelines.
2361 // Links are stored in the same project as the Lineage Events that create
2362 // them.
2363 //
2364 // You can retrieve links in every project where you have the
2365 // datalineage.events.get permission. The project provided in the URL
2366 // is used for Billing and Quota.
2367 func (c *restClient) SearchLinks(ctx context.Context, req *lineagepb.SearchLinksRequest, opts ...gax.CallOption) *LinkIterator {
2368 it := &LinkIterator{}
2369 req = proto.Clone(req).(*lineagepb.SearchLinksRequest)
2370 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2371 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2372 it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.Link, string, error) {
2373 resp := &lineagepb.SearchLinksResponse{}
2374 if pageToken != "" {
2375 req.PageToken = pageToken
2376 }
2377 if pageSize > math.MaxInt32 {
2378 req.PageSize = math.MaxInt32
2379 } else if pageSize != 0 {
2380 req.PageSize = int32(pageSize)
2381 }
2382 jsonReq, err := m.Marshal(req)
2383 if err != nil {
2384 return nil, "", err
2385 }
2386
2387 baseUrl, err := url.Parse(c.endpoint)
2388 if err != nil {
2389 return nil, "", err
2390 }
2391 baseUrl.Path += fmt.Sprintf("/v1/%v:searchLinks", req.GetParent())
2392
2393 params := url.Values{}
2394 params.Add("$alt", "json;enum-encoding=int")
2395
2396 baseUrl.RawQuery = params.Encode()
2397
2398 // Build HTTP headers from client and context metadata.
2399 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2400 headers := gax.BuildHeaders(ctx, hds...)
2401 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2402 if settings.Path != "" {
2403 baseUrl.Path = settings.Path
2404 }
2405 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2406 if err != nil {
2407 return err
2408 }
2409 httpReq.Header = headers
2410
2411 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "SearchLinks")
2412 if err != nil {
2413 return err
2414 }
2415 if err := unm.Unmarshal(buf, resp); err != nil {
2416 return err
2417 }
2418
2419 return nil
2420 }, opts...)
2421 if e != nil {
2422 return nil, "", e
2423 }
2424 it.Response = resp
2425 return resp.GetLinks(), resp.GetNextPageToken(), nil
2426 }
2427
2428 fetch := func(pageSize int, pageToken string) (string, error) {
2429 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2430 if err != nil {
2431 return "", err
2432 }
2433 it.items = append(it.items, items...)
2434 return nextPageToken, nil
2435 }
2436
2437 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2438 it.pageInfo.MaxSize = int(req.GetPageSize())
2439 it.pageInfo.Token = req.GetPageToken()
2440
2441 return it
2442 }
2443
2444 // BatchSearchLinkProcesses retrieve information about LineageProcesses associated with specific
2445 // links. LineageProcesses are transformation pipelines that result in data
2446 // flowing from source to target assets. Links between assets
2447 // represent this operation.
2448 //
2449 // If you have specific link names, you can use this method to
2450 // verify which LineageProcesses contribute to creating those links.
2451 // See the
2452 // SearchLinks
2453 // method for more information on how to retrieve link name.
2454 //
2455 // You can retrieve the LineageProcess information in every project where you
2456 // have the datalineage.events.get permission. The project provided in the
2457 // URL is used for Billing and Quota.
2458 func (c *restClient) BatchSearchLinkProcesses(ctx context.Context, req *lineagepb.BatchSearchLinkProcessesRequest, opts ...gax.CallOption) *ProcessLinksIterator {
2459 it := &ProcessLinksIterator{}
2460 req = proto.Clone(req).(*lineagepb.BatchSearchLinkProcessesRequest)
2461 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2462 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2463 it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.ProcessLinks, string, error) {
2464 resp := &lineagepb.BatchSearchLinkProcessesResponse{}
2465 if pageToken != "" {
2466 req.PageToken = pageToken
2467 }
2468 if pageSize > math.MaxInt32 {
2469 req.PageSize = math.MaxInt32
2470 } else if pageSize != 0 {
2471 req.PageSize = int32(pageSize)
2472 }
2473 jsonReq, err := m.Marshal(req)
2474 if err != nil {
2475 return nil, "", err
2476 }
2477
2478 baseUrl, err := url.Parse(c.endpoint)
2479 if err != nil {
2480 return nil, "", err
2481 }
2482 baseUrl.Path += fmt.Sprintf("/v1/%v:batchSearchLinkProcesses", req.GetParent())
2483
2484 params := url.Values{}
2485 params.Add("$alt", "json;enum-encoding=int")
2486
2487 baseUrl.RawQuery = params.Encode()
2488
2489 // Build HTTP headers from client and context metadata.
2490 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2491 headers := gax.BuildHeaders(ctx, hds...)
2492 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2493 if settings.Path != "" {
2494 baseUrl.Path = settings.Path
2495 }
2496 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2497 if err != nil {
2498 return err
2499 }
2500 httpReq.Header = headers
2501
2502 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "BatchSearchLinkProcesses")
2503 if err != nil {
2504 return err
2505 }
2506 if err := unm.Unmarshal(buf, resp); err != nil {
2507 return err
2508 }
2509
2510 return nil
2511 }, opts...)
2512 if e != nil {
2513 return nil, "", e
2514 }
2515 it.Response = resp
2516 return resp.GetProcessLinks(), resp.GetNextPageToken(), nil
2517 }
2518
2519 fetch := func(pageSize int, pageToken string) (string, error) {
2520 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2521 if err != nil {
2522 return "", err
2523 }
2524 it.items = append(it.items, items...)
2525 return nextPageToken, nil
2526 }
2527
2528 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2529 it.pageInfo.MaxSize = int(req.GetPageSize())
2530 it.pageInfo.Token = req.GetPageToken()
2531
2532 return it
2533 }
2534
2535 // CancelOperation is a utility method from google.longrunning.Operations.
2536 func (c *restClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
2537 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2538 jsonReq, err := m.Marshal(req)
2539 if err != nil {
2540 return err
2541 }
2542
2543 baseUrl, err := url.Parse(c.endpoint)
2544 if err != nil {
2545 return err
2546 }
2547 baseUrl.Path += fmt.Sprintf("/v1/%v:cancel", req.GetName())
2548
2549 params := url.Values{}
2550 params.Add("$alt", "json;enum-encoding=int")
2551
2552 baseUrl.RawQuery = params.Encode()
2553
2554 // Build HTTP headers from client and context metadata.
2555 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2556
2557 hds = append(c.xGoogHeaders, hds...)
2558 hds = append(hds, "Content-Type", "application/json")
2559 headers := gax.BuildHeaders(ctx, hds...)
2560 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2561 if settings.Path != "" {
2562 baseUrl.Path = settings.Path
2563 }
2564 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2565 if err != nil {
2566 return err
2567 }
2568 httpReq = httpReq.WithContext(ctx)
2569 httpReq.Header = headers
2570
2571 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CancelOperation")
2572 return err
2573 }, opts...)
2574 }
2575
2576 // DeleteOperation is a utility method from google.longrunning.Operations.
2577 func (c *restClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
2578 baseUrl, err := url.Parse(c.endpoint)
2579 if err != nil {
2580 return err
2581 }
2582 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2583
2584 params := url.Values{}
2585 params.Add("$alt", "json;enum-encoding=int")
2586
2587 baseUrl.RawQuery = params.Encode()
2588
2589 // Build HTTP headers from client and context metadata.
2590 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2591
2592 hds = append(c.xGoogHeaders, hds...)
2593 hds = append(hds, "Content-Type", "application/json")
2594 headers := gax.BuildHeaders(ctx, hds...)
2595 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2596 if settings.Path != "" {
2597 baseUrl.Path = settings.Path
2598 }
2599 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
2600 if err != nil {
2601 return err
2602 }
2603 httpReq = httpReq.WithContext(ctx)
2604 httpReq.Header = headers
2605
2606 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteOperation")
2607 return err
2608 }, opts...)
2609 }
2610
2611 // GetOperation is a utility method from google.longrunning.Operations.
2612 func (c *restClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
2613 baseUrl, err := url.Parse(c.endpoint)
2614 if err != nil {
2615 return nil, err
2616 }
2617 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2618
2619 params := url.Values{}
2620 params.Add("$alt", "json;enum-encoding=int")
2621
2622 baseUrl.RawQuery = params.Encode()
2623
2624 // Build HTTP headers from client and context metadata.
2625 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2626
2627 hds = append(c.xGoogHeaders, hds...)
2628 hds = append(hds, "Content-Type", "application/json")
2629 headers := gax.BuildHeaders(ctx, hds...)
2630 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
2631 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2632 resp := &longrunningpb.Operation{}
2633 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2634 if settings.Path != "" {
2635 baseUrl.Path = settings.Path
2636 }
2637 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2638 if err != nil {
2639 return err
2640 }
2641 httpReq = httpReq.WithContext(ctx)
2642 httpReq.Header = headers
2643
2644 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetOperation")
2645 if err != nil {
2646 return err
2647 }
2648
2649 if err := unm.Unmarshal(buf, resp); err != nil {
2650 return err
2651 }
2652
2653 return nil
2654 }, opts...)
2655 if e != nil {
2656 return nil, e
2657 }
2658 return resp, nil
2659 }
2660
2661 // ListOperations is a utility method from google.longrunning.Operations.
2662 func (c *restClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
2663 it := &OperationIterator{}
2664 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
2665 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2666 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
2667 resp := &longrunningpb.ListOperationsResponse{}
2668 if pageToken != "" {
2669 req.PageToken = pageToken
2670 }
2671 if pageSize > math.MaxInt32 {
2672 req.PageSize = math.MaxInt32
2673 } else if pageSize != 0 {
2674 req.PageSize = int32(pageSize)
2675 }
2676 baseUrl, err := url.Parse(c.endpoint)
2677 if err != nil {
2678 return nil, "", err
2679 }
2680 baseUrl.Path += fmt.Sprintf("/v1/%v/operations", req.GetName())
2681
2682 params := url.Values{}
2683 params.Add("$alt", "json;enum-encoding=int")
2684 if req.GetFilter() != "" {
2685 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
2686 }
2687 if req.GetPageSize() != 0 {
2688 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
2689 }
2690 if req.GetPageToken() != "" {
2691 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
2692 }
2693
2694 baseUrl.RawQuery = params.Encode()
2695
2696 // Build HTTP headers from client and context metadata.
2697 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2698 headers := gax.BuildHeaders(ctx, hds...)
2699 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2700 if settings.Path != "" {
2701 baseUrl.Path = settings.Path
2702 }
2703 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2704 if err != nil {
2705 return err
2706 }
2707 httpReq.Header = headers
2708
2709 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListOperations")
2710 if err != nil {
2711 return err
2712 }
2713 if err := unm.Unmarshal(buf, resp); err != nil {
2714 return err
2715 }
2716
2717 return nil
2718 }, opts...)
2719 if e != nil {
2720 return nil, "", e
2721 }
2722 it.Response = resp
2723 return resp.GetOperations(), resp.GetNextPageToken(), nil
2724 }
2725
2726 fetch := func(pageSize int, pageToken string) (string, error) {
2727 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2728 if err != nil {
2729 return "", err
2730 }
2731 it.items = append(it.items, items...)
2732 return nextPageToken, nil
2733 }
2734
2735 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2736 it.pageInfo.MaxSize = int(req.GetPageSize())
2737 it.pageInfo.Token = req.GetPageToken()
2738
2739 return it
2740 }
2741
2742 // DeleteProcessOperation returns a new DeleteProcessOperation from a given name.
2743 // The name must be that of a previously created DeleteProcessOperation, possibly from a different process.
2744 func (c *gRPCClient) DeleteProcessOperation(name string) *DeleteProcessOperation {
2745 return &DeleteProcessOperation{
2746 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2747 }
2748 }
2749
2750 // DeleteProcessOperation returns a new DeleteProcessOperation from a given name.
2751 // The name must be that of a previously created DeleteProcessOperation, possibly from a different process.
2752 func (c *restClient) DeleteProcessOperation(name string) *DeleteProcessOperation {
2753 override := fmt.Sprintf("/v1/%s", name)
2754 return &DeleteProcessOperation{
2755 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2756 pollPath: override,
2757 }
2758 }
2759
2760 // DeleteRunOperation returns a new DeleteRunOperation from a given name.
2761 // The name must be that of a previously created DeleteRunOperation, possibly from a different process.
2762 func (c *gRPCClient) DeleteRunOperation(name string) *DeleteRunOperation {
2763 return &DeleteRunOperation{
2764 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2765 }
2766 }
2767
2768 // DeleteRunOperation returns a new DeleteRunOperation from a given name.
2769 // The name must be that of a previously created DeleteRunOperation, possibly from a different process.
2770 func (c *restClient) DeleteRunOperation(name string) *DeleteRunOperation {
2771 override := fmt.Sprintf("/v1/%s", name)
2772 return &DeleteRunOperation{
2773 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2774 pollPath: override,
2775 }
2776 }