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