cloud.google.com/go/aiplatform@v1.106.0/apiv1/endpoint_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 newEndpointClientHook clientHook
    42  
    43  // EndpointCallOptions contains the retry settings for each method of EndpointClient.
    44  type EndpointCallOptions struct {
    45  	CreateEndpoint            []gax.CallOption
    46  	GetEndpoint               []gax.CallOption
    47  	ListEndpoints             []gax.CallOption
    48  	UpdateEndpoint            []gax.CallOption
    49  	UpdateEndpointLongRunning []gax.CallOption
    50  	DeleteEndpoint            []gax.CallOption
    51  	DeployModel               []gax.CallOption
    52  	UndeployModel             []gax.CallOption
    53  	MutateDeployedModel       []gax.CallOption
    54  	GetLocation               []gax.CallOption
    55  	ListLocations             []gax.CallOption
    56  	GetIamPolicy              []gax.CallOption
    57  	SetIamPolicy              []gax.CallOption
    58  	TestIamPermissions        []gax.CallOption
    59  	CancelOperation           []gax.CallOption
    60  	DeleteOperation           []gax.CallOption
    61  	GetOperation              []gax.CallOption
    62  	ListOperations            []gax.CallOption
    63  	WaitOperation             []gax.CallOption
    64  }
    65  
    66  func defaultEndpointGRPCClientOptions() []option.ClientOption {
    67  	return []option.ClientOption{
    68  		internaloption.WithDefaultEndpoint("aiplatform.googleapis.com:443"),
    69  		internaloption.WithDefaultEndpointTemplate("aiplatform.UNIVERSE_DOMAIN:443"),
    70  		internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"),
    71  		internaloption.WithDefaultUniverseDomain("googleapis.com"),
    72  		internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"),
    73  		internaloption.WithDefaultScopes(DefaultAuthScopes()...),
    74  		internaloption.EnableJwtWithScope(),
    75  		internaloption.EnableNewAuthLibrary(),
    76  		option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
    77  			grpc.MaxCallRecvMsgSize(math.MaxInt32))),
    78  	}
    79  }
    80  
    81  func defaultEndpointCallOptions() *EndpointCallOptions {
    82  	return &EndpointCallOptions{
    83  		CreateEndpoint:            []gax.CallOption{},
    84  		GetEndpoint:               []gax.CallOption{},
    85  		ListEndpoints:             []gax.CallOption{},
    86  		UpdateEndpoint:            []gax.CallOption{},
    87  		UpdateEndpointLongRunning: []gax.CallOption{},
    88  		DeleteEndpoint:            []gax.CallOption{},
    89  		DeployModel:               []gax.CallOption{},
    90  		UndeployModel:             []gax.CallOption{},
    91  		MutateDeployedModel:       []gax.CallOption{},
    92  		GetLocation:               []gax.CallOption{},
    93  		ListLocations:             []gax.CallOption{},
    94  		GetIamPolicy:              []gax.CallOption{},
    95  		SetIamPolicy:              []gax.CallOption{},
    96  		TestIamPermissions:        []gax.CallOption{},
    97  		CancelOperation:           []gax.CallOption{},
    98  		DeleteOperation:           []gax.CallOption{},
    99  		GetOperation:              []gax.CallOption{},
   100  		ListOperations:            []gax.CallOption{},
   101  		WaitOperation:             []gax.CallOption{},
   102  	}
   103  }
   104  
   105  // internalEndpointClient is an interface that defines the methods available from Vertex AI API.
   106  type internalEndpointClient interface {
   107  	Close() error
   108  	setGoogleClientInfo(...string)
   109  	Connection() *grpc.ClientConn
   110  	CreateEndpoint(context.Context, *aiplatformpb.CreateEndpointRequest, ...gax.CallOption) (*CreateEndpointOperation, error)
   111  	CreateEndpointOperation(name string) *CreateEndpointOperation
   112  	GetEndpoint(context.Context, *aiplatformpb.GetEndpointRequest, ...gax.CallOption) (*aiplatformpb.Endpoint, error)
   113  	ListEndpoints(context.Context, *aiplatformpb.ListEndpointsRequest, ...gax.CallOption) *EndpointIterator
   114  	UpdateEndpoint(context.Context, *aiplatformpb.UpdateEndpointRequest, ...gax.CallOption) (*aiplatformpb.Endpoint, error)
   115  	UpdateEndpointLongRunning(context.Context, *aiplatformpb.UpdateEndpointLongRunningRequest, ...gax.CallOption) (*UpdateEndpointLongRunningOperation, error)
   116  	UpdateEndpointLongRunningOperation(name string) *UpdateEndpointLongRunningOperation
   117  	DeleteEndpoint(context.Context, *aiplatformpb.DeleteEndpointRequest, ...gax.CallOption) (*DeleteEndpointOperation, error)
   118  	DeleteEndpointOperation(name string) *DeleteEndpointOperation
   119  	DeployModel(context.Context, *aiplatformpb.DeployModelRequest, ...gax.CallOption) (*DeployModelOperation, error)
   120  	DeployModelOperation(name string) *DeployModelOperation
   121  	UndeployModel(context.Context, *aiplatformpb.UndeployModelRequest, ...gax.CallOption) (*UndeployModelOperation, error)
   122  	UndeployModelOperation(name string) *UndeployModelOperation
   123  	MutateDeployedModel(context.Context, *aiplatformpb.MutateDeployedModelRequest, ...gax.CallOption) (*MutateDeployedModelOperation, error)
   124  	MutateDeployedModelOperation(name string) *MutateDeployedModelOperation
   125  	GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error)
   126  	ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator
   127  	GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error)
   128  	SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error)
   129  	TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
   130  	CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error
   131  	DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error
   132  	GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
   133  	ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator
   134  	WaitOperation(context.Context, *longrunningpb.WaitOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
   135  }
   136  
   137  // EndpointClient is a client for interacting with Vertex AI API.
   138  // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
   139  //
   140  // A service for managing Vertex AI’s Endpoints.
   141  type EndpointClient struct {
   142  	// The internal transport-dependent client.
   143  	internalClient internalEndpointClient
   144  
   145  	// The call options for this service.
   146  	CallOptions *EndpointCallOptions
   147  
   148  	// LROClient is used internally to handle long-running operations.
   149  	// It is exposed so that its CallOptions can be modified if required.
   150  	// Users should not Close this client.
   151  	LROClient *lroauto.OperationsClient
   152  }
   153  
   154  // Wrapper methods routed to the internal client.
   155  
   156  // Close closes the connection to the API service. The user should invoke this when
   157  // the client is no longer required.
   158  func (c *EndpointClient) Close() error {
   159  	return c.internalClient.Close()
   160  }
   161  
   162  // setGoogleClientInfo sets the name and version of the application in
   163  // the `x-goog-api-client` header passed on each request. Intended for
   164  // use by Google-written clients.
   165  func (c *EndpointClient) setGoogleClientInfo(keyval ...string) {
   166  	c.internalClient.setGoogleClientInfo(keyval...)
   167  }
   168  
   169  // Connection returns a connection to the API service.
   170  //
   171  // Deprecated: Connections are now pooled so this method does not always
   172  // return the same resource.
   173  func (c *EndpointClient) Connection() *grpc.ClientConn {
   174  	return c.internalClient.Connection()
   175  }
   176  
   177  // CreateEndpoint creates an Endpoint.
   178  func (c *EndpointClient) CreateEndpoint(ctx context.Context, req *aiplatformpb.CreateEndpointRequest, opts ...gax.CallOption) (*CreateEndpointOperation, error) {
   179  	return c.internalClient.CreateEndpoint(ctx, req, opts...)
   180  }
   181  
   182  // CreateEndpointOperation returns a new CreateEndpointOperation from a given name.
   183  // The name must be that of a previously created CreateEndpointOperation, possibly from a different process.
   184  func (c *EndpointClient) CreateEndpointOperation(name string) *CreateEndpointOperation {
   185  	return c.internalClient.CreateEndpointOperation(name)
   186  }
   187  
   188  // GetEndpoint gets an Endpoint.
   189  func (c *EndpointClient) GetEndpoint(ctx context.Context, req *aiplatformpb.GetEndpointRequest, opts ...gax.CallOption) (*aiplatformpb.Endpoint, error) {
   190  	return c.internalClient.GetEndpoint(ctx, req, opts...)
   191  }
   192  
   193  // ListEndpoints lists Endpoints in a Location.
   194  func (c *EndpointClient) ListEndpoints(ctx context.Context, req *aiplatformpb.ListEndpointsRequest, opts ...gax.CallOption) *EndpointIterator {
   195  	return c.internalClient.ListEndpoints(ctx, req, opts...)
   196  }
   197  
   198  // UpdateEndpoint updates an Endpoint.
   199  func (c *EndpointClient) UpdateEndpoint(ctx context.Context, req *aiplatformpb.UpdateEndpointRequest, opts ...gax.CallOption) (*aiplatformpb.Endpoint, error) {
   200  	return c.internalClient.UpdateEndpoint(ctx, req, opts...)
   201  }
   202  
   203  // UpdateEndpointLongRunning updates an Endpoint with a long running operation.
   204  func (c *EndpointClient) UpdateEndpointLongRunning(ctx context.Context, req *aiplatformpb.UpdateEndpointLongRunningRequest, opts ...gax.CallOption) (*UpdateEndpointLongRunningOperation, error) {
   205  	return c.internalClient.UpdateEndpointLongRunning(ctx, req, opts...)
   206  }
   207  
   208  // UpdateEndpointLongRunningOperation returns a new UpdateEndpointLongRunningOperation from a given name.
   209  // The name must be that of a previously created UpdateEndpointLongRunningOperation, possibly from a different process.
   210  func (c *EndpointClient) UpdateEndpointLongRunningOperation(name string) *UpdateEndpointLongRunningOperation {
   211  	return c.internalClient.UpdateEndpointLongRunningOperation(name)
   212  }
   213  
   214  // DeleteEndpoint deletes an Endpoint.
   215  func (c *EndpointClient) DeleteEndpoint(ctx context.Context, req *aiplatformpb.DeleteEndpointRequest, opts ...gax.CallOption) (*DeleteEndpointOperation, error) {
   216  	return c.internalClient.DeleteEndpoint(ctx, req, opts...)
   217  }
   218  
   219  // DeleteEndpointOperation returns a new DeleteEndpointOperation from a given name.
   220  // The name must be that of a previously created DeleteEndpointOperation, possibly from a different process.
   221  func (c *EndpointClient) DeleteEndpointOperation(name string) *DeleteEndpointOperation {
   222  	return c.internalClient.DeleteEndpointOperation(name)
   223  }
   224  
   225  // DeployModel deploys a Model into this Endpoint, creating a DeployedModel within it.
   226  func (c *EndpointClient) DeployModel(ctx context.Context, req *aiplatformpb.DeployModelRequest, opts ...gax.CallOption) (*DeployModelOperation, error) {
   227  	return c.internalClient.DeployModel(ctx, req, opts...)
   228  }
   229  
   230  // DeployModelOperation returns a new DeployModelOperation from a given name.
   231  // The name must be that of a previously created DeployModelOperation, possibly from a different process.
   232  func (c *EndpointClient) DeployModelOperation(name string) *DeployModelOperation {
   233  	return c.internalClient.DeployModelOperation(name)
   234  }
   235  
   236  // UndeployModel undeploys a Model from an Endpoint, removing a DeployedModel from it, and
   237  // freeing all resources it’s using.
   238  func (c *EndpointClient) UndeployModel(ctx context.Context, req *aiplatformpb.UndeployModelRequest, opts ...gax.CallOption) (*UndeployModelOperation, error) {
   239  	return c.internalClient.UndeployModel(ctx, req, opts...)
   240  }
   241  
   242  // UndeployModelOperation returns a new UndeployModelOperation from a given name.
   243  // The name must be that of a previously created UndeployModelOperation, possibly from a different process.
   244  func (c *EndpointClient) UndeployModelOperation(name string) *UndeployModelOperation {
   245  	return c.internalClient.UndeployModelOperation(name)
   246  }
   247  
   248  // MutateDeployedModel updates an existing deployed model. Updatable fields include
   249  // min_replica_count, max_replica_count, required_replica_count,
   250  // autoscaling_metric_specs, disable_container_logging (v1 only), and
   251  // enable_container_logging (v1beta1 only).
   252  func (c *EndpointClient) MutateDeployedModel(ctx context.Context, req *aiplatformpb.MutateDeployedModelRequest, opts ...gax.CallOption) (*MutateDeployedModelOperation, error) {
   253  	return c.internalClient.MutateDeployedModel(ctx, req, opts...)
   254  }
   255  
   256  // MutateDeployedModelOperation returns a new MutateDeployedModelOperation from a given name.
   257  // The name must be that of a previously created MutateDeployedModelOperation, possibly from a different process.
   258  func (c *EndpointClient) MutateDeployedModelOperation(name string) *MutateDeployedModelOperation {
   259  	return c.internalClient.MutateDeployedModelOperation(name)
   260  }
   261  
   262  // GetLocation gets information about a location.
   263  func (c *EndpointClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
   264  	return c.internalClient.GetLocation(ctx, req, opts...)
   265  }
   266  
   267  // ListLocations lists information about the supported locations for this service.
   268  func (c *EndpointClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
   269  	return c.internalClient.ListLocations(ctx, req, opts...)
   270  }
   271  
   272  // GetIamPolicy gets the access control policy for a resource. Returns an empty policy
   273  // if the resource exists and does not have a policy set.
   274  func (c *EndpointClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   275  	return c.internalClient.GetIamPolicy(ctx, req, opts...)
   276  }
   277  
   278  // SetIamPolicy sets the access control policy on the specified resource. Replaces
   279  // any existing policy.
   280  //
   281  // Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED
   282  // errors.
   283  func (c *EndpointClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   284  	return c.internalClient.SetIamPolicy(ctx, req, opts...)
   285  }
   286  
   287  // TestIamPermissions returns permissions that a caller has on the specified resource. If the
   288  // resource does not exist, this will return an empty set of
   289  // permissions, not a NOT_FOUND error.
   290  //
   291  // Note: This operation is designed to be used for building
   292  // permission-aware UIs and command-line tools, not for authorization
   293  // checking. This operation may “fail open” without warning.
   294  func (c *EndpointClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
   295  	return c.internalClient.TestIamPermissions(ctx, req, opts...)
   296  }
   297  
   298  // CancelOperation is a utility method from google.longrunning.Operations.
   299  func (c *EndpointClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
   300  	return c.internalClient.CancelOperation(ctx, req, opts...)
   301  }
   302  
   303  // DeleteOperation is a utility method from google.longrunning.Operations.
   304  func (c *EndpointClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
   305  	return c.internalClient.DeleteOperation(ctx, req, opts...)
   306  }
   307  
   308  // GetOperation is a utility method from google.longrunning.Operations.
   309  func (c *EndpointClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   310  	return c.internalClient.GetOperation(ctx, req, opts...)
   311  }
   312  
   313  // ListOperations is a utility method from google.longrunning.Operations.
   314  func (c *EndpointClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
   315  	return c.internalClient.ListOperations(ctx, req, opts...)
   316  }
   317  
   318  // WaitOperation is a utility method from google.longrunning.Operations.
   319  func (c *EndpointClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   320  	return c.internalClient.WaitOperation(ctx, req, opts...)
   321  }
   322  
   323  // endpointGRPCClient is a client for interacting with Vertex AI API over gRPC transport.
   324  //
   325  // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
   326  type endpointGRPCClient struct {
   327  	// Connection pool of gRPC connections to the service.
   328  	connPool gtransport.ConnPool
   329  
   330  	// Points back to the CallOptions field of the containing EndpointClient
   331  	CallOptions **EndpointCallOptions
   332  
   333  	// The gRPC API client.
   334  	endpointClient aiplatformpb.EndpointServiceClient
   335  
   336  	// LROClient is used internally to handle long-running operations.
   337  	// It is exposed so that its CallOptions can be modified if required.
   338  	// Users should not Close this client.
   339  	LROClient **lroauto.OperationsClient
   340  
   341  	operationsClient longrunningpb.OperationsClient
   342  
   343  	iamPolicyClient iampb.IAMPolicyClient
   344  
   345  	locationsClient locationpb.LocationsClient
   346  
   347  	// The x-goog-* metadata to be sent with each request.
   348  	xGoogHeaders []string
   349  
   350  	logger *slog.Logger
   351  }
   352  
   353  // NewEndpointClient creates a new endpoint service client based on gRPC.
   354  // The returned client must be Closed when it is done being used to clean up its underlying connections.
   355  //
   356  // A service for managing Vertex AI’s Endpoints.
   357  func NewEndpointClient(ctx context.Context, opts ...option.ClientOption) (*EndpointClient, error) {
   358  	clientOpts := defaultEndpointGRPCClientOptions()
   359  	if newEndpointClientHook != nil {
   360  		hookOpts, err := newEndpointClientHook(ctx, clientHookParams{})
   361  		if err != nil {
   362  			return nil, err
   363  		}
   364  		clientOpts = append(clientOpts, hookOpts...)
   365  	}
   366  
   367  	connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
   368  	if err != nil {
   369  		return nil, err
   370  	}
   371  	client := EndpointClient{CallOptions: defaultEndpointCallOptions()}
   372  
   373  	c := &endpointGRPCClient{
   374  		connPool:         connPool,
   375  		endpointClient:   aiplatformpb.NewEndpointServiceClient(connPool),
   376  		CallOptions:      &client.CallOptions,
   377  		logger:           internaloption.GetLogger(opts),
   378  		operationsClient: longrunningpb.NewOperationsClient(connPool),
   379  		iamPolicyClient:  iampb.NewIAMPolicyClient(connPool),
   380  		locationsClient:  locationpb.NewLocationsClient(connPool),
   381  	}
   382  	c.setGoogleClientInfo()
   383  
   384  	client.internalClient = c
   385  
   386  	client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
   387  	if err != nil {
   388  		// This error "should not happen", since we are just reusing old connection pool
   389  		// and never actually need to dial.
   390  		// If this does happen, we could leak connp. However, we cannot close conn:
   391  		// If the user invoked the constructor with option.WithGRPCConn,
   392  		// we would close a connection that's still in use.
   393  		// TODO: investigate error conditions.
   394  		return nil, err
   395  	}
   396  	c.LROClient = &client.LROClient
   397  	return &client, nil
   398  }
   399  
   400  // Connection returns a connection to the API service.
   401  //
   402  // Deprecated: Connections are now pooled so this method does not always
   403  // return the same resource.
   404  func (c *endpointGRPCClient) Connection() *grpc.ClientConn {
   405  	return c.connPool.Conn()
   406  }
   407  
   408  // setGoogleClientInfo sets the name and version of the application in
   409  // the `x-goog-api-client` header passed on each request. Intended for
   410  // use by Google-written clients.
   411  func (c *endpointGRPCClient) setGoogleClientInfo(keyval ...string) {
   412  	kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
   413  	kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion)
   414  	c.xGoogHeaders = []string{
   415  		"x-goog-api-client", gax.XGoogHeader(kv...),
   416  	}
   417  }
   418  
   419  // Close closes the connection to the API service. The user should invoke this when
   420  // the client is no longer required.
   421  func (c *endpointGRPCClient) Close() error {
   422  	return c.connPool.Close()
   423  }
   424  
   425  func (c *endpointGRPCClient) CreateEndpoint(ctx context.Context, req *aiplatformpb.CreateEndpointRequest, opts ...gax.CallOption) (*CreateEndpointOperation, error) {
   426  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   427  
   428  	hds = append(c.xGoogHeaders, hds...)
   429  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   430  	opts = append((*c.CallOptions).CreateEndpoint[0:len((*c.CallOptions).CreateEndpoint):len((*c.CallOptions).CreateEndpoint)], opts...)
   431  	var resp *longrunningpb.Operation
   432  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   433  		var err error
   434  		resp, err = executeRPC(ctx, c.endpointClient.CreateEndpoint, req, settings.GRPC, c.logger, "CreateEndpoint")
   435  		return err
   436  	}, opts...)
   437  	if err != nil {
   438  		return nil, err
   439  	}
   440  	return &CreateEndpointOperation{
   441  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   442  	}, nil
   443  }
   444  
   445  func (c *endpointGRPCClient) GetEndpoint(ctx context.Context, req *aiplatformpb.GetEndpointRequest, opts ...gax.CallOption) (*aiplatformpb.Endpoint, error) {
   446  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   447  
   448  	hds = append(c.xGoogHeaders, hds...)
   449  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   450  	opts = append((*c.CallOptions).GetEndpoint[0:len((*c.CallOptions).GetEndpoint):len((*c.CallOptions).GetEndpoint)], opts...)
   451  	var resp *aiplatformpb.Endpoint
   452  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   453  		var err error
   454  		resp, err = executeRPC(ctx, c.endpointClient.GetEndpoint, req, settings.GRPC, c.logger, "GetEndpoint")
   455  		return err
   456  	}, opts...)
   457  	if err != nil {
   458  		return nil, err
   459  	}
   460  	return resp, nil
   461  }
   462  
   463  func (c *endpointGRPCClient) ListEndpoints(ctx context.Context, req *aiplatformpb.ListEndpointsRequest, opts ...gax.CallOption) *EndpointIterator {
   464  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   465  
   466  	hds = append(c.xGoogHeaders, hds...)
   467  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   468  	opts = append((*c.CallOptions).ListEndpoints[0:len((*c.CallOptions).ListEndpoints):len((*c.CallOptions).ListEndpoints)], opts...)
   469  	it := &EndpointIterator{}
   470  	req = proto.Clone(req).(*aiplatformpb.ListEndpointsRequest)
   471  	it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.Endpoint, string, error) {
   472  		resp := &aiplatformpb.ListEndpointsResponse{}
   473  		if pageToken != "" {
   474  			req.PageToken = pageToken
   475  		}
   476  		if pageSize > math.MaxInt32 {
   477  			req.PageSize = math.MaxInt32
   478  		} else if pageSize != 0 {
   479  			req.PageSize = int32(pageSize)
   480  		}
   481  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   482  			var err error
   483  			resp, err = executeRPC(ctx, c.endpointClient.ListEndpoints, req, settings.GRPC, c.logger, "ListEndpoints")
   484  			return err
   485  		}, opts...)
   486  		if err != nil {
   487  			return nil, "", err
   488  		}
   489  
   490  		it.Response = resp
   491  		return resp.GetEndpoints(), resp.GetNextPageToken(), nil
   492  	}
   493  	fetch := func(pageSize int, pageToken string) (string, error) {
   494  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   495  		if err != nil {
   496  			return "", err
   497  		}
   498  		it.items = append(it.items, items...)
   499  		return nextPageToken, nil
   500  	}
   501  
   502  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   503  	it.pageInfo.MaxSize = int(req.GetPageSize())
   504  	it.pageInfo.Token = req.GetPageToken()
   505  
   506  	return it
   507  }
   508  
   509  func (c *endpointGRPCClient) UpdateEndpoint(ctx context.Context, req *aiplatformpb.UpdateEndpointRequest, opts ...gax.CallOption) (*aiplatformpb.Endpoint, error) {
   510  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "endpoint.name", url.QueryEscape(req.GetEndpoint().GetName()))}
   511  
   512  	hds = append(c.xGoogHeaders, hds...)
   513  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   514  	opts = append((*c.CallOptions).UpdateEndpoint[0:len((*c.CallOptions).UpdateEndpoint):len((*c.CallOptions).UpdateEndpoint)], opts...)
   515  	var resp *aiplatformpb.Endpoint
   516  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   517  		var err error
   518  		resp, err = executeRPC(ctx, c.endpointClient.UpdateEndpoint, req, settings.GRPC, c.logger, "UpdateEndpoint")
   519  		return err
   520  	}, opts...)
   521  	if err != nil {
   522  		return nil, err
   523  	}
   524  	return resp, nil
   525  }
   526  
   527  func (c *endpointGRPCClient) UpdateEndpointLongRunning(ctx context.Context, req *aiplatformpb.UpdateEndpointLongRunningRequest, opts ...gax.CallOption) (*UpdateEndpointLongRunningOperation, error) {
   528  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "endpoint.name", url.QueryEscape(req.GetEndpoint().GetName()))}
   529  
   530  	hds = append(c.xGoogHeaders, hds...)
   531  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   532  	opts = append((*c.CallOptions).UpdateEndpointLongRunning[0:len((*c.CallOptions).UpdateEndpointLongRunning):len((*c.CallOptions).UpdateEndpointLongRunning)], opts...)
   533  	var resp *longrunningpb.Operation
   534  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   535  		var err error
   536  		resp, err = executeRPC(ctx, c.endpointClient.UpdateEndpointLongRunning, req, settings.GRPC, c.logger, "UpdateEndpointLongRunning")
   537  		return err
   538  	}, opts...)
   539  	if err != nil {
   540  		return nil, err
   541  	}
   542  	return &UpdateEndpointLongRunningOperation{
   543  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   544  	}, nil
   545  }
   546  
   547  func (c *endpointGRPCClient) DeleteEndpoint(ctx context.Context, req *aiplatformpb.DeleteEndpointRequest, opts ...gax.CallOption) (*DeleteEndpointOperation, error) {
   548  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   549  
   550  	hds = append(c.xGoogHeaders, hds...)
   551  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   552  	opts = append((*c.CallOptions).DeleteEndpoint[0:len((*c.CallOptions).DeleteEndpoint):len((*c.CallOptions).DeleteEndpoint)], opts...)
   553  	var resp *longrunningpb.Operation
   554  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   555  		var err error
   556  		resp, err = executeRPC(ctx, c.endpointClient.DeleteEndpoint, req, settings.GRPC, c.logger, "DeleteEndpoint")
   557  		return err
   558  	}, opts...)
   559  	if err != nil {
   560  		return nil, err
   561  	}
   562  	return &DeleteEndpointOperation{
   563  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   564  	}, nil
   565  }
   566  
   567  func (c *endpointGRPCClient) DeployModel(ctx context.Context, req *aiplatformpb.DeployModelRequest, opts ...gax.CallOption) (*DeployModelOperation, error) {
   568  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "endpoint", url.QueryEscape(req.GetEndpoint()))}
   569  
   570  	hds = append(c.xGoogHeaders, hds...)
   571  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   572  	opts = append((*c.CallOptions).DeployModel[0:len((*c.CallOptions).DeployModel):len((*c.CallOptions).DeployModel)], opts...)
   573  	var resp *longrunningpb.Operation
   574  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   575  		var err error
   576  		resp, err = executeRPC(ctx, c.endpointClient.DeployModel, req, settings.GRPC, c.logger, "DeployModel")
   577  		return err
   578  	}, opts...)
   579  	if err != nil {
   580  		return nil, err
   581  	}
   582  	return &DeployModelOperation{
   583  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   584  	}, nil
   585  }
   586  
   587  func (c *endpointGRPCClient) UndeployModel(ctx context.Context, req *aiplatformpb.UndeployModelRequest, opts ...gax.CallOption) (*UndeployModelOperation, error) {
   588  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "endpoint", url.QueryEscape(req.GetEndpoint()))}
   589  
   590  	hds = append(c.xGoogHeaders, hds...)
   591  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   592  	opts = append((*c.CallOptions).UndeployModel[0:len((*c.CallOptions).UndeployModel):len((*c.CallOptions).UndeployModel)], opts...)
   593  	var resp *longrunningpb.Operation
   594  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   595  		var err error
   596  		resp, err = executeRPC(ctx, c.endpointClient.UndeployModel, req, settings.GRPC, c.logger, "UndeployModel")
   597  		return err
   598  	}, opts...)
   599  	if err != nil {
   600  		return nil, err
   601  	}
   602  	return &UndeployModelOperation{
   603  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   604  	}, nil
   605  }
   606  
   607  func (c *endpointGRPCClient) MutateDeployedModel(ctx context.Context, req *aiplatformpb.MutateDeployedModelRequest, opts ...gax.CallOption) (*MutateDeployedModelOperation, error) {
   608  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "endpoint", url.QueryEscape(req.GetEndpoint()))}
   609  
   610  	hds = append(c.xGoogHeaders, hds...)
   611  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   612  	opts = append((*c.CallOptions).MutateDeployedModel[0:len((*c.CallOptions).MutateDeployedModel):len((*c.CallOptions).MutateDeployedModel)], opts...)
   613  	var resp *longrunningpb.Operation
   614  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   615  		var err error
   616  		resp, err = executeRPC(ctx, c.endpointClient.MutateDeployedModel, req, settings.GRPC, c.logger, "MutateDeployedModel")
   617  		return err
   618  	}, opts...)
   619  	if err != nil {
   620  		return nil, err
   621  	}
   622  	return &MutateDeployedModelOperation{
   623  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   624  	}, nil
   625  }
   626  
   627  func (c *endpointGRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
   628  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   629  
   630  	hds = append(c.xGoogHeaders, hds...)
   631  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   632  	opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...)
   633  	var resp *locationpb.Location
   634  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   635  		var err error
   636  		resp, err = executeRPC(ctx, c.locationsClient.GetLocation, req, settings.GRPC, c.logger, "GetLocation")
   637  		return err
   638  	}, opts...)
   639  	if err != nil {
   640  		return nil, err
   641  	}
   642  	return resp, nil
   643  }
   644  
   645  func (c *endpointGRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
   646  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   647  
   648  	hds = append(c.xGoogHeaders, hds...)
   649  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   650  	opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...)
   651  	it := &LocationIterator{}
   652  	req = proto.Clone(req).(*locationpb.ListLocationsRequest)
   653  	it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) {
   654  		resp := &locationpb.ListLocationsResponse{}
   655  		if pageToken != "" {
   656  			req.PageToken = pageToken
   657  		}
   658  		if pageSize > math.MaxInt32 {
   659  			req.PageSize = math.MaxInt32
   660  		} else if pageSize != 0 {
   661  			req.PageSize = int32(pageSize)
   662  		}
   663  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   664  			var err error
   665  			resp, err = executeRPC(ctx, c.locationsClient.ListLocations, req, settings.GRPC, c.logger, "ListLocations")
   666  			return err
   667  		}, opts...)
   668  		if err != nil {
   669  			return nil, "", err
   670  		}
   671  
   672  		it.Response = resp
   673  		return resp.GetLocations(), resp.GetNextPageToken(), nil
   674  	}
   675  	fetch := func(pageSize int, pageToken string) (string, error) {
   676  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   677  		if err != nil {
   678  			return "", err
   679  		}
   680  		it.items = append(it.items, items...)
   681  		return nextPageToken, nil
   682  	}
   683  
   684  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   685  	it.pageInfo.MaxSize = int(req.GetPageSize())
   686  	it.pageInfo.Token = req.GetPageToken()
   687  
   688  	return it
   689  }
   690  
   691  func (c *endpointGRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   692  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
   693  
   694  	hds = append(c.xGoogHeaders, hds...)
   695  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   696  	opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...)
   697  	var resp *iampb.Policy
   698  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   699  		var err error
   700  		resp, err = executeRPC(ctx, c.iamPolicyClient.GetIamPolicy, req, settings.GRPC, c.logger, "GetIamPolicy")
   701  		return err
   702  	}, opts...)
   703  	if err != nil {
   704  		return nil, err
   705  	}
   706  	return resp, nil
   707  }
   708  
   709  func (c *endpointGRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   710  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
   711  
   712  	hds = append(c.xGoogHeaders, hds...)
   713  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   714  	opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...)
   715  	var resp *iampb.Policy
   716  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   717  		var err error
   718  		resp, err = executeRPC(ctx, c.iamPolicyClient.SetIamPolicy, req, settings.GRPC, c.logger, "SetIamPolicy")
   719  		return err
   720  	}, opts...)
   721  	if err != nil {
   722  		return nil, err
   723  	}
   724  	return resp, nil
   725  }
   726  
   727  func (c *endpointGRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
   728  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
   729  
   730  	hds = append(c.xGoogHeaders, hds...)
   731  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   732  	opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...)
   733  	var resp *iampb.TestIamPermissionsResponse
   734  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   735  		var err error
   736  		resp, err = executeRPC(ctx, c.iamPolicyClient.TestIamPermissions, req, settings.GRPC, c.logger, "TestIamPermissions")
   737  		return err
   738  	}, opts...)
   739  	if err != nil {
   740  		return nil, err
   741  	}
   742  	return resp, nil
   743  }
   744  
   745  func (c *endpointGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
   746  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   747  
   748  	hds = append(c.xGoogHeaders, hds...)
   749  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   750  	opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...)
   751  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   752  		var err error
   753  		_, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation")
   754  		return err
   755  	}, opts...)
   756  	return err
   757  }
   758  
   759  func (c *endpointGRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
   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).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...)
   765  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   766  		var err error
   767  		_, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation")
   768  		return err
   769  	}, opts...)
   770  	return err
   771  }
   772  
   773  func (c *endpointGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   774  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   775  
   776  	hds = append(c.xGoogHeaders, hds...)
   777  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   778  	opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
   779  	var resp *longrunningpb.Operation
   780  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   781  		var err error
   782  		resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation")
   783  		return err
   784  	}, opts...)
   785  	if err != nil {
   786  		return nil, err
   787  	}
   788  	return resp, nil
   789  }
   790  
   791  func (c *endpointGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
   792  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   793  
   794  	hds = append(c.xGoogHeaders, hds...)
   795  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   796  	opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...)
   797  	it := &OperationIterator{}
   798  	req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
   799  	it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
   800  		resp := &longrunningpb.ListOperationsResponse{}
   801  		if pageToken != "" {
   802  			req.PageToken = pageToken
   803  		}
   804  		if pageSize > math.MaxInt32 {
   805  			req.PageSize = math.MaxInt32
   806  		} else if pageSize != 0 {
   807  			req.PageSize = int32(pageSize)
   808  		}
   809  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   810  			var err error
   811  			resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations")
   812  			return err
   813  		}, opts...)
   814  		if err != nil {
   815  			return nil, "", err
   816  		}
   817  
   818  		it.Response = resp
   819  		return resp.GetOperations(), resp.GetNextPageToken(), nil
   820  	}
   821  	fetch := func(pageSize int, pageToken string) (string, error) {
   822  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   823  		if err != nil {
   824  			return "", err
   825  		}
   826  		it.items = append(it.items, items...)
   827  		return nextPageToken, nil
   828  	}
   829  
   830  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   831  	it.pageInfo.MaxSize = int(req.GetPageSize())
   832  	it.pageInfo.Token = req.GetPageToken()
   833  
   834  	return it
   835  }
   836  
   837  func (c *endpointGRPCClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   838  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   839  
   840  	hds = append(c.xGoogHeaders, hds...)
   841  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   842  	opts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...)
   843  	var resp *longrunningpb.Operation
   844  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   845  		var err error
   846  		resp, err = executeRPC(ctx, c.operationsClient.WaitOperation, req, settings.GRPC, c.logger, "WaitOperation")
   847  		return err
   848  	}, opts...)
   849  	if err != nil {
   850  		return nil, err
   851  	}
   852  	return resp, nil
   853  }
   854  
   855  // CreateEndpointOperation returns a new CreateEndpointOperation from a given name.
   856  // The name must be that of a previously created CreateEndpointOperation, possibly from a different process.
   857  func (c *endpointGRPCClient) CreateEndpointOperation(name string) *CreateEndpointOperation {
   858  	return &CreateEndpointOperation{
   859  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
   860  	}
   861  }
   862  
   863  // DeleteEndpointOperation returns a new DeleteEndpointOperation from a given name.
   864  // The name must be that of a previously created DeleteEndpointOperation, possibly from a different process.
   865  func (c *endpointGRPCClient) DeleteEndpointOperation(name string) *DeleteEndpointOperation {
   866  	return &DeleteEndpointOperation{
   867  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
   868  	}
   869  }
   870  
   871  // DeployModelOperation returns a new DeployModelOperation from a given name.
   872  // The name must be that of a previously created DeployModelOperation, possibly from a different process.
   873  func (c *endpointGRPCClient) DeployModelOperation(name string) *DeployModelOperation {
   874  	return &DeployModelOperation{
   875  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
   876  	}
   877  }
   878  
   879  // MutateDeployedModelOperation returns a new MutateDeployedModelOperation from a given name.
   880  // The name must be that of a previously created MutateDeployedModelOperation, possibly from a different process.
   881  func (c *endpointGRPCClient) MutateDeployedModelOperation(name string) *MutateDeployedModelOperation {
   882  	return &MutateDeployedModelOperation{
   883  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
   884  	}
   885  }
   886  
   887  // UndeployModelOperation returns a new UndeployModelOperation from a given name.
   888  // The name must be that of a previously created UndeployModelOperation, possibly from a different process.
   889  func (c *endpointGRPCClient) UndeployModelOperation(name string) *UndeployModelOperation {
   890  	return &UndeployModelOperation{
   891  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
   892  	}
   893  }
   894  
   895  // UpdateEndpointLongRunningOperation returns a new UpdateEndpointLongRunningOperation from a given name.
   896  // The name must be that of a previously created UpdateEndpointLongRunningOperation, possibly from a different process.
   897  func (c *endpointGRPCClient) UpdateEndpointLongRunningOperation(name string) *UpdateEndpointLongRunningOperation {
   898  	return &UpdateEndpointLongRunningOperation{
   899  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
   900  	}
   901  }