// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Code generated by protoc-gen-go_gapic. DO NOT EDIT. package lineage import ( "bytes" "context" "fmt" "log/slog" "math" "net/http" "net/url" "time" lineagepb "cloud.google.com/go/datacatalog/lineage/apiv1/lineagepb" "cloud.google.com/go/longrunning" lroauto "cloud.google.com/go/longrunning/autogen" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" gax "github.com/googleapis/gax-go/v2" "google.golang.org/api/iterator" "google.golang.org/api/option" "google.golang.org/api/option/internaloption" gtransport "google.golang.org/api/transport/grpc" httptransport "google.golang.org/api/transport/http" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" ) var newClientHook clientHook // CallOptions contains the retry settings for each method of Client. type CallOptions struct { ProcessOpenLineageRunEvent []gax.CallOption CreateProcess []gax.CallOption UpdateProcess []gax.CallOption GetProcess []gax.CallOption ListProcesses []gax.CallOption DeleteProcess []gax.CallOption CreateRun []gax.CallOption UpdateRun []gax.CallOption GetRun []gax.CallOption ListRuns []gax.CallOption DeleteRun []gax.CallOption CreateLineageEvent []gax.CallOption GetLineageEvent []gax.CallOption ListLineageEvents []gax.CallOption DeleteLineageEvent []gax.CallOption SearchLinks []gax.CallOption BatchSearchLinkProcesses []gax.CallOption CancelOperation []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption } func defaultGRPCClientOptions() []option.ClientOption { return []option.ClientOption{ internaloption.WithDefaultEndpoint("datalineage.googleapis.com:443"), internaloption.WithDefaultEndpointTemplate("datalineage.UNIVERSE_DOMAIN:443"), internaloption.WithDefaultMTLSEndpoint("datalineage.mtls.googleapis.com:443"), internaloption.WithDefaultUniverseDomain("googleapis.com"), internaloption.WithDefaultAudience("https://datalineage.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), internaloption.EnableJwtWithScope(), internaloption.EnableNewAuthLibrary(), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), } } func defaultCallOptions() *CallOptions { return &CallOptions{ ProcessOpenLineageRunEvent: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, CreateProcess: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, UpdateProcess: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, GetProcess: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, ListProcesses: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, DeleteProcess: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, CreateRun: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, UpdateRun: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, GetRun: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, ListRuns: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, DeleteRun: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, CreateLineageEvent: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, GetLineageEvent: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, ListLineageEvents: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, DeleteLineageEvent: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, SearchLinks: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, BatchSearchLinkProcesses: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ codes.Unavailable, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }) }), }, CancelOperation: []gax.CallOption{}, DeleteOperation: []gax.CallOption{}, GetOperation: []gax.CallOption{}, ListOperations: []gax.CallOption{}, } } func defaultRESTCallOptions() *CallOptions { return &CallOptions{ ProcessOpenLineageRunEvent: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, CreateProcess: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, UpdateProcess: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, GetProcess: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, ListProcesses: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, DeleteProcess: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, CreateRun: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, UpdateRun: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, GetRun: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, ListRuns: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, DeleteRun: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, CreateLineageEvent: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, GetLineageEvent: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, ListLineageEvents: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, DeleteLineageEvent: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, SearchLinks: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, BatchSearchLinkProcesses: []gax.CallOption{ gax.WithTimeout(60000 * time.Millisecond), gax.WithRetry(func() gax.Retryer { return gax.OnHTTPCodes(gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, Multiplier: 1.30, }, http.StatusServiceUnavailable) }), }, CancelOperation: []gax.CallOption{}, DeleteOperation: []gax.CallOption{}, GetOperation: []gax.CallOption{}, ListOperations: []gax.CallOption{}, } } // internalClient is an interface that defines the methods available from Data Lineage API. type internalClient interface { Close() error setGoogleClientInfo(...string) Connection() *grpc.ClientConn ProcessOpenLineageRunEvent(context.Context, *lineagepb.ProcessOpenLineageRunEventRequest, ...gax.CallOption) (*lineagepb.ProcessOpenLineageRunEventResponse, error) CreateProcess(context.Context, *lineagepb.CreateProcessRequest, ...gax.CallOption) (*lineagepb.Process, error) UpdateProcess(context.Context, *lineagepb.UpdateProcessRequest, ...gax.CallOption) (*lineagepb.Process, error) GetProcess(context.Context, *lineagepb.GetProcessRequest, ...gax.CallOption) (*lineagepb.Process, error) ListProcesses(context.Context, *lineagepb.ListProcessesRequest, ...gax.CallOption) *ProcessIterator DeleteProcess(context.Context, *lineagepb.DeleteProcessRequest, ...gax.CallOption) (*DeleteProcessOperation, error) DeleteProcessOperation(name string) *DeleteProcessOperation CreateRun(context.Context, *lineagepb.CreateRunRequest, ...gax.CallOption) (*lineagepb.Run, error) UpdateRun(context.Context, *lineagepb.UpdateRunRequest, ...gax.CallOption) (*lineagepb.Run, error) GetRun(context.Context, *lineagepb.GetRunRequest, ...gax.CallOption) (*lineagepb.Run, error) ListRuns(context.Context, *lineagepb.ListRunsRequest, ...gax.CallOption) *RunIterator DeleteRun(context.Context, *lineagepb.DeleteRunRequest, ...gax.CallOption) (*DeleteRunOperation, error) DeleteRunOperation(name string) *DeleteRunOperation CreateLineageEvent(context.Context, *lineagepb.CreateLineageEventRequest, ...gax.CallOption) (*lineagepb.LineageEvent, error) GetLineageEvent(context.Context, *lineagepb.GetLineageEventRequest, ...gax.CallOption) (*lineagepb.LineageEvent, error) ListLineageEvents(context.Context, *lineagepb.ListLineageEventsRequest, ...gax.CallOption) *LineageEventIterator DeleteLineageEvent(context.Context, *lineagepb.DeleteLineageEventRequest, ...gax.CallOption) error SearchLinks(context.Context, *lineagepb.SearchLinksRequest, ...gax.CallOption) *LinkIterator BatchSearchLinkProcesses(context.Context, *lineagepb.BatchSearchLinkProcessesRequest, ...gax.CallOption) *ProcessLinksIterator CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error) ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator } // Client is a client for interacting with Data Lineage API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // // Lineage is used to track data flows between assets over time. You can // create LineageEvents // to record lineage between multiple sources and a single target, for // example, when table data is based on data from multiple tables. type Client struct { // The internal transport-dependent client. internalClient internalClient // The call options for this service. CallOptions *CallOptions // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient } // Wrapper methods routed to the internal client. // Close closes the connection to the API service. The user should invoke this when // the client is no longer required. func (c *Client) Close() error { return c.internalClient.Close() } // setGoogleClientInfo sets the name and version of the application in // the `x-goog-api-client` header passed on each request. Intended for // use by Google-written clients. func (c *Client) setGoogleClientInfo(keyval ...string) { c.internalClient.setGoogleClientInfo(keyval...) } // Connection returns a connection to the API service. // // Deprecated: Connections are now pooled so this method does not always // return the same resource. func (c *Client) Connection() *grpc.ClientConn { return c.internalClient.Connection() } // ProcessOpenLineageRunEvent creates new lineage events together with their parents: process and run. // Updates the process and run if they already exist. // Mapped from Open Lineage specification: // https://github.com/OpenLineage/OpenLineage/blob/main/spec/OpenLineage.json (at https://github.com/OpenLineage/OpenLineage/blob/main/spec/OpenLineage.json). func (c *Client) ProcessOpenLineageRunEvent(ctx context.Context, req *lineagepb.ProcessOpenLineageRunEventRequest, opts ...gax.CallOption) (*lineagepb.ProcessOpenLineageRunEventResponse, error) { return c.internalClient.ProcessOpenLineageRunEvent(ctx, req, opts...) } // CreateProcess creates a new process. func (c *Client) CreateProcess(ctx context.Context, req *lineagepb.CreateProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) { return c.internalClient.CreateProcess(ctx, req, opts...) } // UpdateProcess updates a process. func (c *Client) UpdateProcess(ctx context.Context, req *lineagepb.UpdateProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) { return c.internalClient.UpdateProcess(ctx, req, opts...) } // GetProcess gets the details of the specified process. func (c *Client) GetProcess(ctx context.Context, req *lineagepb.GetProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) { return c.internalClient.GetProcess(ctx, req, opts...) } // ListProcesses list processes in the given project and location. List order is descending // by insertion time. func (c *Client) ListProcesses(ctx context.Context, req *lineagepb.ListProcessesRequest, opts ...gax.CallOption) *ProcessIterator { return c.internalClient.ListProcesses(ctx, req, opts...) } // DeleteProcess deletes the process with the specified name. func (c *Client) DeleteProcess(ctx context.Context, req *lineagepb.DeleteProcessRequest, opts ...gax.CallOption) (*DeleteProcessOperation, error) { return c.internalClient.DeleteProcess(ctx, req, opts...) } // DeleteProcessOperation returns a new DeleteProcessOperation from a given name. // The name must be that of a previously created DeleteProcessOperation, possibly from a different process. func (c *Client) DeleteProcessOperation(name string) *DeleteProcessOperation { return c.internalClient.DeleteProcessOperation(name) } // CreateRun creates a new run. func (c *Client) CreateRun(ctx context.Context, req *lineagepb.CreateRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) { return c.internalClient.CreateRun(ctx, req, opts...) } // UpdateRun updates a run. func (c *Client) UpdateRun(ctx context.Context, req *lineagepb.UpdateRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) { return c.internalClient.UpdateRun(ctx, req, opts...) } // GetRun gets the details of the specified run. func (c *Client) GetRun(ctx context.Context, req *lineagepb.GetRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) { return c.internalClient.GetRun(ctx, req, opts...) } // ListRuns lists runs in the given project and location. List order is descending by // start_time. func (c *Client) ListRuns(ctx context.Context, req *lineagepb.ListRunsRequest, opts ...gax.CallOption) *RunIterator { return c.internalClient.ListRuns(ctx, req, opts...) } // DeleteRun deletes the run with the specified name. func (c *Client) DeleteRun(ctx context.Context, req *lineagepb.DeleteRunRequest, opts ...gax.CallOption) (*DeleteRunOperation, error) { return c.internalClient.DeleteRun(ctx, req, opts...) } // DeleteRunOperation returns a new DeleteRunOperation from a given name. // The name must be that of a previously created DeleteRunOperation, possibly from a different process. func (c *Client) DeleteRunOperation(name string) *DeleteRunOperation { return c.internalClient.DeleteRunOperation(name) } // CreateLineageEvent creates a new lineage event. func (c *Client) CreateLineageEvent(ctx context.Context, req *lineagepb.CreateLineageEventRequest, opts ...gax.CallOption) (*lineagepb.LineageEvent, error) { return c.internalClient.CreateLineageEvent(ctx, req, opts...) } // GetLineageEvent gets details of a specified lineage event. func (c *Client) GetLineageEvent(ctx context.Context, req *lineagepb.GetLineageEventRequest, opts ...gax.CallOption) (*lineagepb.LineageEvent, error) { return c.internalClient.GetLineageEvent(ctx, req, opts...) } // ListLineageEvents lists lineage events in the given project and location. The list order is // not defined. func (c *Client) ListLineageEvents(ctx context.Context, req *lineagepb.ListLineageEventsRequest, opts ...gax.CallOption) *LineageEventIterator { return c.internalClient.ListLineageEvents(ctx, req, opts...) } // DeleteLineageEvent deletes the lineage event with the specified name. func (c *Client) DeleteLineageEvent(ctx context.Context, req *lineagepb.DeleteLineageEventRequest, opts ...gax.CallOption) error { return c.internalClient.DeleteLineageEvent(ctx, req, opts...) } // SearchLinks retrieve a list of links connected to a specific asset. // Links represent the data flow between source (upstream) // and target (downstream) assets in transformation pipelines. // Links are stored in the same project as the Lineage Events that create // them. // // You can retrieve links in every project where you have the // datalineage.events.get permission. The project provided in the URL // is used for Billing and Quota. func (c *Client) SearchLinks(ctx context.Context, req *lineagepb.SearchLinksRequest, opts ...gax.CallOption) *LinkIterator { return c.internalClient.SearchLinks(ctx, req, opts...) } // BatchSearchLinkProcesses retrieve information about LineageProcesses associated with specific // links. LineageProcesses are transformation pipelines that result in data // flowing from source to target assets. Links between assets // represent this operation. // // If you have specific link names, you can use this method to // verify which LineageProcesses contribute to creating those links. // See the // SearchLinks // method for more information on how to retrieve link name. // // You can retrieve the LineageProcess information in every project where you // have the datalineage.events.get permission. The project provided in the // URL is used for Billing and Quota. func (c *Client) BatchSearchLinkProcesses(ctx context.Context, req *lineagepb.BatchSearchLinkProcessesRequest, opts ...gax.CallOption) *ProcessLinksIterator { return c.internalClient.BatchSearchLinkProcesses(ctx, req, opts...) } // CancelOperation is a utility method from google.longrunning.Operations. func (c *Client) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { return c.internalClient.CancelOperation(ctx, req, opts...) } // DeleteOperation is a utility method from google.longrunning.Operations. func (c *Client) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { return c.internalClient.DeleteOperation(ctx, req, opts...) } // GetOperation is a utility method from google.longrunning.Operations. func (c *Client) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { return c.internalClient.GetOperation(ctx, req, opts...) } // ListOperations is a utility method from google.longrunning.Operations. func (c *Client) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { return c.internalClient.ListOperations(ctx, req, opts...) } // gRPCClient is a client for interacting with Data Lineage API over gRPC transport. // // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. type gRPCClient struct { // Connection pool of gRPC connections to the service. connPool gtransport.ConnPool // Points back to the CallOptions field of the containing Client CallOptions **CallOptions // The gRPC API client. client lineagepb.LineageClient // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient **lroauto.OperationsClient operationsClient longrunningpb.OperationsClient // The x-goog-* metadata to be sent with each request. xGoogHeaders []string logger *slog.Logger } // NewClient creates a new lineage client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // // Lineage is used to track data flows between assets over time. You can // create LineageEvents // to record lineage between multiple sources and a single target, for // example, when table data is based on data from multiple tables. func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { clientOpts := defaultGRPCClientOptions() if newClientHook != nil { hookOpts, err := newClientHook(ctx, clientHookParams{}) if err != nil { return nil, err } clientOpts = append(clientOpts, hookOpts...) } connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) if err != nil { return nil, err } client := Client{CallOptions: defaultCallOptions()} c := &gRPCClient{ connPool: connPool, client: lineagepb.NewLineageClient(connPool), CallOptions: &client.CallOptions, logger: internaloption.GetLogger(opts), operationsClient: longrunningpb.NewOperationsClient(connPool), } c.setGoogleClientInfo() client.internalClient = c client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool)) if err != nil { // This error "should not happen", since we are just reusing old connection pool // and never actually need to dial. // If this does happen, we could leak connp. However, we cannot close conn: // If the user invoked the constructor with option.WithGRPCConn, // we would close a connection that's still in use. // TODO: investigate error conditions. return nil, err } c.LROClient = &client.LROClient return &client, nil } // Connection returns a connection to the API service. // // Deprecated: Connections are now pooled so this method does not always // return the same resource. func (c *gRPCClient) Connection() *grpc.ClientConn { return c.connPool.Conn() } // setGoogleClientInfo sets the name and version of the application in // the `x-goog-api-client` header passed on each request. Intended for // use by Google-written clients. func (c *gRPCClient) setGoogleClientInfo(keyval ...string) { kv := append([]string{"gl-go", gax.GoVersion}, keyval...) kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion) c.xGoogHeaders = []string{ "x-goog-api-client", gax.XGoogHeader(kv...), } } // Close closes the connection to the API service. The user should invoke this when // the client is no longer required. func (c *gRPCClient) Close() error { return c.connPool.Close() } // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. type restClient struct { // The http endpoint to connect to. endpoint string // The http client. httpClient *http.Client // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient **lroauto.OperationsClient // The x-goog-* headers to be sent with each request. xGoogHeaders []string // Points back to the CallOptions field of the containing Client CallOptions **CallOptions logger *slog.Logger } // NewRESTClient creates a new lineage rest client. // // Lineage is used to track data flows between assets over time. You can // create LineageEvents // to record lineage between multiple sources and a single target, for // example, when table data is based on data from multiple tables. func NewRESTClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { clientOpts := append(defaultRESTClientOptions(), opts...) httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) if err != nil { return nil, err } callOpts := defaultRESTCallOptions() c := &restClient{ endpoint: endpoint, httpClient: httpClient, CallOptions: &callOpts, logger: internaloption.GetLogger(opts), } c.setGoogleClientInfo() lroOpts := []option.ClientOption{ option.WithHTTPClient(httpClient), option.WithEndpoint(endpoint), } opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...) if err != nil { return nil, err } c.LROClient = &opClient return &Client{internalClient: c, CallOptions: callOpts}, nil } func defaultRESTClientOptions() []option.ClientOption { return []option.ClientOption{ internaloption.WithDefaultEndpoint("https://datalineage.googleapis.com"), internaloption.WithDefaultEndpointTemplate("https://datalineage.UNIVERSE_DOMAIN"), internaloption.WithDefaultMTLSEndpoint("https://datalineage.mtls.googleapis.com"), internaloption.WithDefaultUniverseDomain("googleapis.com"), internaloption.WithDefaultAudience("https://datalineage.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), internaloption.EnableNewAuthLibrary(), } } // setGoogleClientInfo sets the name and version of the application in // the `x-goog-api-client` header passed on each request. Intended for // use by Google-written clients. func (c *restClient) setGoogleClientInfo(keyval ...string) { kv := append([]string{"gl-go", gax.GoVersion}, keyval...) kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN", "pb", protoVersion) c.xGoogHeaders = []string{ "x-goog-api-client", gax.XGoogHeader(kv...), } } // Close closes the connection to the API service. The user should invoke this when // the client is no longer required. func (c *restClient) Close() error { // Replace httpClient with nil to force cleanup. c.httpClient = nil return nil } // Connection returns a connection to the API service. // // Deprecated: This method always returns nil. func (c *restClient) Connection() *grpc.ClientConn { return nil } func (c *gRPCClient) ProcessOpenLineageRunEvent(ctx context.Context, req *lineagepb.ProcessOpenLineageRunEventRequest, opts ...gax.CallOption) (*lineagepb.ProcessOpenLineageRunEventResponse, error) { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).ProcessOpenLineageRunEvent[0:len((*c.CallOptions).ProcessOpenLineageRunEvent):len((*c.CallOptions).ProcessOpenLineageRunEvent)], opts...) var resp *lineagepb.ProcessOpenLineageRunEventResponse err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.client.ProcessOpenLineageRunEvent, req, settings.GRPC, c.logger, "ProcessOpenLineageRunEvent") return err }, opts...) if err != nil { return nil, err } return resp, nil } func (c *gRPCClient) CreateProcess(ctx context.Context, req *lineagepb.CreateProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).CreateProcess[0:len((*c.CallOptions).CreateProcess):len((*c.CallOptions).CreateProcess)], opts...) var resp *lineagepb.Process err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.client.CreateProcess, req, settings.GRPC, c.logger, "CreateProcess") return err }, opts...) if err != nil { return nil, err } return resp, nil } func (c *gRPCClient) UpdateProcess(ctx context.Context, req *lineagepb.UpdateProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "process.name", url.QueryEscape(req.GetProcess().GetName()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).UpdateProcess[0:len((*c.CallOptions).UpdateProcess):len((*c.CallOptions).UpdateProcess)], opts...) var resp *lineagepb.Process err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.client.UpdateProcess, req, settings.GRPC, c.logger, "UpdateProcess") return err }, opts...) if err != nil { return nil, err } return resp, nil } func (c *gRPCClient) GetProcess(ctx context.Context, req *lineagepb.GetProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).GetProcess[0:len((*c.CallOptions).GetProcess):len((*c.CallOptions).GetProcess)], opts...) var resp *lineagepb.Process err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.client.GetProcess, req, settings.GRPC, c.logger, "GetProcess") return err }, opts...) if err != nil { return nil, err } return resp, nil } func (c *gRPCClient) ListProcesses(ctx context.Context, req *lineagepb.ListProcessesRequest, opts ...gax.CallOption) *ProcessIterator { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).ListProcesses[0:len((*c.CallOptions).ListProcesses):len((*c.CallOptions).ListProcesses)], opts...) it := &ProcessIterator{} req = proto.Clone(req).(*lineagepb.ListProcessesRequest) it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.Process, string, error) { resp := &lineagepb.ListProcessesResponse{} if pageToken != "" { req.PageToken = pageToken } if pageSize > math.MaxInt32 { req.PageSize = math.MaxInt32 } else if pageSize != 0 { req.PageSize = int32(pageSize) } err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.client.ListProcesses, req, settings.GRPC, c.logger, "ListProcesses") return err }, opts...) if err != nil { return nil, "", err } it.Response = resp return resp.GetProcesses(), resp.GetNextPageToken(), nil } fetch := func(pageSize int, pageToken string) (string, error) { items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) if err != nil { return "", err } it.items = append(it.items, items...) return nextPageToken, nil } it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) it.pageInfo.MaxSize = int(req.GetPageSize()) it.pageInfo.Token = req.GetPageToken() return it } func (c *gRPCClient) DeleteProcess(ctx context.Context, req *lineagepb.DeleteProcessRequest, opts ...gax.CallOption) (*DeleteProcessOperation, error) { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).DeleteProcess[0:len((*c.CallOptions).DeleteProcess):len((*c.CallOptions).DeleteProcess)], opts...) var resp *longrunningpb.Operation err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.client.DeleteProcess, req, settings.GRPC, c.logger, "DeleteProcess") return err }, opts...) if err != nil { return nil, err } return &DeleteProcessOperation{ lro: longrunning.InternalNewOperation(*c.LROClient, resp), }, nil } func (c *gRPCClient) CreateRun(ctx context.Context, req *lineagepb.CreateRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).CreateRun[0:len((*c.CallOptions).CreateRun):len((*c.CallOptions).CreateRun)], opts...) var resp *lineagepb.Run err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.client.CreateRun, req, settings.GRPC, c.logger, "CreateRun") return err }, opts...) if err != nil { return nil, err } return resp, nil } func (c *gRPCClient) UpdateRun(ctx context.Context, req *lineagepb.UpdateRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "run.name", url.QueryEscape(req.GetRun().GetName()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).UpdateRun[0:len((*c.CallOptions).UpdateRun):len((*c.CallOptions).UpdateRun)], opts...) var resp *lineagepb.Run err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.client.UpdateRun, req, settings.GRPC, c.logger, "UpdateRun") return err }, opts...) if err != nil { return nil, err } return resp, nil } func (c *gRPCClient) GetRun(ctx context.Context, req *lineagepb.GetRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).GetRun[0:len((*c.CallOptions).GetRun):len((*c.CallOptions).GetRun)], opts...) var resp *lineagepb.Run err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.client.GetRun, req, settings.GRPC, c.logger, "GetRun") return err }, opts...) if err != nil { return nil, err } return resp, nil } func (c *gRPCClient) ListRuns(ctx context.Context, req *lineagepb.ListRunsRequest, opts ...gax.CallOption) *RunIterator { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).ListRuns[0:len((*c.CallOptions).ListRuns):len((*c.CallOptions).ListRuns)], opts...) it := &RunIterator{} req = proto.Clone(req).(*lineagepb.ListRunsRequest) it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.Run, string, error) { resp := &lineagepb.ListRunsResponse{} if pageToken != "" { req.PageToken = pageToken } if pageSize > math.MaxInt32 { req.PageSize = math.MaxInt32 } else if pageSize != 0 { req.PageSize = int32(pageSize) } err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.client.ListRuns, req, settings.GRPC, c.logger, "ListRuns") return err }, opts...) if err != nil { return nil, "", err } it.Response = resp return resp.GetRuns(), resp.GetNextPageToken(), nil } fetch := func(pageSize int, pageToken string) (string, error) { items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) if err != nil { return "", err } it.items = append(it.items, items...) return nextPageToken, nil } it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) it.pageInfo.MaxSize = int(req.GetPageSize()) it.pageInfo.Token = req.GetPageToken() return it } func (c *gRPCClient) DeleteRun(ctx context.Context, req *lineagepb.DeleteRunRequest, opts ...gax.CallOption) (*DeleteRunOperation, error) { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).DeleteRun[0:len((*c.CallOptions).DeleteRun):len((*c.CallOptions).DeleteRun)], opts...) var resp *longrunningpb.Operation err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.client.DeleteRun, req, settings.GRPC, c.logger, "DeleteRun") return err }, opts...) if err != nil { return nil, err } return &DeleteRunOperation{ lro: longrunning.InternalNewOperation(*c.LROClient, resp), }, nil } func (c *gRPCClient) CreateLineageEvent(ctx context.Context, req *lineagepb.CreateLineageEventRequest, opts ...gax.CallOption) (*lineagepb.LineageEvent, error) { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).CreateLineageEvent[0:len((*c.CallOptions).CreateLineageEvent):len((*c.CallOptions).CreateLineageEvent)], opts...) var resp *lineagepb.LineageEvent err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.client.CreateLineageEvent, req, settings.GRPC, c.logger, "CreateLineageEvent") return err }, opts...) if err != nil { return nil, err } return resp, nil } func (c *gRPCClient) GetLineageEvent(ctx context.Context, req *lineagepb.GetLineageEventRequest, opts ...gax.CallOption) (*lineagepb.LineageEvent, error) { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).GetLineageEvent[0:len((*c.CallOptions).GetLineageEvent):len((*c.CallOptions).GetLineageEvent)], opts...) var resp *lineagepb.LineageEvent err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.client.GetLineageEvent, req, settings.GRPC, c.logger, "GetLineageEvent") return err }, opts...) if err != nil { return nil, err } return resp, nil } func (c *gRPCClient) ListLineageEvents(ctx context.Context, req *lineagepb.ListLineageEventsRequest, opts ...gax.CallOption) *LineageEventIterator { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).ListLineageEvents[0:len((*c.CallOptions).ListLineageEvents):len((*c.CallOptions).ListLineageEvents)], opts...) it := &LineageEventIterator{} req = proto.Clone(req).(*lineagepb.ListLineageEventsRequest) it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.LineageEvent, string, error) { resp := &lineagepb.ListLineageEventsResponse{} if pageToken != "" { req.PageToken = pageToken } if pageSize > math.MaxInt32 { req.PageSize = math.MaxInt32 } else if pageSize != 0 { req.PageSize = int32(pageSize) } err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.client.ListLineageEvents, req, settings.GRPC, c.logger, "ListLineageEvents") return err }, opts...) if err != nil { return nil, "", err } it.Response = resp return resp.GetLineageEvents(), resp.GetNextPageToken(), nil } fetch := func(pageSize int, pageToken string) (string, error) { items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) if err != nil { return "", err } it.items = append(it.items, items...) return nextPageToken, nil } it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) it.pageInfo.MaxSize = int(req.GetPageSize()) it.pageInfo.Token = req.GetPageToken() return it } func (c *gRPCClient) DeleteLineageEvent(ctx context.Context, req *lineagepb.DeleteLineageEventRequest, opts ...gax.CallOption) error { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).DeleteLineageEvent[0:len((*c.CallOptions).DeleteLineageEvent):len((*c.CallOptions).DeleteLineageEvent)], opts...) err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error _, err = executeRPC(ctx, c.client.DeleteLineageEvent, req, settings.GRPC, c.logger, "DeleteLineageEvent") return err }, opts...) return err } func (c *gRPCClient) SearchLinks(ctx context.Context, req *lineagepb.SearchLinksRequest, opts ...gax.CallOption) *LinkIterator { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).SearchLinks[0:len((*c.CallOptions).SearchLinks):len((*c.CallOptions).SearchLinks)], opts...) it := &LinkIterator{} req = proto.Clone(req).(*lineagepb.SearchLinksRequest) it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.Link, string, error) { resp := &lineagepb.SearchLinksResponse{} if pageToken != "" { req.PageToken = pageToken } if pageSize > math.MaxInt32 { req.PageSize = math.MaxInt32 } else if pageSize != 0 { req.PageSize = int32(pageSize) } err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.client.SearchLinks, req, settings.GRPC, c.logger, "SearchLinks") return err }, opts...) if err != nil { return nil, "", err } it.Response = resp return resp.GetLinks(), resp.GetNextPageToken(), nil } fetch := func(pageSize int, pageToken string) (string, error) { items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) if err != nil { return "", err } it.items = append(it.items, items...) return nextPageToken, nil } it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) it.pageInfo.MaxSize = int(req.GetPageSize()) it.pageInfo.Token = req.GetPageToken() return it } func (c *gRPCClient) BatchSearchLinkProcesses(ctx context.Context, req *lineagepb.BatchSearchLinkProcessesRequest, opts ...gax.CallOption) *ProcessLinksIterator { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).BatchSearchLinkProcesses[0:len((*c.CallOptions).BatchSearchLinkProcesses):len((*c.CallOptions).BatchSearchLinkProcesses)], opts...) it := &ProcessLinksIterator{} req = proto.Clone(req).(*lineagepb.BatchSearchLinkProcessesRequest) it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.ProcessLinks, string, error) { resp := &lineagepb.BatchSearchLinkProcessesResponse{} if pageToken != "" { req.PageToken = pageToken } if pageSize > math.MaxInt32 { req.PageSize = math.MaxInt32 } else if pageSize != 0 { req.PageSize = int32(pageSize) } err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.client.BatchSearchLinkProcesses, req, settings.GRPC, c.logger, "BatchSearchLinkProcesses") return err }, opts...) if err != nil { return nil, "", err } it.Response = resp return resp.GetProcessLinks(), resp.GetNextPageToken(), nil } fetch := func(pageSize int, pageToken string) (string, error) { items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) if err != nil { return "", err } it.items = append(it.items, items...) return nextPageToken, nil } it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) it.pageInfo.MaxSize = int(req.GetPageSize()) it.pageInfo.Token = req.GetPageToken() return it } func (c *gRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...) err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error _, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation") return err }, opts...) return err } func (c *gRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...) err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error _, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation") return err }, opts...) return err } func (c *gRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...) var resp *longrunningpb.Operation err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation") return err }, opts...) if err != nil { return nil, err } return resp, nil } func (c *gRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...) it := &OperationIterator{} req = proto.Clone(req).(*longrunningpb.ListOperationsRequest) it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) { resp := &longrunningpb.ListOperationsResponse{} if pageToken != "" { req.PageToken = pageToken } if pageSize > math.MaxInt32 { req.PageSize = math.MaxInt32 } else if pageSize != 0 { req.PageSize = int32(pageSize) } err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations") return err }, opts...) if err != nil { return nil, "", err } it.Response = resp return resp.GetOperations(), resp.GetNextPageToken(), nil } fetch := func(pageSize int, pageToken string) (string, error) { items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) if err != nil { return "", err } it.items = append(it.items, items...) return nextPageToken, nil } it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) it.pageInfo.MaxSize = int(req.GetPageSize()) it.pageInfo.Token = req.GetPageToken() return it } // ProcessOpenLineageRunEvent creates new lineage events together with their parents: process and run. // Updates the process and run if they already exist. // Mapped from Open Lineage specification: // https://github.com/OpenLineage/OpenLineage/blob/main/spec/OpenLineage.json (at https://github.com/OpenLineage/OpenLineage/blob/main/spec/OpenLineage.json). func (c *restClient) ProcessOpenLineageRunEvent(ctx context.Context, req *lineagepb.ProcessOpenLineageRunEventRequest, opts ...gax.CallOption) (*lineagepb.ProcessOpenLineageRunEventResponse, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} body := req.GetOpenLineage() jsonReq, err := m.Marshal(body) if err != nil { return nil, err } baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, err } baseUrl.Path += fmt.Sprintf("/v1/%v:processOpenLineageRunEvent", req.GetParent()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") if req.GetRequestId() != "" { params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) } baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} hds = append(c.xGoogHeaders, hds...) hds = append(hds, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) opts = append((*c.CallOptions).ProcessOpenLineageRunEvent[0:len((*c.CallOptions).ProcessOpenLineageRunEvent):len((*c.CallOptions).ProcessOpenLineageRunEvent)], opts...) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} resp := &lineagepb.ProcessOpenLineageRunEventResponse{} e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) if err != nil { return err } httpReq = httpReq.WithContext(ctx) httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "ProcessOpenLineageRunEvent") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, e } return resp, nil } // CreateProcess creates a new process. func (c *restClient) CreateProcess(ctx context.Context, req *lineagepb.CreateProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} body := req.GetProcess() jsonReq, err := m.Marshal(body) if err != nil { return nil, err } baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, err } baseUrl.Path += fmt.Sprintf("/v1/%v/processes", req.GetParent()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") if req.GetRequestId() != "" { params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) } baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} hds = append(c.xGoogHeaders, hds...) hds = append(hds, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) opts = append((*c.CallOptions).CreateProcess[0:len((*c.CallOptions).CreateProcess):len((*c.CallOptions).CreateProcess)], opts...) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} resp := &lineagepb.Process{} e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) if err != nil { return err } httpReq = httpReq.WithContext(ctx) httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateProcess") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, e } return resp, nil } // UpdateProcess updates a process. func (c *restClient) UpdateProcess(ctx context.Context, req *lineagepb.UpdateProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} body := req.GetProcess() jsonReq, err := m.Marshal(body) if err != nil { return nil, err } baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, err } baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetProcess().GetName()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") if req.GetAllowMissing() { params.Add("allowMissing", fmt.Sprintf("%v", req.GetAllowMissing())) } if req.GetUpdateMask() != nil { field, err := protojson.Marshal(req.GetUpdateMask()) if err != nil { return nil, err } params.Add("updateMask", string(field[1:len(field)-1])) } baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "process.name", url.QueryEscape(req.GetProcess().GetName()))} hds = append(c.xGoogHeaders, hds...) hds = append(hds, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) opts = append((*c.CallOptions).UpdateProcess[0:len((*c.CallOptions).UpdateProcess):len((*c.CallOptions).UpdateProcess)], opts...) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} resp := &lineagepb.Process{} e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) if err != nil { return err } httpReq = httpReq.WithContext(ctx) httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateProcess") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, e } return resp, nil } // GetProcess gets the details of the specified process. func (c *restClient) GetProcess(ctx context.Context, req *lineagepb.GetProcessRequest, opts ...gax.CallOption) (*lineagepb.Process, error) { baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, err } baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) hds = append(hds, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) opts = append((*c.CallOptions).GetProcess[0:len((*c.CallOptions).GetProcess):len((*c.CallOptions).GetProcess)], opts...) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} resp := &lineagepb.Process{} e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return err } httpReq = httpReq.WithContext(ctx) httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetProcess") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, e } return resp, nil } // ListProcesses list processes in the given project and location. List order is descending // by insertion time. func (c *restClient) ListProcesses(ctx context.Context, req *lineagepb.ListProcessesRequest, opts ...gax.CallOption) *ProcessIterator { it := &ProcessIterator{} req = proto.Clone(req).(*lineagepb.ListProcessesRequest) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.Process, string, error) { resp := &lineagepb.ListProcessesResponse{} if pageToken != "" { req.PageToken = pageToken } if pageSize > math.MaxInt32 { req.PageSize = math.MaxInt32 } else if pageSize != 0 { req.PageSize = int32(pageSize) } baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, "", err } baseUrl.Path += fmt.Sprintf("/v1/%v/processes", req.GetParent()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") if req.GetPageSize() != 0 { params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) } if req.GetPageToken() != "" { params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) } baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := append(c.xGoogHeaders, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return err } httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListProcesses") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, "", e } it.Response = resp return resp.GetProcesses(), resp.GetNextPageToken(), nil } fetch := func(pageSize int, pageToken string) (string, error) { items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) if err != nil { return "", err } it.items = append(it.items, items...) return nextPageToken, nil } it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) it.pageInfo.MaxSize = int(req.GetPageSize()) it.pageInfo.Token = req.GetPageToken() return it } // DeleteProcess deletes the process with the specified name. func (c *restClient) DeleteProcess(ctx context.Context, req *lineagepb.DeleteProcessRequest, opts ...gax.CallOption) (*DeleteProcessOperation, error) { baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, err } baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") if req.GetAllowMissing() { params.Add("allowMissing", fmt.Sprintf("%v", req.GetAllowMissing())) } baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) hds = append(hds, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} resp := &longrunningpb.Operation{} e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return err } httpReq = httpReq.WithContext(ctx) httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteProcess") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, e } override := fmt.Sprintf("/v1/%s", resp.GetName()) return &DeleteProcessOperation{ lro: longrunning.InternalNewOperation(*c.LROClient, resp), pollPath: override, }, nil } // CreateRun creates a new run. func (c *restClient) CreateRun(ctx context.Context, req *lineagepb.CreateRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} body := req.GetRun() jsonReq, err := m.Marshal(body) if err != nil { return nil, err } baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, err } baseUrl.Path += fmt.Sprintf("/v1/%v/runs", req.GetParent()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") if req.GetRequestId() != "" { params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) } baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} hds = append(c.xGoogHeaders, hds...) hds = append(hds, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) opts = append((*c.CallOptions).CreateRun[0:len((*c.CallOptions).CreateRun):len((*c.CallOptions).CreateRun)], opts...) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} resp := &lineagepb.Run{} e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) if err != nil { return err } httpReq = httpReq.WithContext(ctx) httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateRun") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, e } return resp, nil } // UpdateRun updates a run. func (c *restClient) UpdateRun(ctx context.Context, req *lineagepb.UpdateRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} body := req.GetRun() jsonReq, err := m.Marshal(body) if err != nil { return nil, err } baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, err } baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetRun().GetName()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") if req.GetAllowMissing() { params.Add("allowMissing", fmt.Sprintf("%v", req.GetAllowMissing())) } if req.GetUpdateMask() != nil { field, err := protojson.Marshal(req.GetUpdateMask()) if err != nil { return nil, err } params.Add("updateMask", string(field[1:len(field)-1])) } baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "run.name", url.QueryEscape(req.GetRun().GetName()))} hds = append(c.xGoogHeaders, hds...) hds = append(hds, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) opts = append((*c.CallOptions).UpdateRun[0:len((*c.CallOptions).UpdateRun):len((*c.CallOptions).UpdateRun)], opts...) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} resp := &lineagepb.Run{} e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) if err != nil { return err } httpReq = httpReq.WithContext(ctx) httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateRun") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, e } return resp, nil } // GetRun gets the details of the specified run. func (c *restClient) GetRun(ctx context.Context, req *lineagepb.GetRunRequest, opts ...gax.CallOption) (*lineagepb.Run, error) { baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, err } baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) hds = append(hds, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) opts = append((*c.CallOptions).GetRun[0:len((*c.CallOptions).GetRun):len((*c.CallOptions).GetRun)], opts...) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} resp := &lineagepb.Run{} e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return err } httpReq = httpReq.WithContext(ctx) httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetRun") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, e } return resp, nil } // ListRuns lists runs in the given project and location. List order is descending by // start_time. func (c *restClient) ListRuns(ctx context.Context, req *lineagepb.ListRunsRequest, opts ...gax.CallOption) *RunIterator { it := &RunIterator{} req = proto.Clone(req).(*lineagepb.ListRunsRequest) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.Run, string, error) { resp := &lineagepb.ListRunsResponse{} if pageToken != "" { req.PageToken = pageToken } if pageSize > math.MaxInt32 { req.PageSize = math.MaxInt32 } else if pageSize != 0 { req.PageSize = int32(pageSize) } baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, "", err } baseUrl.Path += fmt.Sprintf("/v1/%v/runs", req.GetParent()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") if req.GetPageSize() != 0 { params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) } if req.GetPageToken() != "" { params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) } baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := append(c.xGoogHeaders, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return err } httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListRuns") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, "", e } it.Response = resp return resp.GetRuns(), resp.GetNextPageToken(), nil } fetch := func(pageSize int, pageToken string) (string, error) { items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) if err != nil { return "", err } it.items = append(it.items, items...) return nextPageToken, nil } it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) it.pageInfo.MaxSize = int(req.GetPageSize()) it.pageInfo.Token = req.GetPageToken() return it } // DeleteRun deletes the run with the specified name. func (c *restClient) DeleteRun(ctx context.Context, req *lineagepb.DeleteRunRequest, opts ...gax.CallOption) (*DeleteRunOperation, error) { baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, err } baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") if req.GetAllowMissing() { params.Add("allowMissing", fmt.Sprintf("%v", req.GetAllowMissing())) } baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) hds = append(hds, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} resp := &longrunningpb.Operation{} e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return err } httpReq = httpReq.WithContext(ctx) httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteRun") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, e } override := fmt.Sprintf("/v1/%s", resp.GetName()) return &DeleteRunOperation{ lro: longrunning.InternalNewOperation(*c.LROClient, resp), pollPath: override, }, nil } // CreateLineageEvent creates a new lineage event. func (c *restClient) CreateLineageEvent(ctx context.Context, req *lineagepb.CreateLineageEventRequest, opts ...gax.CallOption) (*lineagepb.LineageEvent, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} body := req.GetLineageEvent() jsonReq, err := m.Marshal(body) if err != nil { return nil, err } baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, err } baseUrl.Path += fmt.Sprintf("/v1/%v/lineageEvents", req.GetParent()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") if req.GetRequestId() != "" { params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) } baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} hds = append(c.xGoogHeaders, hds...) hds = append(hds, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) opts = append((*c.CallOptions).CreateLineageEvent[0:len((*c.CallOptions).CreateLineageEvent):len((*c.CallOptions).CreateLineageEvent)], opts...) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} resp := &lineagepb.LineageEvent{} e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) if err != nil { return err } httpReq = httpReq.WithContext(ctx) httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateLineageEvent") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, e } return resp, nil } // GetLineageEvent gets details of a specified lineage event. func (c *restClient) GetLineageEvent(ctx context.Context, req *lineagepb.GetLineageEventRequest, opts ...gax.CallOption) (*lineagepb.LineageEvent, error) { baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, err } baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) hds = append(hds, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) opts = append((*c.CallOptions).GetLineageEvent[0:len((*c.CallOptions).GetLineageEvent):len((*c.CallOptions).GetLineageEvent)], opts...) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} resp := &lineagepb.LineageEvent{} e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return err } httpReq = httpReq.WithContext(ctx) httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetLineageEvent") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, e } return resp, nil } // ListLineageEvents lists lineage events in the given project and location. The list order is // not defined. func (c *restClient) ListLineageEvents(ctx context.Context, req *lineagepb.ListLineageEventsRequest, opts ...gax.CallOption) *LineageEventIterator { it := &LineageEventIterator{} req = proto.Clone(req).(*lineagepb.ListLineageEventsRequest) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.LineageEvent, string, error) { resp := &lineagepb.ListLineageEventsResponse{} if pageToken != "" { req.PageToken = pageToken } if pageSize > math.MaxInt32 { req.PageSize = math.MaxInt32 } else if pageSize != 0 { req.PageSize = int32(pageSize) } baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, "", err } baseUrl.Path += fmt.Sprintf("/v1/%v/lineageEvents", req.GetParent()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") if req.GetPageSize() != 0 { params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) } if req.GetPageToken() != "" { params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) } baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := append(c.xGoogHeaders, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return err } httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListLineageEvents") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, "", e } it.Response = resp return resp.GetLineageEvents(), resp.GetNextPageToken(), nil } fetch := func(pageSize int, pageToken string) (string, error) { items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) if err != nil { return "", err } it.items = append(it.items, items...) return nextPageToken, nil } it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) it.pageInfo.MaxSize = int(req.GetPageSize()) it.pageInfo.Token = req.GetPageToken() return it } // DeleteLineageEvent deletes the lineage event with the specified name. func (c *restClient) DeleteLineageEvent(ctx context.Context, req *lineagepb.DeleteLineageEventRequest, opts ...gax.CallOption) error { baseUrl, err := url.Parse(c.endpoint) if err != nil { return err } baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") if req.GetAllowMissing() { params.Add("allowMissing", fmt.Sprintf("%v", req.GetAllowMissing())) } baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) hds = append(hds, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return err } httpReq = httpReq.WithContext(ctx) httpReq.Header = headers _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteLineageEvent") return err }, opts...) } // SearchLinks retrieve a list of links connected to a specific asset. // Links represent the data flow between source (upstream) // and target (downstream) assets in transformation pipelines. // Links are stored in the same project as the Lineage Events that create // them. // // You can retrieve links in every project where you have the // datalineage.events.get permission. The project provided in the URL // is used for Billing and Quota. func (c *restClient) SearchLinks(ctx context.Context, req *lineagepb.SearchLinksRequest, opts ...gax.CallOption) *LinkIterator { it := &LinkIterator{} req = proto.Clone(req).(*lineagepb.SearchLinksRequest) m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.Link, string, error) { resp := &lineagepb.SearchLinksResponse{} if pageToken != "" { req.PageToken = pageToken } if pageSize > math.MaxInt32 { req.PageSize = math.MaxInt32 } else if pageSize != 0 { req.PageSize = int32(pageSize) } jsonReq, err := m.Marshal(req) if err != nil { return nil, "", err } baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, "", err } baseUrl.Path += fmt.Sprintf("/v1/%v:searchLinks", req.GetParent()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := append(c.xGoogHeaders, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) if err != nil { return err } httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "SearchLinks") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, "", e } it.Response = resp return resp.GetLinks(), resp.GetNextPageToken(), nil } fetch := func(pageSize int, pageToken string) (string, error) { items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) if err != nil { return "", err } it.items = append(it.items, items...) return nextPageToken, nil } it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) it.pageInfo.MaxSize = int(req.GetPageSize()) it.pageInfo.Token = req.GetPageToken() return it } // BatchSearchLinkProcesses retrieve information about LineageProcesses associated with specific // links. LineageProcesses are transformation pipelines that result in data // flowing from source to target assets. Links between assets // represent this operation. // // If you have specific link names, you can use this method to // verify which LineageProcesses contribute to creating those links. // See the // SearchLinks // method for more information on how to retrieve link name. // // You can retrieve the LineageProcess information in every project where you // have the datalineage.events.get permission. The project provided in the // URL is used for Billing and Quota. func (c *restClient) BatchSearchLinkProcesses(ctx context.Context, req *lineagepb.BatchSearchLinkProcessesRequest, opts ...gax.CallOption) *ProcessLinksIterator { it := &ProcessLinksIterator{} req = proto.Clone(req).(*lineagepb.BatchSearchLinkProcessesRequest) m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} it.InternalFetch = func(pageSize int, pageToken string) ([]*lineagepb.ProcessLinks, string, error) { resp := &lineagepb.BatchSearchLinkProcessesResponse{} if pageToken != "" { req.PageToken = pageToken } if pageSize > math.MaxInt32 { req.PageSize = math.MaxInt32 } else if pageSize != 0 { req.PageSize = int32(pageSize) } jsonReq, err := m.Marshal(req) if err != nil { return nil, "", err } baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, "", err } baseUrl.Path += fmt.Sprintf("/v1/%v:batchSearchLinkProcesses", req.GetParent()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := append(c.xGoogHeaders, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) if err != nil { return err } httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "BatchSearchLinkProcesses") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, "", e } it.Response = resp return resp.GetProcessLinks(), resp.GetNextPageToken(), nil } fetch := func(pageSize int, pageToken string) (string, error) { items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) if err != nil { return "", err } it.items = append(it.items, items...) return nextPageToken, nil } it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) it.pageInfo.MaxSize = int(req.GetPageSize()) it.pageInfo.Token = req.GetPageToken() return it } // CancelOperation is a utility method from google.longrunning.Operations. func (c *restClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) if err != nil { return err } baseUrl, err := url.Parse(c.endpoint) if err != nil { return err } baseUrl.Path += fmt.Sprintf("/v1/%v:cancel", req.GetName()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) hds = append(hds, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) if err != nil { return err } httpReq = httpReq.WithContext(ctx) httpReq.Header = headers _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CancelOperation") return err }, opts...) } // DeleteOperation is a utility method from google.longrunning.Operations. func (c *restClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { baseUrl, err := url.Parse(c.endpoint) if err != nil { return err } baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) hds = append(hds, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return err } httpReq = httpReq.WithContext(ctx) httpReq.Header = headers _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteOperation") return err }, opts...) } // GetOperation is a utility method from google.longrunning.Operations. func (c *restClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, err } baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} hds = append(c.xGoogHeaders, hds...) hds = append(hds, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} resp := &longrunningpb.Operation{} e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return err } httpReq = httpReq.WithContext(ctx) httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetOperation") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, e } return resp, nil } // ListOperations is a utility method from google.longrunning.Operations. func (c *restClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { it := &OperationIterator{} req = proto.Clone(req).(*longrunningpb.ListOperationsRequest) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) { resp := &longrunningpb.ListOperationsResponse{} if pageToken != "" { req.PageToken = pageToken } if pageSize > math.MaxInt32 { req.PageSize = math.MaxInt32 } else if pageSize != 0 { req.PageSize = int32(pageSize) } baseUrl, err := url.Parse(c.endpoint) if err != nil { return nil, "", err } baseUrl.Path += fmt.Sprintf("/v1/%v/operations", req.GetName()) params := url.Values{} params.Add("$alt", "json;enum-encoding=int") if req.GetFilter() != "" { params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) } if req.GetPageSize() != 0 { params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) } if req.GetPageToken() != "" { params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) } baseUrl.RawQuery = params.Encode() // Build HTTP headers from client and context metadata. hds := append(c.xGoogHeaders, "Content-Type", "application/json") headers := gax.BuildHeaders(ctx, hds...) e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { if settings.Path != "" { baseUrl.Path = settings.Path } httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return err } httpReq.Header = headers buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListOperations") if err != nil { return err } if err := unm.Unmarshal(buf, resp); err != nil { return err } return nil }, opts...) if e != nil { return nil, "", e } it.Response = resp return resp.GetOperations(), resp.GetNextPageToken(), nil } fetch := func(pageSize int, pageToken string) (string, error) { items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) if err != nil { return "", err } it.items = append(it.items, items...) return nextPageToken, nil } it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) it.pageInfo.MaxSize = int(req.GetPageSize()) it.pageInfo.Token = req.GetPageToken() return it } // DeleteProcessOperation returns a new DeleteProcessOperation from a given name. // The name must be that of a previously created DeleteProcessOperation, possibly from a different process. func (c *gRPCClient) DeleteProcessOperation(name string) *DeleteProcessOperation { return &DeleteProcessOperation{ lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), } } // DeleteProcessOperation returns a new DeleteProcessOperation from a given name. // The name must be that of a previously created DeleteProcessOperation, possibly from a different process. func (c *restClient) DeleteProcessOperation(name string) *DeleteProcessOperation { override := fmt.Sprintf("/v1/%s", name) return &DeleteProcessOperation{ lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), pollPath: override, } } // DeleteRunOperation returns a new DeleteRunOperation from a given name. // The name must be that of a previously created DeleteRunOperation, possibly from a different process. func (c *gRPCClient) DeleteRunOperation(name string) *DeleteRunOperation { return &DeleteRunOperation{ lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), } } // DeleteRunOperation returns a new DeleteRunOperation from a given name. // The name must be that of a previously created DeleteRunOperation, possibly from a different process. func (c *restClient) DeleteRunOperation(name string) *DeleteRunOperation { override := fmt.Sprintf("/v1/%s", name) return &DeleteRunOperation{ lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), pollPath: override, } }