cloud.google.com/go/aiplatform@v1.106.0/apiv1/data_foundry_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  	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
    29  	gax "github.com/googleapis/gax-go/v2"
    30  	"google.golang.org/api/iterator"
    31  	"google.golang.org/api/option"
    32  	"google.golang.org/api/option/internaloption"
    33  	gtransport "google.golang.org/api/transport/grpc"
    34  	locationpb "google.golang.org/genproto/googleapis/cloud/location"
    35  	"google.golang.org/grpc"
    36  	"google.golang.org/protobuf/proto"
    37  )
    38  
    39  var newDataFoundryClientHook clientHook
    40  
    41  // DataFoundryCallOptions contains the retry settings for each method of DataFoundryClient.
    42  type DataFoundryCallOptions struct {
    43  	GenerateSyntheticData []gax.CallOption
    44  	GetLocation           []gax.CallOption
    45  	ListLocations         []gax.CallOption
    46  	GetIamPolicy          []gax.CallOption
    47  	SetIamPolicy          []gax.CallOption
    48  	TestIamPermissions    []gax.CallOption
    49  	CancelOperation       []gax.CallOption
    50  	DeleteOperation       []gax.CallOption
    51  	GetOperation          []gax.CallOption
    52  	ListOperations        []gax.CallOption
    53  	WaitOperation         []gax.CallOption
    54  }
    55  
    56  func defaultDataFoundryGRPCClientOptions() []option.ClientOption {
    57  	return []option.ClientOption{
    58  		internaloption.WithDefaultEndpoint("aiplatform.googleapis.com:443"),
    59  		internaloption.WithDefaultEndpointTemplate("aiplatform.UNIVERSE_DOMAIN:443"),
    60  		internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"),
    61  		internaloption.WithDefaultUniverseDomain("googleapis.com"),
    62  		internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"),
    63  		internaloption.WithDefaultScopes(DefaultAuthScopes()...),
    64  		internaloption.EnableJwtWithScope(),
    65  		internaloption.EnableNewAuthLibrary(),
    66  		option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
    67  			grpc.MaxCallRecvMsgSize(math.MaxInt32))),
    68  	}
    69  }
    70  
    71  func defaultDataFoundryCallOptions() *DataFoundryCallOptions {
    72  	return &DataFoundryCallOptions{
    73  		GenerateSyntheticData: []gax.CallOption{},
    74  		GetLocation:           []gax.CallOption{},
    75  		ListLocations:         []gax.CallOption{},
    76  		GetIamPolicy:          []gax.CallOption{},
    77  		SetIamPolicy:          []gax.CallOption{},
    78  		TestIamPermissions:    []gax.CallOption{},
    79  		CancelOperation:       []gax.CallOption{},
    80  		DeleteOperation:       []gax.CallOption{},
    81  		GetOperation:          []gax.CallOption{},
    82  		ListOperations:        []gax.CallOption{},
    83  		WaitOperation:         []gax.CallOption{},
    84  	}
    85  }
    86  
    87  // internalDataFoundryClient is an interface that defines the methods available from Vertex AI API.
    88  type internalDataFoundryClient interface {
    89  	Close() error
    90  	setGoogleClientInfo(...string)
    91  	Connection() *grpc.ClientConn
    92  	GenerateSyntheticData(context.Context, *aiplatformpb.GenerateSyntheticDataRequest, ...gax.CallOption) (*aiplatformpb.GenerateSyntheticDataResponse, error)
    93  	GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error)
    94  	ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator
    95  	GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error)
    96  	SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error)
    97  	TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
    98  	CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error
    99  	DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error
   100  	GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
   101  	ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator
   102  	WaitOperation(context.Context, *longrunningpb.WaitOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
   103  }
   104  
   105  // DataFoundryClient is a client for interacting with Vertex AI API.
   106  // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
   107  //
   108  // Service for generating and preparing datasets for Gen AI evaluation.
   109  type DataFoundryClient struct {
   110  	// The internal transport-dependent client.
   111  	internalClient internalDataFoundryClient
   112  
   113  	// The call options for this service.
   114  	CallOptions *DataFoundryCallOptions
   115  }
   116  
   117  // Wrapper methods routed to the internal client.
   118  
   119  // Close closes the connection to the API service. The user should invoke this when
   120  // the client is no longer required.
   121  func (c *DataFoundryClient) Close() error {
   122  	return c.internalClient.Close()
   123  }
   124  
   125  // setGoogleClientInfo sets the name and version of the application in
   126  // the `x-goog-api-client` header passed on each request. Intended for
   127  // use by Google-written clients.
   128  func (c *DataFoundryClient) setGoogleClientInfo(keyval ...string) {
   129  	c.internalClient.setGoogleClientInfo(keyval...)
   130  }
   131  
   132  // Connection returns a connection to the API service.
   133  //
   134  // Deprecated: Connections are now pooled so this method does not always
   135  // return the same resource.
   136  func (c *DataFoundryClient) Connection() *grpc.ClientConn {
   137  	return c.internalClient.Connection()
   138  }
   139  
   140  // GenerateSyntheticData generates synthetic data based on the provided configuration.
   141  func (c *DataFoundryClient) GenerateSyntheticData(ctx context.Context, req *aiplatformpb.GenerateSyntheticDataRequest, opts ...gax.CallOption) (*aiplatformpb.GenerateSyntheticDataResponse, error) {
   142  	return c.internalClient.GenerateSyntheticData(ctx, req, opts...)
   143  }
   144  
   145  // GetLocation gets information about a location.
   146  func (c *DataFoundryClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
   147  	return c.internalClient.GetLocation(ctx, req, opts...)
   148  }
   149  
   150  // ListLocations lists information about the supported locations for this service.
   151  func (c *DataFoundryClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
   152  	return c.internalClient.ListLocations(ctx, req, opts...)
   153  }
   154  
   155  // GetIamPolicy gets the access control policy for a resource. Returns an empty policy
   156  // if the resource exists and does not have a policy set.
   157  func (c *DataFoundryClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   158  	return c.internalClient.GetIamPolicy(ctx, req, opts...)
   159  }
   160  
   161  // SetIamPolicy sets the access control policy on the specified resource. Replaces
   162  // any existing policy.
   163  //
   164  // Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED
   165  // errors.
   166  func (c *DataFoundryClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   167  	return c.internalClient.SetIamPolicy(ctx, req, opts...)
   168  }
   169  
   170  // TestIamPermissions returns permissions that a caller has on the specified resource. If the
   171  // resource does not exist, this will return an empty set of
   172  // permissions, not a NOT_FOUND error.
   173  //
   174  // Note: This operation is designed to be used for building
   175  // permission-aware UIs and command-line tools, not for authorization
   176  // checking. This operation may “fail open” without warning.
   177  func (c *DataFoundryClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
   178  	return c.internalClient.TestIamPermissions(ctx, req, opts...)
   179  }
   180  
   181  // CancelOperation is a utility method from google.longrunning.Operations.
   182  func (c *DataFoundryClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
   183  	return c.internalClient.CancelOperation(ctx, req, opts...)
   184  }
   185  
   186  // DeleteOperation is a utility method from google.longrunning.Operations.
   187  func (c *DataFoundryClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
   188  	return c.internalClient.DeleteOperation(ctx, req, opts...)
   189  }
   190  
   191  // GetOperation is a utility method from google.longrunning.Operations.
   192  func (c *DataFoundryClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   193  	return c.internalClient.GetOperation(ctx, req, opts...)
   194  }
   195  
   196  // ListOperations is a utility method from google.longrunning.Operations.
   197  func (c *DataFoundryClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
   198  	return c.internalClient.ListOperations(ctx, req, opts...)
   199  }
   200  
   201  // WaitOperation is a utility method from google.longrunning.Operations.
   202  func (c *DataFoundryClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   203  	return c.internalClient.WaitOperation(ctx, req, opts...)
   204  }
   205  
   206  // dataFoundryGRPCClient is a client for interacting with Vertex AI API over gRPC transport.
   207  //
   208  // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
   209  type dataFoundryGRPCClient struct {
   210  	// Connection pool of gRPC connections to the service.
   211  	connPool gtransport.ConnPool
   212  
   213  	// Points back to the CallOptions field of the containing DataFoundryClient
   214  	CallOptions **DataFoundryCallOptions
   215  
   216  	// The gRPC API client.
   217  	dataFoundryClient aiplatformpb.DataFoundryServiceClient
   218  
   219  	operationsClient longrunningpb.OperationsClient
   220  
   221  	iamPolicyClient iampb.IAMPolicyClient
   222  
   223  	locationsClient locationpb.LocationsClient
   224  
   225  	// The x-goog-* metadata to be sent with each request.
   226  	xGoogHeaders []string
   227  
   228  	logger *slog.Logger
   229  }
   230  
   231  // NewDataFoundryClient creates a new data foundry service client based on gRPC.
   232  // The returned client must be Closed when it is done being used to clean up its underlying connections.
   233  //
   234  // Service for generating and preparing datasets for Gen AI evaluation.
   235  func NewDataFoundryClient(ctx context.Context, opts ...option.ClientOption) (*DataFoundryClient, error) {
   236  	clientOpts := defaultDataFoundryGRPCClientOptions()
   237  	if newDataFoundryClientHook != nil {
   238  		hookOpts, err := newDataFoundryClientHook(ctx, clientHookParams{})
   239  		if err != nil {
   240  			return nil, err
   241  		}
   242  		clientOpts = append(clientOpts, hookOpts...)
   243  	}
   244  
   245  	connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
   246  	if err != nil {
   247  		return nil, err
   248  	}
   249  	client := DataFoundryClient{CallOptions: defaultDataFoundryCallOptions()}
   250  
   251  	c := &dataFoundryGRPCClient{
   252  		connPool:          connPool,
   253  		dataFoundryClient: aiplatformpb.NewDataFoundryServiceClient(connPool),
   254  		CallOptions:       &client.CallOptions,
   255  		logger:            internaloption.GetLogger(opts),
   256  		operationsClient:  longrunningpb.NewOperationsClient(connPool),
   257  		iamPolicyClient:   iampb.NewIAMPolicyClient(connPool),
   258  		locationsClient:   locationpb.NewLocationsClient(connPool),
   259  	}
   260  	c.setGoogleClientInfo()
   261  
   262  	client.internalClient = c
   263  
   264  	return &client, nil
   265  }
   266  
   267  // Connection returns a connection to the API service.
   268  //
   269  // Deprecated: Connections are now pooled so this method does not always
   270  // return the same resource.
   271  func (c *dataFoundryGRPCClient) Connection() *grpc.ClientConn {
   272  	return c.connPool.Conn()
   273  }
   274  
   275  // setGoogleClientInfo sets the name and version of the application in
   276  // the `x-goog-api-client` header passed on each request. Intended for
   277  // use by Google-written clients.
   278  func (c *dataFoundryGRPCClient) setGoogleClientInfo(keyval ...string) {
   279  	kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
   280  	kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion)
   281  	c.xGoogHeaders = []string{
   282  		"x-goog-api-client", gax.XGoogHeader(kv...),
   283  	}
   284  }
   285  
   286  // Close closes the connection to the API service. The user should invoke this when
   287  // the client is no longer required.
   288  func (c *dataFoundryGRPCClient) Close() error {
   289  	return c.connPool.Close()
   290  }
   291  
   292  func (c *dataFoundryGRPCClient) GenerateSyntheticData(ctx context.Context, req *aiplatformpb.GenerateSyntheticDataRequest, opts ...gax.CallOption) (*aiplatformpb.GenerateSyntheticDataResponse, error) {
   293  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "location", url.QueryEscape(req.GetLocation()))}
   294  
   295  	hds = append(c.xGoogHeaders, hds...)
   296  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   297  	opts = append((*c.CallOptions).GenerateSyntheticData[0:len((*c.CallOptions).GenerateSyntheticData):len((*c.CallOptions).GenerateSyntheticData)], opts...)
   298  	var resp *aiplatformpb.GenerateSyntheticDataResponse
   299  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   300  		var err error
   301  		resp, err = executeRPC(ctx, c.dataFoundryClient.GenerateSyntheticData, req, settings.GRPC, c.logger, "GenerateSyntheticData")
   302  		return err
   303  	}, opts...)
   304  	if err != nil {
   305  		return nil, err
   306  	}
   307  	return resp, nil
   308  }
   309  
   310  func (c *dataFoundryGRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
   311  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   312  
   313  	hds = append(c.xGoogHeaders, hds...)
   314  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   315  	opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...)
   316  	var resp *locationpb.Location
   317  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   318  		var err error
   319  		resp, err = executeRPC(ctx, c.locationsClient.GetLocation, req, settings.GRPC, c.logger, "GetLocation")
   320  		return err
   321  	}, opts...)
   322  	if err != nil {
   323  		return nil, err
   324  	}
   325  	return resp, nil
   326  }
   327  
   328  func (c *dataFoundryGRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
   329  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   330  
   331  	hds = append(c.xGoogHeaders, hds...)
   332  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   333  	opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...)
   334  	it := &LocationIterator{}
   335  	req = proto.Clone(req).(*locationpb.ListLocationsRequest)
   336  	it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) {
   337  		resp := &locationpb.ListLocationsResponse{}
   338  		if pageToken != "" {
   339  			req.PageToken = pageToken
   340  		}
   341  		if pageSize > math.MaxInt32 {
   342  			req.PageSize = math.MaxInt32
   343  		} else if pageSize != 0 {
   344  			req.PageSize = int32(pageSize)
   345  		}
   346  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   347  			var err error
   348  			resp, err = executeRPC(ctx, c.locationsClient.ListLocations, req, settings.GRPC, c.logger, "ListLocations")
   349  			return err
   350  		}, opts...)
   351  		if err != nil {
   352  			return nil, "", err
   353  		}
   354  
   355  		it.Response = resp
   356  		return resp.GetLocations(), resp.GetNextPageToken(), nil
   357  	}
   358  	fetch := func(pageSize int, pageToken string) (string, error) {
   359  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   360  		if err != nil {
   361  			return "", err
   362  		}
   363  		it.items = append(it.items, items...)
   364  		return nextPageToken, nil
   365  	}
   366  
   367  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   368  	it.pageInfo.MaxSize = int(req.GetPageSize())
   369  	it.pageInfo.Token = req.GetPageToken()
   370  
   371  	return it
   372  }
   373  
   374  func (c *dataFoundryGRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   375  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
   376  
   377  	hds = append(c.xGoogHeaders, hds...)
   378  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   379  	opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...)
   380  	var resp *iampb.Policy
   381  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   382  		var err error
   383  		resp, err = executeRPC(ctx, c.iamPolicyClient.GetIamPolicy, req, settings.GRPC, c.logger, "GetIamPolicy")
   384  		return err
   385  	}, opts...)
   386  	if err != nil {
   387  		return nil, err
   388  	}
   389  	return resp, nil
   390  }
   391  
   392  func (c *dataFoundryGRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   393  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
   394  
   395  	hds = append(c.xGoogHeaders, hds...)
   396  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   397  	opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...)
   398  	var resp *iampb.Policy
   399  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   400  		var err error
   401  		resp, err = executeRPC(ctx, c.iamPolicyClient.SetIamPolicy, req, settings.GRPC, c.logger, "SetIamPolicy")
   402  		return err
   403  	}, opts...)
   404  	if err != nil {
   405  		return nil, err
   406  	}
   407  	return resp, nil
   408  }
   409  
   410  func (c *dataFoundryGRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
   411  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
   412  
   413  	hds = append(c.xGoogHeaders, hds...)
   414  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   415  	opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...)
   416  	var resp *iampb.TestIamPermissionsResponse
   417  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   418  		var err error
   419  		resp, err = executeRPC(ctx, c.iamPolicyClient.TestIamPermissions, req, settings.GRPC, c.logger, "TestIamPermissions")
   420  		return err
   421  	}, opts...)
   422  	if err != nil {
   423  		return nil, err
   424  	}
   425  	return resp, nil
   426  }
   427  
   428  func (c *dataFoundryGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
   429  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   430  
   431  	hds = append(c.xGoogHeaders, hds...)
   432  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   433  	opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...)
   434  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   435  		var err error
   436  		_, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation")
   437  		return err
   438  	}, opts...)
   439  	return err
   440  }
   441  
   442  func (c *dataFoundryGRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
   443  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   444  
   445  	hds = append(c.xGoogHeaders, hds...)
   446  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   447  	opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...)
   448  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   449  		var err error
   450  		_, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation")
   451  		return err
   452  	}, opts...)
   453  	return err
   454  }
   455  
   456  func (c *dataFoundryGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   457  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   458  
   459  	hds = append(c.xGoogHeaders, hds...)
   460  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   461  	opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
   462  	var resp *longrunningpb.Operation
   463  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   464  		var err error
   465  		resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation")
   466  		return err
   467  	}, opts...)
   468  	if err != nil {
   469  		return nil, err
   470  	}
   471  	return resp, nil
   472  }
   473  
   474  func (c *dataFoundryGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
   475  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   476  
   477  	hds = append(c.xGoogHeaders, hds...)
   478  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   479  	opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...)
   480  	it := &OperationIterator{}
   481  	req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
   482  	it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
   483  		resp := &longrunningpb.ListOperationsResponse{}
   484  		if pageToken != "" {
   485  			req.PageToken = pageToken
   486  		}
   487  		if pageSize > math.MaxInt32 {
   488  			req.PageSize = math.MaxInt32
   489  		} else if pageSize != 0 {
   490  			req.PageSize = int32(pageSize)
   491  		}
   492  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   493  			var err error
   494  			resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations")
   495  			return err
   496  		}, opts...)
   497  		if err != nil {
   498  			return nil, "", err
   499  		}
   500  
   501  		it.Response = resp
   502  		return resp.GetOperations(), resp.GetNextPageToken(), nil
   503  	}
   504  	fetch := func(pageSize int, pageToken string) (string, error) {
   505  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   506  		if err != nil {
   507  			return "", err
   508  		}
   509  		it.items = append(it.items, items...)
   510  		return nextPageToken, nil
   511  	}
   512  
   513  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   514  	it.pageInfo.MaxSize = int(req.GetPageSize())
   515  	it.pageInfo.Token = req.GetPageToken()
   516  
   517  	return it
   518  }
   519  
   520  func (c *dataFoundryGRPCClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   521  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   522  
   523  	hds = append(c.xGoogHeaders, hds...)
   524  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   525  	opts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...)
   526  	var resp *longrunningpb.Operation
   527  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   528  		var err error
   529  		resp, err = executeRPC(ctx, c.operationsClient.WaitOperation, req, settings.GRPC, c.logger, "WaitOperation")
   530  		return err
   531  	}, opts...)
   532  	if err != nil {
   533  		return nil, err
   534  	}
   535  	return resp, nil
   536  }