cloud.google.com/go/aiplatform@v1.106.0/apiv1/dataset_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 newDatasetClientHook clientHook
    42  
    43  // DatasetCallOptions contains the retry settings for each method of DatasetClient.
    44  type DatasetCallOptions struct {
    45  	CreateDataset         []gax.CallOption
    46  	GetDataset            []gax.CallOption
    47  	UpdateDataset         []gax.CallOption
    48  	ListDatasets          []gax.CallOption
    49  	DeleteDataset         []gax.CallOption
    50  	ImportData            []gax.CallOption
    51  	ExportData            []gax.CallOption
    52  	CreateDatasetVersion  []gax.CallOption
    53  	UpdateDatasetVersion  []gax.CallOption
    54  	DeleteDatasetVersion  []gax.CallOption
    55  	GetDatasetVersion     []gax.CallOption
    56  	ListDatasetVersions   []gax.CallOption
    57  	RestoreDatasetVersion []gax.CallOption
    58  	ListDataItems         []gax.CallOption
    59  	SearchDataItems       []gax.CallOption
    60  	ListSavedQueries      []gax.CallOption
    61  	DeleteSavedQuery      []gax.CallOption
    62  	GetAnnotationSpec     []gax.CallOption
    63  	ListAnnotations       []gax.CallOption
    64  	GetLocation           []gax.CallOption
    65  	ListLocations         []gax.CallOption
    66  	GetIamPolicy          []gax.CallOption
    67  	SetIamPolicy          []gax.CallOption
    68  	TestIamPermissions    []gax.CallOption
    69  	CancelOperation       []gax.CallOption
    70  	DeleteOperation       []gax.CallOption
    71  	GetOperation          []gax.CallOption
    72  	ListOperations        []gax.CallOption
    73  	WaitOperation         []gax.CallOption
    74  }
    75  
    76  func defaultDatasetGRPCClientOptions() []option.ClientOption {
    77  	return []option.ClientOption{
    78  		internaloption.WithDefaultEndpoint("aiplatform.googleapis.com:443"),
    79  		internaloption.WithDefaultEndpointTemplate("aiplatform.UNIVERSE_DOMAIN:443"),
    80  		internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"),
    81  		internaloption.WithDefaultUniverseDomain("googleapis.com"),
    82  		internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"),
    83  		internaloption.WithDefaultScopes(DefaultAuthScopes()...),
    84  		internaloption.EnableJwtWithScope(),
    85  		internaloption.EnableNewAuthLibrary(),
    86  		option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
    87  			grpc.MaxCallRecvMsgSize(math.MaxInt32))),
    88  	}
    89  }
    90  
    91  func defaultDatasetCallOptions() *DatasetCallOptions {
    92  	return &DatasetCallOptions{
    93  		CreateDataset:         []gax.CallOption{},
    94  		GetDataset:            []gax.CallOption{},
    95  		UpdateDataset:         []gax.CallOption{},
    96  		ListDatasets:          []gax.CallOption{},
    97  		DeleteDataset:         []gax.CallOption{},
    98  		ImportData:            []gax.CallOption{},
    99  		ExportData:            []gax.CallOption{},
   100  		CreateDatasetVersion:  []gax.CallOption{},
   101  		UpdateDatasetVersion:  []gax.CallOption{},
   102  		DeleteDatasetVersion:  []gax.CallOption{},
   103  		GetDatasetVersion:     []gax.CallOption{},
   104  		ListDatasetVersions:   []gax.CallOption{},
   105  		RestoreDatasetVersion: []gax.CallOption{},
   106  		ListDataItems:         []gax.CallOption{},
   107  		SearchDataItems:       []gax.CallOption{},
   108  		ListSavedQueries:      []gax.CallOption{},
   109  		DeleteSavedQuery:      []gax.CallOption{},
   110  		GetAnnotationSpec:     []gax.CallOption{},
   111  		ListAnnotations:       []gax.CallOption{},
   112  		GetLocation:           []gax.CallOption{},
   113  		ListLocations:         []gax.CallOption{},
   114  		GetIamPolicy:          []gax.CallOption{},
   115  		SetIamPolicy:          []gax.CallOption{},
   116  		TestIamPermissions:    []gax.CallOption{},
   117  		CancelOperation:       []gax.CallOption{},
   118  		DeleteOperation:       []gax.CallOption{},
   119  		GetOperation:          []gax.CallOption{},
   120  		ListOperations:        []gax.CallOption{},
   121  		WaitOperation:         []gax.CallOption{},
   122  	}
   123  }
   124  
   125  // internalDatasetClient is an interface that defines the methods available from Vertex AI API.
   126  type internalDatasetClient interface {
   127  	Close() error
   128  	setGoogleClientInfo(...string)
   129  	Connection() *grpc.ClientConn
   130  	CreateDataset(context.Context, *aiplatformpb.CreateDatasetRequest, ...gax.CallOption) (*CreateDatasetOperation, error)
   131  	CreateDatasetOperation(name string) *CreateDatasetOperation
   132  	GetDataset(context.Context, *aiplatformpb.GetDatasetRequest, ...gax.CallOption) (*aiplatformpb.Dataset, error)
   133  	UpdateDataset(context.Context, *aiplatformpb.UpdateDatasetRequest, ...gax.CallOption) (*aiplatformpb.Dataset, error)
   134  	ListDatasets(context.Context, *aiplatformpb.ListDatasetsRequest, ...gax.CallOption) *DatasetIterator
   135  	DeleteDataset(context.Context, *aiplatformpb.DeleteDatasetRequest, ...gax.CallOption) (*DeleteDatasetOperation, error)
   136  	DeleteDatasetOperation(name string) *DeleteDatasetOperation
   137  	ImportData(context.Context, *aiplatformpb.ImportDataRequest, ...gax.CallOption) (*ImportDataOperation, error)
   138  	ImportDataOperation(name string) *ImportDataOperation
   139  	ExportData(context.Context, *aiplatformpb.ExportDataRequest, ...gax.CallOption) (*ExportDataOperation, error)
   140  	ExportDataOperation(name string) *ExportDataOperation
   141  	CreateDatasetVersion(context.Context, *aiplatformpb.CreateDatasetVersionRequest, ...gax.CallOption) (*CreateDatasetVersionOperation, error)
   142  	CreateDatasetVersionOperation(name string) *CreateDatasetVersionOperation
   143  	UpdateDatasetVersion(context.Context, *aiplatformpb.UpdateDatasetVersionRequest, ...gax.CallOption) (*aiplatformpb.DatasetVersion, error)
   144  	DeleteDatasetVersion(context.Context, *aiplatformpb.DeleteDatasetVersionRequest, ...gax.CallOption) (*DeleteDatasetVersionOperation, error)
   145  	DeleteDatasetVersionOperation(name string) *DeleteDatasetVersionOperation
   146  	GetDatasetVersion(context.Context, *aiplatformpb.GetDatasetVersionRequest, ...gax.CallOption) (*aiplatformpb.DatasetVersion, error)
   147  	ListDatasetVersions(context.Context, *aiplatformpb.ListDatasetVersionsRequest, ...gax.CallOption) *DatasetVersionIterator
   148  	RestoreDatasetVersion(context.Context, *aiplatformpb.RestoreDatasetVersionRequest, ...gax.CallOption) (*RestoreDatasetVersionOperation, error)
   149  	RestoreDatasetVersionOperation(name string) *RestoreDatasetVersionOperation
   150  	ListDataItems(context.Context, *aiplatformpb.ListDataItemsRequest, ...gax.CallOption) *DataItemIterator
   151  	SearchDataItems(context.Context, *aiplatformpb.SearchDataItemsRequest, ...gax.CallOption) *DataItemViewIterator
   152  	ListSavedQueries(context.Context, *aiplatformpb.ListSavedQueriesRequest, ...gax.CallOption) *SavedQueryIterator
   153  	DeleteSavedQuery(context.Context, *aiplatformpb.DeleteSavedQueryRequest, ...gax.CallOption) (*DeleteSavedQueryOperation, error)
   154  	DeleteSavedQueryOperation(name string) *DeleteSavedQueryOperation
   155  	GetAnnotationSpec(context.Context, *aiplatformpb.GetAnnotationSpecRequest, ...gax.CallOption) (*aiplatformpb.AnnotationSpec, error)
   156  	ListAnnotations(context.Context, *aiplatformpb.ListAnnotationsRequest, ...gax.CallOption) *AnnotationIterator
   157  	GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error)
   158  	ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator
   159  	GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error)
   160  	SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error)
   161  	TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
   162  	CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error
   163  	DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error
   164  	GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
   165  	ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator
   166  	WaitOperation(context.Context, *longrunningpb.WaitOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
   167  }
   168  
   169  // DatasetClient is a client for interacting with Vertex AI API.
   170  // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
   171  //
   172  // The service that manages Vertex AI Dataset and its child resources.
   173  type DatasetClient struct {
   174  	// The internal transport-dependent client.
   175  	internalClient internalDatasetClient
   176  
   177  	// The call options for this service.
   178  	CallOptions *DatasetCallOptions
   179  
   180  	// LROClient is used internally to handle long-running operations.
   181  	// It is exposed so that its CallOptions can be modified if required.
   182  	// Users should not Close this client.
   183  	LROClient *lroauto.OperationsClient
   184  }
   185  
   186  // Wrapper methods routed to the internal client.
   187  
   188  // Close closes the connection to the API service. The user should invoke this when
   189  // the client is no longer required.
   190  func (c *DatasetClient) Close() error {
   191  	return c.internalClient.Close()
   192  }
   193  
   194  // setGoogleClientInfo sets the name and version of the application in
   195  // the `x-goog-api-client` header passed on each request. Intended for
   196  // use by Google-written clients.
   197  func (c *DatasetClient) setGoogleClientInfo(keyval ...string) {
   198  	c.internalClient.setGoogleClientInfo(keyval...)
   199  }
   200  
   201  // Connection returns a connection to the API service.
   202  //
   203  // Deprecated: Connections are now pooled so this method does not always
   204  // return the same resource.
   205  func (c *DatasetClient) Connection() *grpc.ClientConn {
   206  	return c.internalClient.Connection()
   207  }
   208  
   209  // CreateDataset creates a Dataset.
   210  func (c *DatasetClient) CreateDataset(ctx context.Context, req *aiplatformpb.CreateDatasetRequest, opts ...gax.CallOption) (*CreateDatasetOperation, error) {
   211  	return c.internalClient.CreateDataset(ctx, req, opts...)
   212  }
   213  
   214  // CreateDatasetOperation returns a new CreateDatasetOperation from a given name.
   215  // The name must be that of a previously created CreateDatasetOperation, possibly from a different process.
   216  func (c *DatasetClient) CreateDatasetOperation(name string) *CreateDatasetOperation {
   217  	return c.internalClient.CreateDatasetOperation(name)
   218  }
   219  
   220  // GetDataset gets a Dataset.
   221  func (c *DatasetClient) GetDataset(ctx context.Context, req *aiplatformpb.GetDatasetRequest, opts ...gax.CallOption) (*aiplatformpb.Dataset, error) {
   222  	return c.internalClient.GetDataset(ctx, req, opts...)
   223  }
   224  
   225  // UpdateDataset updates a Dataset.
   226  func (c *DatasetClient) UpdateDataset(ctx context.Context, req *aiplatformpb.UpdateDatasetRequest, opts ...gax.CallOption) (*aiplatformpb.Dataset, error) {
   227  	return c.internalClient.UpdateDataset(ctx, req, opts...)
   228  }
   229  
   230  // ListDatasets lists Datasets in a Location.
   231  func (c *DatasetClient) ListDatasets(ctx context.Context, req *aiplatformpb.ListDatasetsRequest, opts ...gax.CallOption) *DatasetIterator {
   232  	return c.internalClient.ListDatasets(ctx, req, opts...)
   233  }
   234  
   235  // DeleteDataset deletes a Dataset.
   236  func (c *DatasetClient) DeleteDataset(ctx context.Context, req *aiplatformpb.DeleteDatasetRequest, opts ...gax.CallOption) (*DeleteDatasetOperation, error) {
   237  	return c.internalClient.DeleteDataset(ctx, req, opts...)
   238  }
   239  
   240  // DeleteDatasetOperation returns a new DeleteDatasetOperation from a given name.
   241  // The name must be that of a previously created DeleteDatasetOperation, possibly from a different process.
   242  func (c *DatasetClient) DeleteDatasetOperation(name string) *DeleteDatasetOperation {
   243  	return c.internalClient.DeleteDatasetOperation(name)
   244  }
   245  
   246  // ImportData imports data into a Dataset.
   247  func (c *DatasetClient) ImportData(ctx context.Context, req *aiplatformpb.ImportDataRequest, opts ...gax.CallOption) (*ImportDataOperation, error) {
   248  	return c.internalClient.ImportData(ctx, req, opts...)
   249  }
   250  
   251  // ImportDataOperation returns a new ImportDataOperation from a given name.
   252  // The name must be that of a previously created ImportDataOperation, possibly from a different process.
   253  func (c *DatasetClient) ImportDataOperation(name string) *ImportDataOperation {
   254  	return c.internalClient.ImportDataOperation(name)
   255  }
   256  
   257  // ExportData exports data from a Dataset.
   258  func (c *DatasetClient) ExportData(ctx context.Context, req *aiplatformpb.ExportDataRequest, opts ...gax.CallOption) (*ExportDataOperation, error) {
   259  	return c.internalClient.ExportData(ctx, req, opts...)
   260  }
   261  
   262  // ExportDataOperation returns a new ExportDataOperation from a given name.
   263  // The name must be that of a previously created ExportDataOperation, possibly from a different process.
   264  func (c *DatasetClient) ExportDataOperation(name string) *ExportDataOperation {
   265  	return c.internalClient.ExportDataOperation(name)
   266  }
   267  
   268  // CreateDatasetVersion create a version from a Dataset.
   269  func (c *DatasetClient) CreateDatasetVersion(ctx context.Context, req *aiplatformpb.CreateDatasetVersionRequest, opts ...gax.CallOption) (*CreateDatasetVersionOperation, error) {
   270  	return c.internalClient.CreateDatasetVersion(ctx, req, opts...)
   271  }
   272  
   273  // CreateDatasetVersionOperation returns a new CreateDatasetVersionOperation from a given name.
   274  // The name must be that of a previously created CreateDatasetVersionOperation, possibly from a different process.
   275  func (c *DatasetClient) CreateDatasetVersionOperation(name string) *CreateDatasetVersionOperation {
   276  	return c.internalClient.CreateDatasetVersionOperation(name)
   277  }
   278  
   279  // UpdateDatasetVersion updates a DatasetVersion.
   280  func (c *DatasetClient) UpdateDatasetVersion(ctx context.Context, req *aiplatformpb.UpdateDatasetVersionRequest, opts ...gax.CallOption) (*aiplatformpb.DatasetVersion, error) {
   281  	return c.internalClient.UpdateDatasetVersion(ctx, req, opts...)
   282  }
   283  
   284  // DeleteDatasetVersion deletes a Dataset version.
   285  func (c *DatasetClient) DeleteDatasetVersion(ctx context.Context, req *aiplatformpb.DeleteDatasetVersionRequest, opts ...gax.CallOption) (*DeleteDatasetVersionOperation, error) {
   286  	return c.internalClient.DeleteDatasetVersion(ctx, req, opts...)
   287  }
   288  
   289  // DeleteDatasetVersionOperation returns a new DeleteDatasetVersionOperation from a given name.
   290  // The name must be that of a previously created DeleteDatasetVersionOperation, possibly from a different process.
   291  func (c *DatasetClient) DeleteDatasetVersionOperation(name string) *DeleteDatasetVersionOperation {
   292  	return c.internalClient.DeleteDatasetVersionOperation(name)
   293  }
   294  
   295  // GetDatasetVersion gets a Dataset version.
   296  func (c *DatasetClient) GetDatasetVersion(ctx context.Context, req *aiplatformpb.GetDatasetVersionRequest, opts ...gax.CallOption) (*aiplatformpb.DatasetVersion, error) {
   297  	return c.internalClient.GetDatasetVersion(ctx, req, opts...)
   298  }
   299  
   300  // ListDatasetVersions lists DatasetVersions in a Dataset.
   301  func (c *DatasetClient) ListDatasetVersions(ctx context.Context, req *aiplatformpb.ListDatasetVersionsRequest, opts ...gax.CallOption) *DatasetVersionIterator {
   302  	return c.internalClient.ListDatasetVersions(ctx, req, opts...)
   303  }
   304  
   305  // RestoreDatasetVersion restores a dataset version.
   306  func (c *DatasetClient) RestoreDatasetVersion(ctx context.Context, req *aiplatformpb.RestoreDatasetVersionRequest, opts ...gax.CallOption) (*RestoreDatasetVersionOperation, error) {
   307  	return c.internalClient.RestoreDatasetVersion(ctx, req, opts...)
   308  }
   309  
   310  // RestoreDatasetVersionOperation returns a new RestoreDatasetVersionOperation from a given name.
   311  // The name must be that of a previously created RestoreDatasetVersionOperation, possibly from a different process.
   312  func (c *DatasetClient) RestoreDatasetVersionOperation(name string) *RestoreDatasetVersionOperation {
   313  	return c.internalClient.RestoreDatasetVersionOperation(name)
   314  }
   315  
   316  // ListDataItems lists DataItems in a Dataset.
   317  func (c *DatasetClient) ListDataItems(ctx context.Context, req *aiplatformpb.ListDataItemsRequest, opts ...gax.CallOption) *DataItemIterator {
   318  	return c.internalClient.ListDataItems(ctx, req, opts...)
   319  }
   320  
   321  // SearchDataItems searches DataItems in a Dataset.
   322  func (c *DatasetClient) SearchDataItems(ctx context.Context, req *aiplatformpb.SearchDataItemsRequest, opts ...gax.CallOption) *DataItemViewIterator {
   323  	return c.internalClient.SearchDataItems(ctx, req, opts...)
   324  }
   325  
   326  // ListSavedQueries lists SavedQueries in a Dataset.
   327  func (c *DatasetClient) ListSavedQueries(ctx context.Context, req *aiplatformpb.ListSavedQueriesRequest, opts ...gax.CallOption) *SavedQueryIterator {
   328  	return c.internalClient.ListSavedQueries(ctx, req, opts...)
   329  }
   330  
   331  // DeleteSavedQuery deletes a SavedQuery.
   332  func (c *DatasetClient) DeleteSavedQuery(ctx context.Context, req *aiplatformpb.DeleteSavedQueryRequest, opts ...gax.CallOption) (*DeleteSavedQueryOperation, error) {
   333  	return c.internalClient.DeleteSavedQuery(ctx, req, opts...)
   334  }
   335  
   336  // DeleteSavedQueryOperation returns a new DeleteSavedQueryOperation from a given name.
   337  // The name must be that of a previously created DeleteSavedQueryOperation, possibly from a different process.
   338  func (c *DatasetClient) DeleteSavedQueryOperation(name string) *DeleteSavedQueryOperation {
   339  	return c.internalClient.DeleteSavedQueryOperation(name)
   340  }
   341  
   342  // GetAnnotationSpec gets an AnnotationSpec.
   343  func (c *DatasetClient) GetAnnotationSpec(ctx context.Context, req *aiplatformpb.GetAnnotationSpecRequest, opts ...gax.CallOption) (*aiplatformpb.AnnotationSpec, error) {
   344  	return c.internalClient.GetAnnotationSpec(ctx, req, opts...)
   345  }
   346  
   347  // ListAnnotations lists Annotations belongs to a dataitem
   348  // This RPC is only available in InternalDatasetService. It is only used for
   349  // exporting conversation data to CCAI Insights.
   350  func (c *DatasetClient) ListAnnotations(ctx context.Context, req *aiplatformpb.ListAnnotationsRequest, opts ...gax.CallOption) *AnnotationIterator {
   351  	return c.internalClient.ListAnnotations(ctx, req, opts...)
   352  }
   353  
   354  // GetLocation gets information about a location.
   355  func (c *DatasetClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
   356  	return c.internalClient.GetLocation(ctx, req, opts...)
   357  }
   358  
   359  // ListLocations lists information about the supported locations for this service.
   360  func (c *DatasetClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
   361  	return c.internalClient.ListLocations(ctx, req, opts...)
   362  }
   363  
   364  // GetIamPolicy gets the access control policy for a resource. Returns an empty policy
   365  // if the resource exists and does not have a policy set.
   366  func (c *DatasetClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   367  	return c.internalClient.GetIamPolicy(ctx, req, opts...)
   368  }
   369  
   370  // SetIamPolicy sets the access control policy on the specified resource. Replaces
   371  // any existing policy.
   372  //
   373  // Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED
   374  // errors.
   375  func (c *DatasetClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   376  	return c.internalClient.SetIamPolicy(ctx, req, opts...)
   377  }
   378  
   379  // TestIamPermissions returns permissions that a caller has on the specified resource. If the
   380  // resource does not exist, this will return an empty set of
   381  // permissions, not a NOT_FOUND error.
   382  //
   383  // Note: This operation is designed to be used for building
   384  // permission-aware UIs and command-line tools, not for authorization
   385  // checking. This operation may “fail open” without warning.
   386  func (c *DatasetClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
   387  	return c.internalClient.TestIamPermissions(ctx, req, opts...)
   388  }
   389  
   390  // CancelOperation is a utility method from google.longrunning.Operations.
   391  func (c *DatasetClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
   392  	return c.internalClient.CancelOperation(ctx, req, opts...)
   393  }
   394  
   395  // DeleteOperation is a utility method from google.longrunning.Operations.
   396  func (c *DatasetClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
   397  	return c.internalClient.DeleteOperation(ctx, req, opts...)
   398  }
   399  
   400  // GetOperation is a utility method from google.longrunning.Operations.
   401  func (c *DatasetClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   402  	return c.internalClient.GetOperation(ctx, req, opts...)
   403  }
   404  
   405  // ListOperations is a utility method from google.longrunning.Operations.
   406  func (c *DatasetClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
   407  	return c.internalClient.ListOperations(ctx, req, opts...)
   408  }
   409  
   410  // WaitOperation is a utility method from google.longrunning.Operations.
   411  func (c *DatasetClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   412  	return c.internalClient.WaitOperation(ctx, req, opts...)
   413  }
   414  
   415  // datasetGRPCClient is a client for interacting with Vertex AI API over gRPC transport.
   416  //
   417  // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
   418  type datasetGRPCClient struct {
   419  	// Connection pool of gRPC connections to the service.
   420  	connPool gtransport.ConnPool
   421  
   422  	// Points back to the CallOptions field of the containing DatasetClient
   423  	CallOptions **DatasetCallOptions
   424  
   425  	// The gRPC API client.
   426  	datasetClient aiplatformpb.DatasetServiceClient
   427  
   428  	// LROClient is used internally to handle long-running operations.
   429  	// It is exposed so that its CallOptions can be modified if required.
   430  	// Users should not Close this client.
   431  	LROClient **lroauto.OperationsClient
   432  
   433  	operationsClient longrunningpb.OperationsClient
   434  
   435  	iamPolicyClient iampb.IAMPolicyClient
   436  
   437  	locationsClient locationpb.LocationsClient
   438  
   439  	// The x-goog-* metadata to be sent with each request.
   440  	xGoogHeaders []string
   441  
   442  	logger *slog.Logger
   443  }
   444  
   445  // NewDatasetClient creates a new dataset service client based on gRPC.
   446  // The returned client must be Closed when it is done being used to clean up its underlying connections.
   447  //
   448  // The service that manages Vertex AI Dataset and its child resources.
   449  func NewDatasetClient(ctx context.Context, opts ...option.ClientOption) (*DatasetClient, error) {
   450  	clientOpts := defaultDatasetGRPCClientOptions()
   451  	if newDatasetClientHook != nil {
   452  		hookOpts, err := newDatasetClientHook(ctx, clientHookParams{})
   453  		if err != nil {
   454  			return nil, err
   455  		}
   456  		clientOpts = append(clientOpts, hookOpts...)
   457  	}
   458  
   459  	connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
   460  	if err != nil {
   461  		return nil, err
   462  	}
   463  	client := DatasetClient{CallOptions: defaultDatasetCallOptions()}
   464  
   465  	c := &datasetGRPCClient{
   466  		connPool:         connPool,
   467  		datasetClient:    aiplatformpb.NewDatasetServiceClient(connPool),
   468  		CallOptions:      &client.CallOptions,
   469  		logger:           internaloption.GetLogger(opts),
   470  		operationsClient: longrunningpb.NewOperationsClient(connPool),
   471  		iamPolicyClient:  iampb.NewIAMPolicyClient(connPool),
   472  		locationsClient:  locationpb.NewLocationsClient(connPool),
   473  	}
   474  	c.setGoogleClientInfo()
   475  
   476  	client.internalClient = c
   477  
   478  	client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
   479  	if err != nil {
   480  		// This error "should not happen", since we are just reusing old connection pool
   481  		// and never actually need to dial.
   482  		// If this does happen, we could leak connp. However, we cannot close conn:
   483  		// If the user invoked the constructor with option.WithGRPCConn,
   484  		// we would close a connection that's still in use.
   485  		// TODO: investigate error conditions.
   486  		return nil, err
   487  	}
   488  	c.LROClient = &client.LROClient
   489  	return &client, nil
   490  }
   491  
   492  // Connection returns a connection to the API service.
   493  //
   494  // Deprecated: Connections are now pooled so this method does not always
   495  // return the same resource.
   496  func (c *datasetGRPCClient) Connection() *grpc.ClientConn {
   497  	return c.connPool.Conn()
   498  }
   499  
   500  // setGoogleClientInfo sets the name and version of the application in
   501  // the `x-goog-api-client` header passed on each request. Intended for
   502  // use by Google-written clients.
   503  func (c *datasetGRPCClient) setGoogleClientInfo(keyval ...string) {
   504  	kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
   505  	kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion)
   506  	c.xGoogHeaders = []string{
   507  		"x-goog-api-client", gax.XGoogHeader(kv...),
   508  	}
   509  }
   510  
   511  // Close closes the connection to the API service. The user should invoke this when
   512  // the client is no longer required.
   513  func (c *datasetGRPCClient) Close() error {
   514  	return c.connPool.Close()
   515  }
   516  
   517  func (c *datasetGRPCClient) CreateDataset(ctx context.Context, req *aiplatformpb.CreateDatasetRequest, opts ...gax.CallOption) (*CreateDatasetOperation, error) {
   518  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   519  
   520  	hds = append(c.xGoogHeaders, hds...)
   521  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   522  	opts = append((*c.CallOptions).CreateDataset[0:len((*c.CallOptions).CreateDataset):len((*c.CallOptions).CreateDataset)], opts...)
   523  	var resp *longrunningpb.Operation
   524  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   525  		var err error
   526  		resp, err = executeRPC(ctx, c.datasetClient.CreateDataset, req, settings.GRPC, c.logger, "CreateDataset")
   527  		return err
   528  	}, opts...)
   529  	if err != nil {
   530  		return nil, err
   531  	}
   532  	return &CreateDatasetOperation{
   533  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   534  	}, nil
   535  }
   536  
   537  func (c *datasetGRPCClient) GetDataset(ctx context.Context, req *aiplatformpb.GetDatasetRequest, opts ...gax.CallOption) (*aiplatformpb.Dataset, error) {
   538  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   539  
   540  	hds = append(c.xGoogHeaders, hds...)
   541  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   542  	opts = append((*c.CallOptions).GetDataset[0:len((*c.CallOptions).GetDataset):len((*c.CallOptions).GetDataset)], opts...)
   543  	var resp *aiplatformpb.Dataset
   544  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   545  		var err error
   546  		resp, err = executeRPC(ctx, c.datasetClient.GetDataset, req, settings.GRPC, c.logger, "GetDataset")
   547  		return err
   548  	}, opts...)
   549  	if err != nil {
   550  		return nil, err
   551  	}
   552  	return resp, nil
   553  }
   554  
   555  func (c *datasetGRPCClient) UpdateDataset(ctx context.Context, req *aiplatformpb.UpdateDatasetRequest, opts ...gax.CallOption) (*aiplatformpb.Dataset, error) {
   556  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "dataset.name", url.QueryEscape(req.GetDataset().GetName()))}
   557  
   558  	hds = append(c.xGoogHeaders, hds...)
   559  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   560  	opts = append((*c.CallOptions).UpdateDataset[0:len((*c.CallOptions).UpdateDataset):len((*c.CallOptions).UpdateDataset)], opts...)
   561  	var resp *aiplatformpb.Dataset
   562  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   563  		var err error
   564  		resp, err = executeRPC(ctx, c.datasetClient.UpdateDataset, req, settings.GRPC, c.logger, "UpdateDataset")
   565  		return err
   566  	}, opts...)
   567  	if err != nil {
   568  		return nil, err
   569  	}
   570  	return resp, nil
   571  }
   572  
   573  func (c *datasetGRPCClient) ListDatasets(ctx context.Context, req *aiplatformpb.ListDatasetsRequest, opts ...gax.CallOption) *DatasetIterator {
   574  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   575  
   576  	hds = append(c.xGoogHeaders, hds...)
   577  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   578  	opts = append((*c.CallOptions).ListDatasets[0:len((*c.CallOptions).ListDatasets):len((*c.CallOptions).ListDatasets)], opts...)
   579  	it := &DatasetIterator{}
   580  	req = proto.Clone(req).(*aiplatformpb.ListDatasetsRequest)
   581  	it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.Dataset, string, error) {
   582  		resp := &aiplatformpb.ListDatasetsResponse{}
   583  		if pageToken != "" {
   584  			req.PageToken = pageToken
   585  		}
   586  		if pageSize > math.MaxInt32 {
   587  			req.PageSize = math.MaxInt32
   588  		} else if pageSize != 0 {
   589  			req.PageSize = int32(pageSize)
   590  		}
   591  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   592  			var err error
   593  			resp, err = executeRPC(ctx, c.datasetClient.ListDatasets, req, settings.GRPC, c.logger, "ListDatasets")
   594  			return err
   595  		}, opts...)
   596  		if err != nil {
   597  			return nil, "", err
   598  		}
   599  
   600  		it.Response = resp
   601  		return resp.GetDatasets(), resp.GetNextPageToken(), nil
   602  	}
   603  	fetch := func(pageSize int, pageToken string) (string, error) {
   604  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   605  		if err != nil {
   606  			return "", err
   607  		}
   608  		it.items = append(it.items, items...)
   609  		return nextPageToken, nil
   610  	}
   611  
   612  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   613  	it.pageInfo.MaxSize = int(req.GetPageSize())
   614  	it.pageInfo.Token = req.GetPageToken()
   615  
   616  	return it
   617  }
   618  
   619  func (c *datasetGRPCClient) DeleteDataset(ctx context.Context, req *aiplatformpb.DeleteDatasetRequest, opts ...gax.CallOption) (*DeleteDatasetOperation, error) {
   620  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   621  
   622  	hds = append(c.xGoogHeaders, hds...)
   623  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   624  	opts = append((*c.CallOptions).DeleteDataset[0:len((*c.CallOptions).DeleteDataset):len((*c.CallOptions).DeleteDataset)], opts...)
   625  	var resp *longrunningpb.Operation
   626  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   627  		var err error
   628  		resp, err = executeRPC(ctx, c.datasetClient.DeleteDataset, req, settings.GRPC, c.logger, "DeleteDataset")
   629  		return err
   630  	}, opts...)
   631  	if err != nil {
   632  		return nil, err
   633  	}
   634  	return &DeleteDatasetOperation{
   635  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   636  	}, nil
   637  }
   638  
   639  func (c *datasetGRPCClient) ImportData(ctx context.Context, req *aiplatformpb.ImportDataRequest, opts ...gax.CallOption) (*ImportDataOperation, error) {
   640  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   641  
   642  	hds = append(c.xGoogHeaders, hds...)
   643  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   644  	opts = append((*c.CallOptions).ImportData[0:len((*c.CallOptions).ImportData):len((*c.CallOptions).ImportData)], opts...)
   645  	var resp *longrunningpb.Operation
   646  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   647  		var err error
   648  		resp, err = executeRPC(ctx, c.datasetClient.ImportData, req, settings.GRPC, c.logger, "ImportData")
   649  		return err
   650  	}, opts...)
   651  	if err != nil {
   652  		return nil, err
   653  	}
   654  	return &ImportDataOperation{
   655  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   656  	}, nil
   657  }
   658  
   659  func (c *datasetGRPCClient) ExportData(ctx context.Context, req *aiplatformpb.ExportDataRequest, opts ...gax.CallOption) (*ExportDataOperation, error) {
   660  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   661  
   662  	hds = append(c.xGoogHeaders, hds...)
   663  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   664  	opts = append((*c.CallOptions).ExportData[0:len((*c.CallOptions).ExportData):len((*c.CallOptions).ExportData)], opts...)
   665  	var resp *longrunningpb.Operation
   666  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   667  		var err error
   668  		resp, err = executeRPC(ctx, c.datasetClient.ExportData, req, settings.GRPC, c.logger, "ExportData")
   669  		return err
   670  	}, opts...)
   671  	if err != nil {
   672  		return nil, err
   673  	}
   674  	return &ExportDataOperation{
   675  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   676  	}, nil
   677  }
   678  
   679  func (c *datasetGRPCClient) CreateDatasetVersion(ctx context.Context, req *aiplatformpb.CreateDatasetVersionRequest, opts ...gax.CallOption) (*CreateDatasetVersionOperation, error) {
   680  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   681  
   682  	hds = append(c.xGoogHeaders, hds...)
   683  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   684  	opts = append((*c.CallOptions).CreateDatasetVersion[0:len((*c.CallOptions).CreateDatasetVersion):len((*c.CallOptions).CreateDatasetVersion)], opts...)
   685  	var resp *longrunningpb.Operation
   686  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   687  		var err error
   688  		resp, err = executeRPC(ctx, c.datasetClient.CreateDatasetVersion, req, settings.GRPC, c.logger, "CreateDatasetVersion")
   689  		return err
   690  	}, opts...)
   691  	if err != nil {
   692  		return nil, err
   693  	}
   694  	return &CreateDatasetVersionOperation{
   695  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   696  	}, nil
   697  }
   698  
   699  func (c *datasetGRPCClient) UpdateDatasetVersion(ctx context.Context, req *aiplatformpb.UpdateDatasetVersionRequest, opts ...gax.CallOption) (*aiplatformpb.DatasetVersion, error) {
   700  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "dataset_version.name", url.QueryEscape(req.GetDatasetVersion().GetName()))}
   701  
   702  	hds = append(c.xGoogHeaders, hds...)
   703  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   704  	opts = append((*c.CallOptions).UpdateDatasetVersion[0:len((*c.CallOptions).UpdateDatasetVersion):len((*c.CallOptions).UpdateDatasetVersion)], opts...)
   705  	var resp *aiplatformpb.DatasetVersion
   706  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   707  		var err error
   708  		resp, err = executeRPC(ctx, c.datasetClient.UpdateDatasetVersion, req, settings.GRPC, c.logger, "UpdateDatasetVersion")
   709  		return err
   710  	}, opts...)
   711  	if err != nil {
   712  		return nil, err
   713  	}
   714  	return resp, nil
   715  }
   716  
   717  func (c *datasetGRPCClient) DeleteDatasetVersion(ctx context.Context, req *aiplatformpb.DeleteDatasetVersionRequest, opts ...gax.CallOption) (*DeleteDatasetVersionOperation, error) {
   718  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   719  
   720  	hds = append(c.xGoogHeaders, hds...)
   721  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   722  	opts = append((*c.CallOptions).DeleteDatasetVersion[0:len((*c.CallOptions).DeleteDatasetVersion):len((*c.CallOptions).DeleteDatasetVersion)], opts...)
   723  	var resp *longrunningpb.Operation
   724  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   725  		var err error
   726  		resp, err = executeRPC(ctx, c.datasetClient.DeleteDatasetVersion, req, settings.GRPC, c.logger, "DeleteDatasetVersion")
   727  		return err
   728  	}, opts...)
   729  	if err != nil {
   730  		return nil, err
   731  	}
   732  	return &DeleteDatasetVersionOperation{
   733  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   734  	}, nil
   735  }
   736  
   737  func (c *datasetGRPCClient) GetDatasetVersion(ctx context.Context, req *aiplatformpb.GetDatasetVersionRequest, opts ...gax.CallOption) (*aiplatformpb.DatasetVersion, error) {
   738  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   739  
   740  	hds = append(c.xGoogHeaders, hds...)
   741  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   742  	opts = append((*c.CallOptions).GetDatasetVersion[0:len((*c.CallOptions).GetDatasetVersion):len((*c.CallOptions).GetDatasetVersion)], opts...)
   743  	var resp *aiplatformpb.DatasetVersion
   744  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   745  		var err error
   746  		resp, err = executeRPC(ctx, c.datasetClient.GetDatasetVersion, req, settings.GRPC, c.logger, "GetDatasetVersion")
   747  		return err
   748  	}, opts...)
   749  	if err != nil {
   750  		return nil, err
   751  	}
   752  	return resp, nil
   753  }
   754  
   755  func (c *datasetGRPCClient) ListDatasetVersions(ctx context.Context, req *aiplatformpb.ListDatasetVersionsRequest, opts ...gax.CallOption) *DatasetVersionIterator {
   756  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   757  
   758  	hds = append(c.xGoogHeaders, hds...)
   759  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   760  	opts = append((*c.CallOptions).ListDatasetVersions[0:len((*c.CallOptions).ListDatasetVersions):len((*c.CallOptions).ListDatasetVersions)], opts...)
   761  	it := &DatasetVersionIterator{}
   762  	req = proto.Clone(req).(*aiplatformpb.ListDatasetVersionsRequest)
   763  	it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.DatasetVersion, string, error) {
   764  		resp := &aiplatformpb.ListDatasetVersionsResponse{}
   765  		if pageToken != "" {
   766  			req.PageToken = pageToken
   767  		}
   768  		if pageSize > math.MaxInt32 {
   769  			req.PageSize = math.MaxInt32
   770  		} else if pageSize != 0 {
   771  			req.PageSize = int32(pageSize)
   772  		}
   773  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   774  			var err error
   775  			resp, err = executeRPC(ctx, c.datasetClient.ListDatasetVersions, req, settings.GRPC, c.logger, "ListDatasetVersions")
   776  			return err
   777  		}, opts...)
   778  		if err != nil {
   779  			return nil, "", err
   780  		}
   781  
   782  		it.Response = resp
   783  		return resp.GetDatasetVersions(), resp.GetNextPageToken(), nil
   784  	}
   785  	fetch := func(pageSize int, pageToken string) (string, error) {
   786  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   787  		if err != nil {
   788  			return "", err
   789  		}
   790  		it.items = append(it.items, items...)
   791  		return nextPageToken, nil
   792  	}
   793  
   794  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   795  	it.pageInfo.MaxSize = int(req.GetPageSize())
   796  	it.pageInfo.Token = req.GetPageToken()
   797  
   798  	return it
   799  }
   800  
   801  func (c *datasetGRPCClient) RestoreDatasetVersion(ctx context.Context, req *aiplatformpb.RestoreDatasetVersionRequest, opts ...gax.CallOption) (*RestoreDatasetVersionOperation, error) {
   802  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   803  
   804  	hds = append(c.xGoogHeaders, hds...)
   805  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   806  	opts = append((*c.CallOptions).RestoreDatasetVersion[0:len((*c.CallOptions).RestoreDatasetVersion):len((*c.CallOptions).RestoreDatasetVersion)], opts...)
   807  	var resp *longrunningpb.Operation
   808  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   809  		var err error
   810  		resp, err = executeRPC(ctx, c.datasetClient.RestoreDatasetVersion, req, settings.GRPC, c.logger, "RestoreDatasetVersion")
   811  		return err
   812  	}, opts...)
   813  	if err != nil {
   814  		return nil, err
   815  	}
   816  	return &RestoreDatasetVersionOperation{
   817  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   818  	}, nil
   819  }
   820  
   821  func (c *datasetGRPCClient) ListDataItems(ctx context.Context, req *aiplatformpb.ListDataItemsRequest, opts ...gax.CallOption) *DataItemIterator {
   822  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   823  
   824  	hds = append(c.xGoogHeaders, hds...)
   825  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   826  	opts = append((*c.CallOptions).ListDataItems[0:len((*c.CallOptions).ListDataItems):len((*c.CallOptions).ListDataItems)], opts...)
   827  	it := &DataItemIterator{}
   828  	req = proto.Clone(req).(*aiplatformpb.ListDataItemsRequest)
   829  	it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.DataItem, string, error) {
   830  		resp := &aiplatformpb.ListDataItemsResponse{}
   831  		if pageToken != "" {
   832  			req.PageToken = pageToken
   833  		}
   834  		if pageSize > math.MaxInt32 {
   835  			req.PageSize = math.MaxInt32
   836  		} else if pageSize != 0 {
   837  			req.PageSize = int32(pageSize)
   838  		}
   839  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   840  			var err error
   841  			resp, err = executeRPC(ctx, c.datasetClient.ListDataItems, req, settings.GRPC, c.logger, "ListDataItems")
   842  			return err
   843  		}, opts...)
   844  		if err != nil {
   845  			return nil, "", err
   846  		}
   847  
   848  		it.Response = resp
   849  		return resp.GetDataItems(), resp.GetNextPageToken(), nil
   850  	}
   851  	fetch := func(pageSize int, pageToken string) (string, error) {
   852  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   853  		if err != nil {
   854  			return "", err
   855  		}
   856  		it.items = append(it.items, items...)
   857  		return nextPageToken, nil
   858  	}
   859  
   860  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   861  	it.pageInfo.MaxSize = int(req.GetPageSize())
   862  	it.pageInfo.Token = req.GetPageToken()
   863  
   864  	return it
   865  }
   866  
   867  func (c *datasetGRPCClient) SearchDataItems(ctx context.Context, req *aiplatformpb.SearchDataItemsRequest, opts ...gax.CallOption) *DataItemViewIterator {
   868  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "dataset", url.QueryEscape(req.GetDataset()))}
   869  
   870  	hds = append(c.xGoogHeaders, hds...)
   871  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   872  	opts = append((*c.CallOptions).SearchDataItems[0:len((*c.CallOptions).SearchDataItems):len((*c.CallOptions).SearchDataItems)], opts...)
   873  	it := &DataItemViewIterator{}
   874  	req = proto.Clone(req).(*aiplatformpb.SearchDataItemsRequest)
   875  	it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.DataItemView, string, error) {
   876  		resp := &aiplatformpb.SearchDataItemsResponse{}
   877  		if pageToken != "" {
   878  			req.PageToken = pageToken
   879  		}
   880  		if pageSize > math.MaxInt32 {
   881  			req.PageSize = math.MaxInt32
   882  		} else if pageSize != 0 {
   883  			req.PageSize = int32(pageSize)
   884  		}
   885  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   886  			var err error
   887  			resp, err = executeRPC(ctx, c.datasetClient.SearchDataItems, req, settings.GRPC, c.logger, "SearchDataItems")
   888  			return err
   889  		}, opts...)
   890  		if err != nil {
   891  			return nil, "", err
   892  		}
   893  
   894  		it.Response = resp
   895  		return resp.GetDataItemViews(), resp.GetNextPageToken(), nil
   896  	}
   897  	fetch := func(pageSize int, pageToken string) (string, error) {
   898  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   899  		if err != nil {
   900  			return "", err
   901  		}
   902  		it.items = append(it.items, items...)
   903  		return nextPageToken, nil
   904  	}
   905  
   906  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   907  	it.pageInfo.MaxSize = int(req.GetPageSize())
   908  	it.pageInfo.Token = req.GetPageToken()
   909  
   910  	return it
   911  }
   912  
   913  func (c *datasetGRPCClient) ListSavedQueries(ctx context.Context, req *aiplatformpb.ListSavedQueriesRequest, opts ...gax.CallOption) *SavedQueryIterator {
   914  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   915  
   916  	hds = append(c.xGoogHeaders, hds...)
   917  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   918  	opts = append((*c.CallOptions).ListSavedQueries[0:len((*c.CallOptions).ListSavedQueries):len((*c.CallOptions).ListSavedQueries)], opts...)
   919  	it := &SavedQueryIterator{}
   920  	req = proto.Clone(req).(*aiplatformpb.ListSavedQueriesRequest)
   921  	it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.SavedQuery, string, error) {
   922  		resp := &aiplatformpb.ListSavedQueriesResponse{}
   923  		if pageToken != "" {
   924  			req.PageToken = pageToken
   925  		}
   926  		if pageSize > math.MaxInt32 {
   927  			req.PageSize = math.MaxInt32
   928  		} else if pageSize != 0 {
   929  			req.PageSize = int32(pageSize)
   930  		}
   931  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   932  			var err error
   933  			resp, err = executeRPC(ctx, c.datasetClient.ListSavedQueries, req, settings.GRPC, c.logger, "ListSavedQueries")
   934  			return err
   935  		}, opts...)
   936  		if err != nil {
   937  			return nil, "", err
   938  		}
   939  
   940  		it.Response = resp
   941  		return resp.GetSavedQueries(), resp.GetNextPageToken(), nil
   942  	}
   943  	fetch := func(pageSize int, pageToken string) (string, error) {
   944  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   945  		if err != nil {
   946  			return "", err
   947  		}
   948  		it.items = append(it.items, items...)
   949  		return nextPageToken, nil
   950  	}
   951  
   952  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   953  	it.pageInfo.MaxSize = int(req.GetPageSize())
   954  	it.pageInfo.Token = req.GetPageToken()
   955  
   956  	return it
   957  }
   958  
   959  func (c *datasetGRPCClient) DeleteSavedQuery(ctx context.Context, req *aiplatformpb.DeleteSavedQueryRequest, opts ...gax.CallOption) (*DeleteSavedQueryOperation, error) {
   960  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   961  
   962  	hds = append(c.xGoogHeaders, hds...)
   963  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   964  	opts = append((*c.CallOptions).DeleteSavedQuery[0:len((*c.CallOptions).DeleteSavedQuery):len((*c.CallOptions).DeleteSavedQuery)], opts...)
   965  	var resp *longrunningpb.Operation
   966  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   967  		var err error
   968  		resp, err = executeRPC(ctx, c.datasetClient.DeleteSavedQuery, req, settings.GRPC, c.logger, "DeleteSavedQuery")
   969  		return err
   970  	}, opts...)
   971  	if err != nil {
   972  		return nil, err
   973  	}
   974  	return &DeleteSavedQueryOperation{
   975  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   976  	}, nil
   977  }
   978  
   979  func (c *datasetGRPCClient) GetAnnotationSpec(ctx context.Context, req *aiplatformpb.GetAnnotationSpecRequest, opts ...gax.CallOption) (*aiplatformpb.AnnotationSpec, error) {
   980  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   981  
   982  	hds = append(c.xGoogHeaders, hds...)
   983  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   984  	opts = append((*c.CallOptions).GetAnnotationSpec[0:len((*c.CallOptions).GetAnnotationSpec):len((*c.CallOptions).GetAnnotationSpec)], opts...)
   985  	var resp *aiplatformpb.AnnotationSpec
   986  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   987  		var err error
   988  		resp, err = executeRPC(ctx, c.datasetClient.GetAnnotationSpec, req, settings.GRPC, c.logger, "GetAnnotationSpec")
   989  		return err
   990  	}, opts...)
   991  	if err != nil {
   992  		return nil, err
   993  	}
   994  	return resp, nil
   995  }
   996  
   997  func (c *datasetGRPCClient) ListAnnotations(ctx context.Context, req *aiplatformpb.ListAnnotationsRequest, opts ...gax.CallOption) *AnnotationIterator {
   998  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   999  
  1000  	hds = append(c.xGoogHeaders, hds...)
  1001  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1002  	opts = append((*c.CallOptions).ListAnnotations[0:len((*c.CallOptions).ListAnnotations):len((*c.CallOptions).ListAnnotations)], opts...)
  1003  	it := &AnnotationIterator{}
  1004  	req = proto.Clone(req).(*aiplatformpb.ListAnnotationsRequest)
  1005  	it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.Annotation, string, error) {
  1006  		resp := &aiplatformpb.ListAnnotationsResponse{}
  1007  		if pageToken != "" {
  1008  			req.PageToken = pageToken
  1009  		}
  1010  		if pageSize > math.MaxInt32 {
  1011  			req.PageSize = math.MaxInt32
  1012  		} else if pageSize != 0 {
  1013  			req.PageSize = int32(pageSize)
  1014  		}
  1015  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1016  			var err error
  1017  			resp, err = executeRPC(ctx, c.datasetClient.ListAnnotations, req, settings.GRPC, c.logger, "ListAnnotations")
  1018  			return err
  1019  		}, opts...)
  1020  		if err != nil {
  1021  			return nil, "", err
  1022  		}
  1023  
  1024  		it.Response = resp
  1025  		return resp.GetAnnotations(), resp.GetNextPageToken(), nil
  1026  	}
  1027  	fetch := func(pageSize int, pageToken string) (string, error) {
  1028  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1029  		if err != nil {
  1030  			return "", err
  1031  		}
  1032  		it.items = append(it.items, items...)
  1033  		return nextPageToken, nil
  1034  	}
  1035  
  1036  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1037  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1038  	it.pageInfo.Token = req.GetPageToken()
  1039  
  1040  	return it
  1041  }
  1042  
  1043  func (c *datasetGRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
  1044  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1045  
  1046  	hds = append(c.xGoogHeaders, hds...)
  1047  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1048  	opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...)
  1049  	var resp *locationpb.Location
  1050  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1051  		var err error
  1052  		resp, err = executeRPC(ctx, c.locationsClient.GetLocation, req, settings.GRPC, c.logger, "GetLocation")
  1053  		return err
  1054  	}, opts...)
  1055  	if err != nil {
  1056  		return nil, err
  1057  	}
  1058  	return resp, nil
  1059  }
  1060  
  1061  func (c *datasetGRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
  1062  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1063  
  1064  	hds = append(c.xGoogHeaders, hds...)
  1065  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1066  	opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...)
  1067  	it := &LocationIterator{}
  1068  	req = proto.Clone(req).(*locationpb.ListLocationsRequest)
  1069  	it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) {
  1070  		resp := &locationpb.ListLocationsResponse{}
  1071  		if pageToken != "" {
  1072  			req.PageToken = pageToken
  1073  		}
  1074  		if pageSize > math.MaxInt32 {
  1075  			req.PageSize = math.MaxInt32
  1076  		} else if pageSize != 0 {
  1077  			req.PageSize = int32(pageSize)
  1078  		}
  1079  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1080  			var err error
  1081  			resp, err = executeRPC(ctx, c.locationsClient.ListLocations, req, settings.GRPC, c.logger, "ListLocations")
  1082  			return err
  1083  		}, opts...)
  1084  		if err != nil {
  1085  			return nil, "", err
  1086  		}
  1087  
  1088  		it.Response = resp
  1089  		return resp.GetLocations(), resp.GetNextPageToken(), nil
  1090  	}
  1091  	fetch := func(pageSize int, pageToken string) (string, error) {
  1092  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1093  		if err != nil {
  1094  			return "", err
  1095  		}
  1096  		it.items = append(it.items, items...)
  1097  		return nextPageToken, nil
  1098  	}
  1099  
  1100  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1101  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1102  	it.pageInfo.Token = req.GetPageToken()
  1103  
  1104  	return it
  1105  }
  1106  
  1107  func (c *datasetGRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
  1108  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
  1109  
  1110  	hds = append(c.xGoogHeaders, hds...)
  1111  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1112  	opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...)
  1113  	var resp *iampb.Policy
  1114  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1115  		var err error
  1116  		resp, err = executeRPC(ctx, c.iamPolicyClient.GetIamPolicy, req, settings.GRPC, c.logger, "GetIamPolicy")
  1117  		return err
  1118  	}, opts...)
  1119  	if err != nil {
  1120  		return nil, err
  1121  	}
  1122  	return resp, nil
  1123  }
  1124  
  1125  func (c *datasetGRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
  1126  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
  1127  
  1128  	hds = append(c.xGoogHeaders, hds...)
  1129  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1130  	opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...)
  1131  	var resp *iampb.Policy
  1132  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1133  		var err error
  1134  		resp, err = executeRPC(ctx, c.iamPolicyClient.SetIamPolicy, req, settings.GRPC, c.logger, "SetIamPolicy")
  1135  		return err
  1136  	}, opts...)
  1137  	if err != nil {
  1138  		return nil, err
  1139  	}
  1140  	return resp, nil
  1141  }
  1142  
  1143  func (c *datasetGRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
  1144  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
  1145  
  1146  	hds = append(c.xGoogHeaders, hds...)
  1147  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1148  	opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...)
  1149  	var resp *iampb.TestIamPermissionsResponse
  1150  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1151  		var err error
  1152  		resp, err = executeRPC(ctx, c.iamPolicyClient.TestIamPermissions, req, settings.GRPC, c.logger, "TestIamPermissions")
  1153  		return err
  1154  	}, opts...)
  1155  	if err != nil {
  1156  		return nil, err
  1157  	}
  1158  	return resp, nil
  1159  }
  1160  
  1161  func (c *datasetGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
  1162  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1163  
  1164  	hds = append(c.xGoogHeaders, hds...)
  1165  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1166  	opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...)
  1167  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1168  		var err error
  1169  		_, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation")
  1170  		return err
  1171  	}, opts...)
  1172  	return err
  1173  }
  1174  
  1175  func (c *datasetGRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
  1176  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1177  
  1178  	hds = append(c.xGoogHeaders, hds...)
  1179  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1180  	opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...)
  1181  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1182  		var err error
  1183  		_, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation")
  1184  		return err
  1185  	}, opts...)
  1186  	return err
  1187  }
  1188  
  1189  func (c *datasetGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
  1190  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1191  
  1192  	hds = append(c.xGoogHeaders, hds...)
  1193  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1194  	opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
  1195  	var resp *longrunningpb.Operation
  1196  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1197  		var err error
  1198  		resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation")
  1199  		return err
  1200  	}, opts...)
  1201  	if err != nil {
  1202  		return nil, err
  1203  	}
  1204  	return resp, nil
  1205  }
  1206  
  1207  func (c *datasetGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
  1208  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1209  
  1210  	hds = append(c.xGoogHeaders, hds...)
  1211  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1212  	opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...)
  1213  	it := &OperationIterator{}
  1214  	req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
  1215  	it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
  1216  		resp := &longrunningpb.ListOperationsResponse{}
  1217  		if pageToken != "" {
  1218  			req.PageToken = pageToken
  1219  		}
  1220  		if pageSize > math.MaxInt32 {
  1221  			req.PageSize = math.MaxInt32
  1222  		} else if pageSize != 0 {
  1223  			req.PageSize = int32(pageSize)
  1224  		}
  1225  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1226  			var err error
  1227  			resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations")
  1228  			return err
  1229  		}, opts...)
  1230  		if err != nil {
  1231  			return nil, "", err
  1232  		}
  1233  
  1234  		it.Response = resp
  1235  		return resp.GetOperations(), resp.GetNextPageToken(), nil
  1236  	}
  1237  	fetch := func(pageSize int, pageToken string) (string, error) {
  1238  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1239  		if err != nil {
  1240  			return "", err
  1241  		}
  1242  		it.items = append(it.items, items...)
  1243  		return nextPageToken, nil
  1244  	}
  1245  
  1246  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1247  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1248  	it.pageInfo.Token = req.GetPageToken()
  1249  
  1250  	return it
  1251  }
  1252  
  1253  func (c *datasetGRPCClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
  1254  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1255  
  1256  	hds = append(c.xGoogHeaders, hds...)
  1257  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1258  	opts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...)
  1259  	var resp *longrunningpb.Operation
  1260  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1261  		var err error
  1262  		resp, err = executeRPC(ctx, c.operationsClient.WaitOperation, req, settings.GRPC, c.logger, "WaitOperation")
  1263  		return err
  1264  	}, opts...)
  1265  	if err != nil {
  1266  		return nil, err
  1267  	}
  1268  	return resp, nil
  1269  }
  1270  
  1271  // CreateDatasetOperation returns a new CreateDatasetOperation from a given name.
  1272  // The name must be that of a previously created CreateDatasetOperation, possibly from a different process.
  1273  func (c *datasetGRPCClient) CreateDatasetOperation(name string) *CreateDatasetOperation {
  1274  	return &CreateDatasetOperation{
  1275  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  1276  	}
  1277  }
  1278  
  1279  // CreateDatasetVersionOperation returns a new CreateDatasetVersionOperation from a given name.
  1280  // The name must be that of a previously created CreateDatasetVersionOperation, possibly from a different process.
  1281  func (c *datasetGRPCClient) CreateDatasetVersionOperation(name string) *CreateDatasetVersionOperation {
  1282  	return &CreateDatasetVersionOperation{
  1283  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  1284  	}
  1285  }
  1286  
  1287  // DeleteDatasetOperation returns a new DeleteDatasetOperation from a given name.
  1288  // The name must be that of a previously created DeleteDatasetOperation, possibly from a different process.
  1289  func (c *datasetGRPCClient) DeleteDatasetOperation(name string) *DeleteDatasetOperation {
  1290  	return &DeleteDatasetOperation{
  1291  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  1292  	}
  1293  }
  1294  
  1295  // DeleteDatasetVersionOperation returns a new DeleteDatasetVersionOperation from a given name.
  1296  // The name must be that of a previously created DeleteDatasetVersionOperation, possibly from a different process.
  1297  func (c *datasetGRPCClient) DeleteDatasetVersionOperation(name string) *DeleteDatasetVersionOperation {
  1298  	return &DeleteDatasetVersionOperation{
  1299  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  1300  	}
  1301  }
  1302  
  1303  // DeleteSavedQueryOperation returns a new DeleteSavedQueryOperation from a given name.
  1304  // The name must be that of a previously created DeleteSavedQueryOperation, possibly from a different process.
  1305  func (c *datasetGRPCClient) DeleteSavedQueryOperation(name string) *DeleteSavedQueryOperation {
  1306  	return &DeleteSavedQueryOperation{
  1307  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  1308  	}
  1309  }
  1310  
  1311  // ExportDataOperation returns a new ExportDataOperation from a given name.
  1312  // The name must be that of a previously created ExportDataOperation, possibly from a different process.
  1313  func (c *datasetGRPCClient) ExportDataOperation(name string) *ExportDataOperation {
  1314  	return &ExportDataOperation{
  1315  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  1316  	}
  1317  }
  1318  
  1319  // ImportDataOperation returns a new ImportDataOperation from a given name.
  1320  // The name must be that of a previously created ImportDataOperation, possibly from a different process.
  1321  func (c *datasetGRPCClient) ImportDataOperation(name string) *ImportDataOperation {
  1322  	return &ImportDataOperation{
  1323  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  1324  	}
  1325  }
  1326  
  1327  // RestoreDatasetVersionOperation returns a new RestoreDatasetVersionOperation from a given name.
  1328  // The name must be that of a previously created RestoreDatasetVersionOperation, possibly from a different process.
  1329  func (c *datasetGRPCClient) RestoreDatasetVersionOperation(name string) *RestoreDatasetVersionOperation {
  1330  	return &RestoreDatasetVersionOperation{
  1331  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  1332  	}
  1333  }