cloud.google.com/go/aiplatform@v1.106.0/apiv1/pipeline_client.go (about)

     1  // Copyright 2025 Google LLC
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     https://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Code generated by protoc-gen-go_gapic. DO NOT EDIT.
    16  
    17  package aiplatform
    18  
    19  import (
    20  	"context"
    21  	"fmt"
    22  	"log/slog"
    23  	"math"
    24  	"net/url"
    25  
    26  	aiplatformpb "cloud.google.com/go/aiplatform/apiv1/aiplatformpb"
    27  	iampb "cloud.google.com/go/iam/apiv1/iampb"
    28  	"cloud.google.com/go/longrunning"
    29  	lroauto "cloud.google.com/go/longrunning/autogen"
    30  	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
    31  	gax "github.com/googleapis/gax-go/v2"
    32  	"google.golang.org/api/iterator"
    33  	"google.golang.org/api/option"
    34  	"google.golang.org/api/option/internaloption"
    35  	gtransport "google.golang.org/api/transport/grpc"
    36  	locationpb "google.golang.org/genproto/googleapis/cloud/location"
    37  	"google.golang.org/grpc"
    38  	"google.golang.org/protobuf/proto"
    39  )
    40  
    41  var newPipelineClientHook clientHook
    42  
    43  // PipelineCallOptions contains the retry settings for each method of PipelineClient.
    44  type PipelineCallOptions struct {
    45  	CreateTrainingPipeline  []gax.CallOption
    46  	GetTrainingPipeline     []gax.CallOption
    47  	ListTrainingPipelines   []gax.CallOption
    48  	DeleteTrainingPipeline  []gax.CallOption
    49  	CancelTrainingPipeline  []gax.CallOption
    50  	CreatePipelineJob       []gax.CallOption
    51  	GetPipelineJob          []gax.CallOption
    52  	ListPipelineJobs        []gax.CallOption
    53  	DeletePipelineJob       []gax.CallOption
    54  	BatchDeletePipelineJobs []gax.CallOption
    55  	CancelPipelineJob       []gax.CallOption
    56  	BatchCancelPipelineJobs []gax.CallOption
    57  	GetLocation             []gax.CallOption
    58  	ListLocations           []gax.CallOption
    59  	GetIamPolicy            []gax.CallOption
    60  	SetIamPolicy            []gax.CallOption
    61  	TestIamPermissions      []gax.CallOption
    62  	CancelOperation         []gax.CallOption
    63  	DeleteOperation         []gax.CallOption
    64  	GetOperation            []gax.CallOption
    65  	ListOperations          []gax.CallOption
    66  	WaitOperation           []gax.CallOption
    67  }
    68  
    69  func defaultPipelineGRPCClientOptions() []option.ClientOption {
    70  	return []option.ClientOption{
    71  		internaloption.WithDefaultEndpoint("aiplatform.googleapis.com:443"),
    72  		internaloption.WithDefaultEndpointTemplate("aiplatform.UNIVERSE_DOMAIN:443"),
    73  		internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"),
    74  		internaloption.WithDefaultUniverseDomain("googleapis.com"),
    75  		internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"),
    76  		internaloption.WithDefaultScopes(DefaultAuthScopes()...),
    77  		internaloption.EnableJwtWithScope(),
    78  		internaloption.EnableNewAuthLibrary(),
    79  		option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
    80  			grpc.MaxCallRecvMsgSize(math.MaxInt32))),
    81  	}
    82  }
    83  
    84  func defaultPipelineCallOptions() *PipelineCallOptions {
    85  	return &PipelineCallOptions{
    86  		CreateTrainingPipeline:  []gax.CallOption{},
    87  		GetTrainingPipeline:     []gax.CallOption{},
    88  		ListTrainingPipelines:   []gax.CallOption{},
    89  		DeleteTrainingPipeline:  []gax.CallOption{},
    90  		CancelTrainingPipeline:  []gax.CallOption{},
    91  		CreatePipelineJob:       []gax.CallOption{},
    92  		GetPipelineJob:          []gax.CallOption{},
    93  		ListPipelineJobs:        []gax.CallOption{},
    94  		DeletePipelineJob:       []gax.CallOption{},
    95  		BatchDeletePipelineJobs: []gax.CallOption{},
    96  		CancelPipelineJob:       []gax.CallOption{},
    97  		BatchCancelPipelineJobs: []gax.CallOption{},
    98  		GetLocation:             []gax.CallOption{},
    99  		ListLocations:           []gax.CallOption{},
   100  		GetIamPolicy:            []gax.CallOption{},
   101  		SetIamPolicy:            []gax.CallOption{},
   102  		TestIamPermissions:      []gax.CallOption{},
   103  		CancelOperation:         []gax.CallOption{},
   104  		DeleteOperation:         []gax.CallOption{},
   105  		GetOperation:            []gax.CallOption{},
   106  		ListOperations:          []gax.CallOption{},
   107  		WaitOperation:           []gax.CallOption{},
   108  	}
   109  }
   110  
   111  // internalPipelineClient is an interface that defines the methods available from Vertex AI API.
   112  type internalPipelineClient interface {
   113  	Close() error
   114  	setGoogleClientInfo(...string)
   115  	Connection() *grpc.ClientConn
   116  	CreateTrainingPipeline(context.Context, *aiplatformpb.CreateTrainingPipelineRequest, ...gax.CallOption) (*aiplatformpb.TrainingPipeline, error)
   117  	GetTrainingPipeline(context.Context, *aiplatformpb.GetTrainingPipelineRequest, ...gax.CallOption) (*aiplatformpb.TrainingPipeline, error)
   118  	ListTrainingPipelines(context.Context, *aiplatformpb.ListTrainingPipelinesRequest, ...gax.CallOption) *TrainingPipelineIterator
   119  	DeleteTrainingPipeline(context.Context, *aiplatformpb.DeleteTrainingPipelineRequest, ...gax.CallOption) (*DeleteTrainingPipelineOperation, error)
   120  	DeleteTrainingPipelineOperation(name string) *DeleteTrainingPipelineOperation
   121  	CancelTrainingPipeline(context.Context, *aiplatformpb.CancelTrainingPipelineRequest, ...gax.CallOption) error
   122  	CreatePipelineJob(context.Context, *aiplatformpb.CreatePipelineJobRequest, ...gax.CallOption) (*aiplatformpb.PipelineJob, error)
   123  	GetPipelineJob(context.Context, *aiplatformpb.GetPipelineJobRequest, ...gax.CallOption) (*aiplatformpb.PipelineJob, error)
   124  	ListPipelineJobs(context.Context, *aiplatformpb.ListPipelineJobsRequest, ...gax.CallOption) *PipelineJobIterator
   125  	DeletePipelineJob(context.Context, *aiplatformpb.DeletePipelineJobRequest, ...gax.CallOption) (*DeletePipelineJobOperation, error)
   126  	DeletePipelineJobOperation(name string) *DeletePipelineJobOperation
   127  	BatchDeletePipelineJobs(context.Context, *aiplatformpb.BatchDeletePipelineJobsRequest, ...gax.CallOption) (*BatchDeletePipelineJobsOperation, error)
   128  	BatchDeletePipelineJobsOperation(name string) *BatchDeletePipelineJobsOperation
   129  	CancelPipelineJob(context.Context, *aiplatformpb.CancelPipelineJobRequest, ...gax.CallOption) error
   130  	BatchCancelPipelineJobs(context.Context, *aiplatformpb.BatchCancelPipelineJobsRequest, ...gax.CallOption) (*BatchCancelPipelineJobsOperation, error)
   131  	BatchCancelPipelineJobsOperation(name string) *BatchCancelPipelineJobsOperation
   132  	GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error)
   133  	ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator
   134  	GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error)
   135  	SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error)
   136  	TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
   137  	CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error
   138  	DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error
   139  	GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
   140  	ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator
   141  	WaitOperation(context.Context, *longrunningpb.WaitOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
   142  }
   143  
   144  // PipelineClient is a client for interacting with Vertex AI API.
   145  // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
   146  //
   147  // A service for creating and managing Vertex AI’s pipelines. This includes both
   148  // TrainingPipeline resources (used for AutoML and custom training) and
   149  // PipelineJob resources (used for Vertex AI Pipelines).
   150  type PipelineClient struct {
   151  	// The internal transport-dependent client.
   152  	internalClient internalPipelineClient
   153  
   154  	// The call options for this service.
   155  	CallOptions *PipelineCallOptions
   156  
   157  	// LROClient is used internally to handle long-running operations.
   158  	// It is exposed so that its CallOptions can be modified if required.
   159  	// Users should not Close this client.
   160  	LROClient *lroauto.OperationsClient
   161  }
   162  
   163  // Wrapper methods routed to the internal client.
   164  
   165  // Close closes the connection to the API service. The user should invoke this when
   166  // the client is no longer required.
   167  func (c *PipelineClient) Close() error {
   168  	return c.internalClient.Close()
   169  }
   170  
   171  // setGoogleClientInfo sets the name and version of the application in
   172  // the `x-goog-api-client` header passed on each request. Intended for
   173  // use by Google-written clients.
   174  func (c *PipelineClient) setGoogleClientInfo(keyval ...string) {
   175  	c.internalClient.setGoogleClientInfo(keyval...)
   176  }
   177  
   178  // Connection returns a connection to the API service.
   179  //
   180  // Deprecated: Connections are now pooled so this method does not always
   181  // return the same resource.
   182  func (c *PipelineClient) Connection() *grpc.ClientConn {
   183  	return c.internalClient.Connection()
   184  }
   185  
   186  // CreateTrainingPipeline creates a TrainingPipeline. A created TrainingPipeline right away will be
   187  // attempted to be run.
   188  func (c *PipelineClient) CreateTrainingPipeline(ctx context.Context, req *aiplatformpb.CreateTrainingPipelineRequest, opts ...gax.CallOption) (*aiplatformpb.TrainingPipeline, error) {
   189  	return c.internalClient.CreateTrainingPipeline(ctx, req, opts...)
   190  }
   191  
   192  // GetTrainingPipeline gets a TrainingPipeline.
   193  func (c *PipelineClient) GetTrainingPipeline(ctx context.Context, req *aiplatformpb.GetTrainingPipelineRequest, opts ...gax.CallOption) (*aiplatformpb.TrainingPipeline, error) {
   194  	return c.internalClient.GetTrainingPipeline(ctx, req, opts...)
   195  }
   196  
   197  // ListTrainingPipelines lists TrainingPipelines in a Location.
   198  func (c *PipelineClient) ListTrainingPipelines(ctx context.Context, req *aiplatformpb.ListTrainingPipelinesRequest, opts ...gax.CallOption) *TrainingPipelineIterator {
   199  	return c.internalClient.ListTrainingPipelines(ctx, req, opts...)
   200  }
   201  
   202  // DeleteTrainingPipeline deletes a TrainingPipeline.
   203  func (c *PipelineClient) DeleteTrainingPipeline(ctx context.Context, req *aiplatformpb.DeleteTrainingPipelineRequest, opts ...gax.CallOption) (*DeleteTrainingPipelineOperation, error) {
   204  	return c.internalClient.DeleteTrainingPipeline(ctx, req, opts...)
   205  }
   206  
   207  // DeleteTrainingPipelineOperation returns a new DeleteTrainingPipelineOperation from a given name.
   208  // The name must be that of a previously created DeleteTrainingPipelineOperation, possibly from a different process.
   209  func (c *PipelineClient) DeleteTrainingPipelineOperation(name string) *DeleteTrainingPipelineOperation {
   210  	return c.internalClient.DeleteTrainingPipelineOperation(name)
   211  }
   212  
   213  // CancelTrainingPipeline cancels a TrainingPipeline.
   214  // Starts asynchronous cancellation on the TrainingPipeline. The server
   215  // makes a best effort to cancel the pipeline, but success is not
   216  // guaranteed. Clients can use
   217  // PipelineService.GetTrainingPipeline
   218  // or other methods to check whether the cancellation succeeded or whether the
   219  // pipeline completed despite cancellation. On successful cancellation,
   220  // the TrainingPipeline is not deleted; instead it becomes a pipeline with
   221  // a
   222  // TrainingPipeline.error
   223  // value with a google.rpc.Status.code of 1,
   224  // corresponding to Code.CANCELLED, and
   225  // TrainingPipeline.state
   226  // is set to CANCELLED.
   227  func (c *PipelineClient) CancelTrainingPipeline(ctx context.Context, req *aiplatformpb.CancelTrainingPipelineRequest, opts ...gax.CallOption) error {
   228  	return c.internalClient.CancelTrainingPipeline(ctx, req, opts...)
   229  }
   230  
   231  // CreatePipelineJob creates a PipelineJob. A PipelineJob will run immediately when created.
   232  func (c *PipelineClient) CreatePipelineJob(ctx context.Context, req *aiplatformpb.CreatePipelineJobRequest, opts ...gax.CallOption) (*aiplatformpb.PipelineJob, error) {
   233  	return c.internalClient.CreatePipelineJob(ctx, req, opts...)
   234  }
   235  
   236  // GetPipelineJob gets a PipelineJob.
   237  func (c *PipelineClient) GetPipelineJob(ctx context.Context, req *aiplatformpb.GetPipelineJobRequest, opts ...gax.CallOption) (*aiplatformpb.PipelineJob, error) {
   238  	return c.internalClient.GetPipelineJob(ctx, req, opts...)
   239  }
   240  
   241  // ListPipelineJobs lists PipelineJobs in a Location.
   242  func (c *PipelineClient) ListPipelineJobs(ctx context.Context, req *aiplatformpb.ListPipelineJobsRequest, opts ...gax.CallOption) *PipelineJobIterator {
   243  	return c.internalClient.ListPipelineJobs(ctx, req, opts...)
   244  }
   245  
   246  // DeletePipelineJob deletes a PipelineJob.
   247  func (c *PipelineClient) DeletePipelineJob(ctx context.Context, req *aiplatformpb.DeletePipelineJobRequest, opts ...gax.CallOption) (*DeletePipelineJobOperation, error) {
   248  	return c.internalClient.DeletePipelineJob(ctx, req, opts...)
   249  }
   250  
   251  // DeletePipelineJobOperation returns a new DeletePipelineJobOperation from a given name.
   252  // The name must be that of a previously created DeletePipelineJobOperation, possibly from a different process.
   253  func (c *PipelineClient) DeletePipelineJobOperation(name string) *DeletePipelineJobOperation {
   254  	return c.internalClient.DeletePipelineJobOperation(name)
   255  }
   256  
   257  // BatchDeletePipelineJobs batch deletes PipelineJobs
   258  // The Operation is atomic. If it fails, none of the PipelineJobs are deleted.
   259  // If it succeeds, all of the PipelineJobs are deleted.
   260  func (c *PipelineClient) BatchDeletePipelineJobs(ctx context.Context, req *aiplatformpb.BatchDeletePipelineJobsRequest, opts ...gax.CallOption) (*BatchDeletePipelineJobsOperation, error) {
   261  	return c.internalClient.BatchDeletePipelineJobs(ctx, req, opts...)
   262  }
   263  
   264  // BatchDeletePipelineJobsOperation returns a new BatchDeletePipelineJobsOperation from a given name.
   265  // The name must be that of a previously created BatchDeletePipelineJobsOperation, possibly from a different process.
   266  func (c *PipelineClient) BatchDeletePipelineJobsOperation(name string) *BatchDeletePipelineJobsOperation {
   267  	return c.internalClient.BatchDeletePipelineJobsOperation(name)
   268  }
   269  
   270  // CancelPipelineJob cancels a PipelineJob.
   271  // Starts asynchronous cancellation on the PipelineJob. The server
   272  // makes a best effort to cancel the pipeline, but success is not
   273  // guaranteed. Clients can use
   274  // PipelineService.GetPipelineJob
   275  // or other methods to check whether the cancellation succeeded or whether the
   276  // pipeline completed despite cancellation. On successful cancellation,
   277  // the PipelineJob is not deleted; instead it becomes a pipeline with
   278  // a PipelineJob.error value
   279  // with a google.rpc.Status.code of 1, corresponding
   280  // to Code.CANCELLED, and
   281  // PipelineJob.state is set to
   282  // CANCELLED.
   283  func (c *PipelineClient) CancelPipelineJob(ctx context.Context, req *aiplatformpb.CancelPipelineJobRequest, opts ...gax.CallOption) error {
   284  	return c.internalClient.CancelPipelineJob(ctx, req, opts...)
   285  }
   286  
   287  // BatchCancelPipelineJobs batch cancel PipelineJobs.
   288  // Firstly the server will check if all the jobs are in non-terminal states,
   289  // and skip the jobs that are already terminated.
   290  // If the operation failed, none of the pipeline jobs are cancelled.
   291  // The server will poll the states of all the pipeline jobs periodically
   292  // to check the cancellation status.
   293  // This operation will return an LRO.
   294  func (c *PipelineClient) BatchCancelPipelineJobs(ctx context.Context, req *aiplatformpb.BatchCancelPipelineJobsRequest, opts ...gax.CallOption) (*BatchCancelPipelineJobsOperation, error) {
   295  	return c.internalClient.BatchCancelPipelineJobs(ctx, req, opts...)
   296  }
   297  
   298  // BatchCancelPipelineJobsOperation returns a new BatchCancelPipelineJobsOperation from a given name.
   299  // The name must be that of a previously created BatchCancelPipelineJobsOperation, possibly from a different process.
   300  func (c *PipelineClient) BatchCancelPipelineJobsOperation(name string) *BatchCancelPipelineJobsOperation {
   301  	return c.internalClient.BatchCancelPipelineJobsOperation(name)
   302  }
   303  
   304  // GetLocation gets information about a location.
   305  func (c *PipelineClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
   306  	return c.internalClient.GetLocation(ctx, req, opts...)
   307  }
   308  
   309  // ListLocations lists information about the supported locations for this service.
   310  func (c *PipelineClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
   311  	return c.internalClient.ListLocations(ctx, req, opts...)
   312  }
   313  
   314  // GetIamPolicy gets the access control policy for a resource. Returns an empty policy
   315  // if the resource exists and does not have a policy set.
   316  func (c *PipelineClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   317  	return c.internalClient.GetIamPolicy(ctx, req, opts...)
   318  }
   319  
   320  // SetIamPolicy sets the access control policy on the specified resource. Replaces
   321  // any existing policy.
   322  //
   323  // Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED
   324  // errors.
   325  func (c *PipelineClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   326  	return c.internalClient.SetIamPolicy(ctx, req, opts...)
   327  }
   328  
   329  // TestIamPermissions returns permissions that a caller has on the specified resource. If the
   330  // resource does not exist, this will return an empty set of
   331  // permissions, not a NOT_FOUND error.
   332  //
   333  // Note: This operation is designed to be used for building
   334  // permission-aware UIs and command-line tools, not for authorization
   335  // checking. This operation may “fail open” without warning.
   336  func (c *PipelineClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
   337  	return c.internalClient.TestIamPermissions(ctx, req, opts...)
   338  }
   339  
   340  // CancelOperation is a utility method from google.longrunning.Operations.
   341  func (c *PipelineClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
   342  	return c.internalClient.CancelOperation(ctx, req, opts...)
   343  }
   344  
   345  // DeleteOperation is a utility method from google.longrunning.Operations.
   346  func (c *PipelineClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
   347  	return c.internalClient.DeleteOperation(ctx, req, opts...)
   348  }
   349  
   350  // GetOperation is a utility method from google.longrunning.Operations.
   351  func (c *PipelineClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   352  	return c.internalClient.GetOperation(ctx, req, opts...)
   353  }
   354  
   355  // ListOperations is a utility method from google.longrunning.Operations.
   356  func (c *PipelineClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
   357  	return c.internalClient.ListOperations(ctx, req, opts...)
   358  }
   359  
   360  // WaitOperation is a utility method from google.longrunning.Operations.
   361  func (c *PipelineClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   362  	return c.internalClient.WaitOperation(ctx, req, opts...)
   363  }
   364  
   365  // pipelineGRPCClient is a client for interacting with Vertex AI API over gRPC transport.
   366  //
   367  // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
   368  type pipelineGRPCClient struct {
   369  	// Connection pool of gRPC connections to the service.
   370  	connPool gtransport.ConnPool
   371  
   372  	// Points back to the CallOptions field of the containing PipelineClient
   373  	CallOptions **PipelineCallOptions
   374  
   375  	// The gRPC API client.
   376  	pipelineClient aiplatformpb.PipelineServiceClient
   377  
   378  	// LROClient is used internally to handle long-running operations.
   379  	// It is exposed so that its CallOptions can be modified if required.
   380  	// Users should not Close this client.
   381  	LROClient **lroauto.OperationsClient
   382  
   383  	operationsClient longrunningpb.OperationsClient
   384  
   385  	iamPolicyClient iampb.IAMPolicyClient
   386  
   387  	locationsClient locationpb.LocationsClient
   388  
   389  	// The x-goog-* metadata to be sent with each request.
   390  	xGoogHeaders []string
   391  
   392  	logger *slog.Logger
   393  }
   394  
   395  // NewPipelineClient creates a new pipeline service client based on gRPC.
   396  // The returned client must be Closed when it is done being used to clean up its underlying connections.
   397  //
   398  // A service for creating and managing Vertex AI’s pipelines. This includes both
   399  // TrainingPipeline resources (used for AutoML and custom training) and
   400  // PipelineJob resources (used for Vertex AI Pipelines).
   401  func NewPipelineClient(ctx context.Context, opts ...option.ClientOption) (*PipelineClient, error) {
   402  	clientOpts := defaultPipelineGRPCClientOptions()
   403  	if newPipelineClientHook != nil {
   404  		hookOpts, err := newPipelineClientHook(ctx, clientHookParams{})
   405  		if err != nil {
   406  			return nil, err
   407  		}
   408  		clientOpts = append(clientOpts, hookOpts...)
   409  	}
   410  
   411  	connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
   412  	if err != nil {
   413  		return nil, err
   414  	}
   415  	client := PipelineClient{CallOptions: defaultPipelineCallOptions()}
   416  
   417  	c := &pipelineGRPCClient{
   418  		connPool:         connPool,
   419  		pipelineClient:   aiplatformpb.NewPipelineServiceClient(connPool),
   420  		CallOptions:      &client.CallOptions,
   421  		logger:           internaloption.GetLogger(opts),
   422  		operationsClient: longrunningpb.NewOperationsClient(connPool),
   423  		iamPolicyClient:  iampb.NewIAMPolicyClient(connPool),
   424  		locationsClient:  locationpb.NewLocationsClient(connPool),
   425  	}
   426  	c.setGoogleClientInfo()
   427  
   428  	client.internalClient = c
   429  
   430  	client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
   431  	if err != nil {
   432  		// This error "should not happen", since we are just reusing old connection pool
   433  		// and never actually need to dial.
   434  		// If this does happen, we could leak connp. However, we cannot close conn:
   435  		// If the user invoked the constructor with option.WithGRPCConn,
   436  		// we would close a connection that's still in use.
   437  		// TODO: investigate error conditions.
   438  		return nil, err
   439  	}
   440  	c.LROClient = &client.LROClient
   441  	return &client, nil
   442  }
   443  
   444  // Connection returns a connection to the API service.
   445  //
   446  // Deprecated: Connections are now pooled so this method does not always
   447  // return the same resource.
   448  func (c *pipelineGRPCClient) Connection() *grpc.ClientConn {
   449  	return c.connPool.Conn()
   450  }
   451  
   452  // setGoogleClientInfo sets the name and version of the application in
   453  // the `x-goog-api-client` header passed on each request. Intended for
   454  // use by Google-written clients.
   455  func (c *pipelineGRPCClient) setGoogleClientInfo(keyval ...string) {
   456  	kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
   457  	kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion)
   458  	c.xGoogHeaders = []string{
   459  		"x-goog-api-client", gax.XGoogHeader(kv...),
   460  	}
   461  }
   462  
   463  // Close closes the connection to the API service. The user should invoke this when
   464  // the client is no longer required.
   465  func (c *pipelineGRPCClient) Close() error {
   466  	return c.connPool.Close()
   467  }
   468  
   469  func (c *pipelineGRPCClient) CreateTrainingPipeline(ctx context.Context, req *aiplatformpb.CreateTrainingPipelineRequest, opts ...gax.CallOption) (*aiplatformpb.TrainingPipeline, error) {
   470  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   471  
   472  	hds = append(c.xGoogHeaders, hds...)
   473  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   474  	opts = append((*c.CallOptions).CreateTrainingPipeline[0:len((*c.CallOptions).CreateTrainingPipeline):len((*c.CallOptions).CreateTrainingPipeline)], opts...)
   475  	var resp *aiplatformpb.TrainingPipeline
   476  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   477  		var err error
   478  		resp, err = executeRPC(ctx, c.pipelineClient.CreateTrainingPipeline, req, settings.GRPC, c.logger, "CreateTrainingPipeline")
   479  		return err
   480  	}, opts...)
   481  	if err != nil {
   482  		return nil, err
   483  	}
   484  	return resp, nil
   485  }
   486  
   487  func (c *pipelineGRPCClient) GetTrainingPipeline(ctx context.Context, req *aiplatformpb.GetTrainingPipelineRequest, opts ...gax.CallOption) (*aiplatformpb.TrainingPipeline, error) {
   488  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   489  
   490  	hds = append(c.xGoogHeaders, hds...)
   491  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   492  	opts = append((*c.CallOptions).GetTrainingPipeline[0:len((*c.CallOptions).GetTrainingPipeline):len((*c.CallOptions).GetTrainingPipeline)], opts...)
   493  	var resp *aiplatformpb.TrainingPipeline
   494  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   495  		var err error
   496  		resp, err = executeRPC(ctx, c.pipelineClient.GetTrainingPipeline, req, settings.GRPC, c.logger, "GetTrainingPipeline")
   497  		return err
   498  	}, opts...)
   499  	if err != nil {
   500  		return nil, err
   501  	}
   502  	return resp, nil
   503  }
   504  
   505  func (c *pipelineGRPCClient) ListTrainingPipelines(ctx context.Context, req *aiplatformpb.ListTrainingPipelinesRequest, opts ...gax.CallOption) *TrainingPipelineIterator {
   506  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   507  
   508  	hds = append(c.xGoogHeaders, hds...)
   509  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   510  	opts = append((*c.CallOptions).ListTrainingPipelines[0:len((*c.CallOptions).ListTrainingPipelines):len((*c.CallOptions).ListTrainingPipelines)], opts...)
   511  	it := &TrainingPipelineIterator{}
   512  	req = proto.Clone(req).(*aiplatformpb.ListTrainingPipelinesRequest)
   513  	it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.TrainingPipeline, string, error) {
   514  		resp := &aiplatformpb.ListTrainingPipelinesResponse{}
   515  		if pageToken != "" {
   516  			req.PageToken = pageToken
   517  		}
   518  		if pageSize > math.MaxInt32 {
   519  			req.PageSize = math.MaxInt32
   520  		} else if pageSize != 0 {
   521  			req.PageSize = int32(pageSize)
   522  		}
   523  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   524  			var err error
   525  			resp, err = executeRPC(ctx, c.pipelineClient.ListTrainingPipelines, req, settings.GRPC, c.logger, "ListTrainingPipelines")
   526  			return err
   527  		}, opts...)
   528  		if err != nil {
   529  			return nil, "", err
   530  		}
   531  
   532  		it.Response = resp
   533  		return resp.GetTrainingPipelines(), resp.GetNextPageToken(), nil
   534  	}
   535  	fetch := func(pageSize int, pageToken string) (string, error) {
   536  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   537  		if err != nil {
   538  			return "", err
   539  		}
   540  		it.items = append(it.items, items...)
   541  		return nextPageToken, nil
   542  	}
   543  
   544  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   545  	it.pageInfo.MaxSize = int(req.GetPageSize())
   546  	it.pageInfo.Token = req.GetPageToken()
   547  
   548  	return it
   549  }
   550  
   551  func (c *pipelineGRPCClient) DeleteTrainingPipeline(ctx context.Context, req *aiplatformpb.DeleteTrainingPipelineRequest, opts ...gax.CallOption) (*DeleteTrainingPipelineOperation, error) {
   552  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   553  
   554  	hds = append(c.xGoogHeaders, hds...)
   555  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   556  	opts = append((*c.CallOptions).DeleteTrainingPipeline[0:len((*c.CallOptions).DeleteTrainingPipeline):len((*c.CallOptions).DeleteTrainingPipeline)], opts...)
   557  	var resp *longrunningpb.Operation
   558  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   559  		var err error
   560  		resp, err = executeRPC(ctx, c.pipelineClient.DeleteTrainingPipeline, req, settings.GRPC, c.logger, "DeleteTrainingPipeline")
   561  		return err
   562  	}, opts...)
   563  	if err != nil {
   564  		return nil, err
   565  	}
   566  	return &DeleteTrainingPipelineOperation{
   567  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   568  	}, nil
   569  }
   570  
   571  func (c *pipelineGRPCClient) CancelTrainingPipeline(ctx context.Context, req *aiplatformpb.CancelTrainingPipelineRequest, opts ...gax.CallOption) error {
   572  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   573  
   574  	hds = append(c.xGoogHeaders, hds...)
   575  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   576  	opts = append((*c.CallOptions).CancelTrainingPipeline[0:len((*c.CallOptions).CancelTrainingPipeline):len((*c.CallOptions).CancelTrainingPipeline)], opts...)
   577  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   578  		var err error
   579  		_, err = executeRPC(ctx, c.pipelineClient.CancelTrainingPipeline, req, settings.GRPC, c.logger, "CancelTrainingPipeline")
   580  		return err
   581  	}, opts...)
   582  	return err
   583  }
   584  
   585  func (c *pipelineGRPCClient) CreatePipelineJob(ctx context.Context, req *aiplatformpb.CreatePipelineJobRequest, opts ...gax.CallOption) (*aiplatformpb.PipelineJob, error) {
   586  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   587  
   588  	hds = append(c.xGoogHeaders, hds...)
   589  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   590  	opts = append((*c.CallOptions).CreatePipelineJob[0:len((*c.CallOptions).CreatePipelineJob):len((*c.CallOptions).CreatePipelineJob)], opts...)
   591  	var resp *aiplatformpb.PipelineJob
   592  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   593  		var err error
   594  		resp, err = executeRPC(ctx, c.pipelineClient.CreatePipelineJob, req, settings.GRPC, c.logger, "CreatePipelineJob")
   595  		return err
   596  	}, opts...)
   597  	if err != nil {
   598  		return nil, err
   599  	}
   600  	return resp, nil
   601  }
   602  
   603  func (c *pipelineGRPCClient) GetPipelineJob(ctx context.Context, req *aiplatformpb.GetPipelineJobRequest, opts ...gax.CallOption) (*aiplatformpb.PipelineJob, error) {
   604  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   605  
   606  	hds = append(c.xGoogHeaders, hds...)
   607  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   608  	opts = append((*c.CallOptions).GetPipelineJob[0:len((*c.CallOptions).GetPipelineJob):len((*c.CallOptions).GetPipelineJob)], opts...)
   609  	var resp *aiplatformpb.PipelineJob
   610  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   611  		var err error
   612  		resp, err = executeRPC(ctx, c.pipelineClient.GetPipelineJob, req, settings.GRPC, c.logger, "GetPipelineJob")
   613  		return err
   614  	}, opts...)
   615  	if err != nil {
   616  		return nil, err
   617  	}
   618  	return resp, nil
   619  }
   620  
   621  func (c *pipelineGRPCClient) ListPipelineJobs(ctx context.Context, req *aiplatformpb.ListPipelineJobsRequest, opts ...gax.CallOption) *PipelineJobIterator {
   622  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   623  
   624  	hds = append(c.xGoogHeaders, hds...)
   625  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   626  	opts = append((*c.CallOptions).ListPipelineJobs[0:len((*c.CallOptions).ListPipelineJobs):len((*c.CallOptions).ListPipelineJobs)], opts...)
   627  	it := &PipelineJobIterator{}
   628  	req = proto.Clone(req).(*aiplatformpb.ListPipelineJobsRequest)
   629  	it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.PipelineJob, string, error) {
   630  		resp := &aiplatformpb.ListPipelineJobsResponse{}
   631  		if pageToken != "" {
   632  			req.PageToken = pageToken
   633  		}
   634  		if pageSize > math.MaxInt32 {
   635  			req.PageSize = math.MaxInt32
   636  		} else if pageSize != 0 {
   637  			req.PageSize = int32(pageSize)
   638  		}
   639  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   640  			var err error
   641  			resp, err = executeRPC(ctx, c.pipelineClient.ListPipelineJobs, req, settings.GRPC, c.logger, "ListPipelineJobs")
   642  			return err
   643  		}, opts...)
   644  		if err != nil {
   645  			return nil, "", err
   646  		}
   647  
   648  		it.Response = resp
   649  		return resp.GetPipelineJobs(), resp.GetNextPageToken(), nil
   650  	}
   651  	fetch := func(pageSize int, pageToken string) (string, error) {
   652  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   653  		if err != nil {
   654  			return "", err
   655  		}
   656  		it.items = append(it.items, items...)
   657  		return nextPageToken, nil
   658  	}
   659  
   660  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   661  	it.pageInfo.MaxSize = int(req.GetPageSize())
   662  	it.pageInfo.Token = req.GetPageToken()
   663  
   664  	return it
   665  }
   666  
   667  func (c *pipelineGRPCClient) DeletePipelineJob(ctx context.Context, req *aiplatformpb.DeletePipelineJobRequest, opts ...gax.CallOption) (*DeletePipelineJobOperation, error) {
   668  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   669  
   670  	hds = append(c.xGoogHeaders, hds...)
   671  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   672  	opts = append((*c.CallOptions).DeletePipelineJob[0:len((*c.CallOptions).DeletePipelineJob):len((*c.CallOptions).DeletePipelineJob)], opts...)
   673  	var resp *longrunningpb.Operation
   674  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   675  		var err error
   676  		resp, err = executeRPC(ctx, c.pipelineClient.DeletePipelineJob, req, settings.GRPC, c.logger, "DeletePipelineJob")
   677  		return err
   678  	}, opts...)
   679  	if err != nil {
   680  		return nil, err
   681  	}
   682  	return &DeletePipelineJobOperation{
   683  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   684  	}, nil
   685  }
   686  
   687  func (c *pipelineGRPCClient) BatchDeletePipelineJobs(ctx context.Context, req *aiplatformpb.BatchDeletePipelineJobsRequest, opts ...gax.CallOption) (*BatchDeletePipelineJobsOperation, error) {
   688  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   689  
   690  	hds = append(c.xGoogHeaders, hds...)
   691  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   692  	opts = append((*c.CallOptions).BatchDeletePipelineJobs[0:len((*c.CallOptions).BatchDeletePipelineJobs):len((*c.CallOptions).BatchDeletePipelineJobs)], opts...)
   693  	var resp *longrunningpb.Operation
   694  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   695  		var err error
   696  		resp, err = executeRPC(ctx, c.pipelineClient.BatchDeletePipelineJobs, req, settings.GRPC, c.logger, "BatchDeletePipelineJobs")
   697  		return err
   698  	}, opts...)
   699  	if err != nil {
   700  		return nil, err
   701  	}
   702  	return &BatchDeletePipelineJobsOperation{
   703  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   704  	}, nil
   705  }
   706  
   707  func (c *pipelineGRPCClient) CancelPipelineJob(ctx context.Context, req *aiplatformpb.CancelPipelineJobRequest, opts ...gax.CallOption) error {
   708  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   709  
   710  	hds = append(c.xGoogHeaders, hds...)
   711  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   712  	opts = append((*c.CallOptions).CancelPipelineJob[0:len((*c.CallOptions).CancelPipelineJob):len((*c.CallOptions).CancelPipelineJob)], opts...)
   713  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   714  		var err error
   715  		_, err = executeRPC(ctx, c.pipelineClient.CancelPipelineJob, req, settings.GRPC, c.logger, "CancelPipelineJob")
   716  		return err
   717  	}, opts...)
   718  	return err
   719  }
   720  
   721  func (c *pipelineGRPCClient) BatchCancelPipelineJobs(ctx context.Context, req *aiplatformpb.BatchCancelPipelineJobsRequest, opts ...gax.CallOption) (*BatchCancelPipelineJobsOperation, error) {
   722  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   723  
   724  	hds = append(c.xGoogHeaders, hds...)
   725  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   726  	opts = append((*c.CallOptions).BatchCancelPipelineJobs[0:len((*c.CallOptions).BatchCancelPipelineJobs):len((*c.CallOptions).BatchCancelPipelineJobs)], opts...)
   727  	var resp *longrunningpb.Operation
   728  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   729  		var err error
   730  		resp, err = executeRPC(ctx, c.pipelineClient.BatchCancelPipelineJobs, req, settings.GRPC, c.logger, "BatchCancelPipelineJobs")
   731  		return err
   732  	}, opts...)
   733  	if err != nil {
   734  		return nil, err
   735  	}
   736  	return &BatchCancelPipelineJobsOperation{
   737  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   738  	}, nil
   739  }
   740  
   741  func (c *pipelineGRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
   742  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   743  
   744  	hds = append(c.xGoogHeaders, hds...)
   745  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   746  	opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...)
   747  	var resp *locationpb.Location
   748  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   749  		var err error
   750  		resp, err = executeRPC(ctx, c.locationsClient.GetLocation, req, settings.GRPC, c.logger, "GetLocation")
   751  		return err
   752  	}, opts...)
   753  	if err != nil {
   754  		return nil, err
   755  	}
   756  	return resp, nil
   757  }
   758  
   759  func (c *pipelineGRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
   760  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   761  
   762  	hds = append(c.xGoogHeaders, hds...)
   763  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   764  	opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...)
   765  	it := &LocationIterator{}
   766  	req = proto.Clone(req).(*locationpb.ListLocationsRequest)
   767  	it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) {
   768  		resp := &locationpb.ListLocationsResponse{}
   769  		if pageToken != "" {
   770  			req.PageToken = pageToken
   771  		}
   772  		if pageSize > math.MaxInt32 {
   773  			req.PageSize = math.MaxInt32
   774  		} else if pageSize != 0 {
   775  			req.PageSize = int32(pageSize)
   776  		}
   777  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   778  			var err error
   779  			resp, err = executeRPC(ctx, c.locationsClient.ListLocations, req, settings.GRPC, c.logger, "ListLocations")
   780  			return err
   781  		}, opts...)
   782  		if err != nil {
   783  			return nil, "", err
   784  		}
   785  
   786  		it.Response = resp
   787  		return resp.GetLocations(), resp.GetNextPageToken(), nil
   788  	}
   789  	fetch := func(pageSize int, pageToken string) (string, error) {
   790  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   791  		if err != nil {
   792  			return "", err
   793  		}
   794  		it.items = append(it.items, items...)
   795  		return nextPageToken, nil
   796  	}
   797  
   798  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   799  	it.pageInfo.MaxSize = int(req.GetPageSize())
   800  	it.pageInfo.Token = req.GetPageToken()
   801  
   802  	return it
   803  }
   804  
   805  func (c *pipelineGRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   806  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
   807  
   808  	hds = append(c.xGoogHeaders, hds...)
   809  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   810  	opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...)
   811  	var resp *iampb.Policy
   812  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   813  		var err error
   814  		resp, err = executeRPC(ctx, c.iamPolicyClient.GetIamPolicy, req, settings.GRPC, c.logger, "GetIamPolicy")
   815  		return err
   816  	}, opts...)
   817  	if err != nil {
   818  		return nil, err
   819  	}
   820  	return resp, nil
   821  }
   822  
   823  func (c *pipelineGRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   824  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
   825  
   826  	hds = append(c.xGoogHeaders, hds...)
   827  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   828  	opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...)
   829  	var resp *iampb.Policy
   830  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   831  		var err error
   832  		resp, err = executeRPC(ctx, c.iamPolicyClient.SetIamPolicy, req, settings.GRPC, c.logger, "SetIamPolicy")
   833  		return err
   834  	}, opts...)
   835  	if err != nil {
   836  		return nil, err
   837  	}
   838  	return resp, nil
   839  }
   840  
   841  func (c *pipelineGRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
   842  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
   843  
   844  	hds = append(c.xGoogHeaders, hds...)
   845  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   846  	opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...)
   847  	var resp *iampb.TestIamPermissionsResponse
   848  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   849  		var err error
   850  		resp, err = executeRPC(ctx, c.iamPolicyClient.TestIamPermissions, req, settings.GRPC, c.logger, "TestIamPermissions")
   851  		return err
   852  	}, opts...)
   853  	if err != nil {
   854  		return nil, err
   855  	}
   856  	return resp, nil
   857  }
   858  
   859  func (c *pipelineGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
   860  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   861  
   862  	hds = append(c.xGoogHeaders, hds...)
   863  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   864  	opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...)
   865  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   866  		var err error
   867  		_, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation")
   868  		return err
   869  	}, opts...)
   870  	return err
   871  }
   872  
   873  func (c *pipelineGRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
   874  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   875  
   876  	hds = append(c.xGoogHeaders, hds...)
   877  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   878  	opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...)
   879  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   880  		var err error
   881  		_, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation")
   882  		return err
   883  	}, opts...)
   884  	return err
   885  }
   886  
   887  func (c *pipelineGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   888  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   889  
   890  	hds = append(c.xGoogHeaders, hds...)
   891  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   892  	opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
   893  	var resp *longrunningpb.Operation
   894  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   895  		var err error
   896  		resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation")
   897  		return err
   898  	}, opts...)
   899  	if err != nil {
   900  		return nil, err
   901  	}
   902  	return resp, nil
   903  }
   904  
   905  func (c *pipelineGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
   906  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   907  
   908  	hds = append(c.xGoogHeaders, hds...)
   909  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   910  	opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...)
   911  	it := &OperationIterator{}
   912  	req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
   913  	it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
   914  		resp := &longrunningpb.ListOperationsResponse{}
   915  		if pageToken != "" {
   916  			req.PageToken = pageToken
   917  		}
   918  		if pageSize > math.MaxInt32 {
   919  			req.PageSize = math.MaxInt32
   920  		} else if pageSize != 0 {
   921  			req.PageSize = int32(pageSize)
   922  		}
   923  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   924  			var err error
   925  			resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations")
   926  			return err
   927  		}, opts...)
   928  		if err != nil {
   929  			return nil, "", err
   930  		}
   931  
   932  		it.Response = resp
   933  		return resp.GetOperations(), resp.GetNextPageToken(), nil
   934  	}
   935  	fetch := func(pageSize int, pageToken string) (string, error) {
   936  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   937  		if err != nil {
   938  			return "", err
   939  		}
   940  		it.items = append(it.items, items...)
   941  		return nextPageToken, nil
   942  	}
   943  
   944  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   945  	it.pageInfo.MaxSize = int(req.GetPageSize())
   946  	it.pageInfo.Token = req.GetPageToken()
   947  
   948  	return it
   949  }
   950  
   951  func (c *pipelineGRPCClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   952  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   953  
   954  	hds = append(c.xGoogHeaders, hds...)
   955  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   956  	opts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...)
   957  	var resp *longrunningpb.Operation
   958  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   959  		var err error
   960  		resp, err = executeRPC(ctx, c.operationsClient.WaitOperation, req, settings.GRPC, c.logger, "WaitOperation")
   961  		return err
   962  	}, opts...)
   963  	if err != nil {
   964  		return nil, err
   965  	}
   966  	return resp, nil
   967  }
   968  
   969  // BatchCancelPipelineJobsOperation returns a new BatchCancelPipelineJobsOperation from a given name.
   970  // The name must be that of a previously created BatchCancelPipelineJobsOperation, possibly from a different process.
   971  func (c *pipelineGRPCClient) BatchCancelPipelineJobsOperation(name string) *BatchCancelPipelineJobsOperation {
   972  	return &BatchCancelPipelineJobsOperation{
   973  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
   974  	}
   975  }
   976  
   977  // BatchDeletePipelineJobsOperation returns a new BatchDeletePipelineJobsOperation from a given name.
   978  // The name must be that of a previously created BatchDeletePipelineJobsOperation, possibly from a different process.
   979  func (c *pipelineGRPCClient) BatchDeletePipelineJobsOperation(name string) *BatchDeletePipelineJobsOperation {
   980  	return &BatchDeletePipelineJobsOperation{
   981  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
   982  	}
   983  }
   984  
   985  // DeletePipelineJobOperation returns a new DeletePipelineJobOperation from a given name.
   986  // The name must be that of a previously created DeletePipelineJobOperation, possibly from a different process.
   987  func (c *pipelineGRPCClient) DeletePipelineJobOperation(name string) *DeletePipelineJobOperation {
   988  	return &DeletePipelineJobOperation{
   989  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
   990  	}
   991  }
   992  
   993  // DeleteTrainingPipelineOperation returns a new DeleteTrainingPipelineOperation from a given name.
   994  // The name must be that of a previously created DeleteTrainingPipelineOperation, possibly from a different process.
   995  func (c *pipelineGRPCClient) DeleteTrainingPipelineOperation(name string) *DeleteTrainingPipelineOperation {
   996  	return &DeleteTrainingPipelineOperation{
   997  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
   998  	}
   999  }