cloud.google.com/go/aiplatform@v1.106.0/apiv1beta1/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 "bytes" 21 "context" 22 "fmt" 23 "log/slog" 24 "math" 25 "net/http" 26 "net/url" 27 "time" 28 29 aiplatformpb "cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb" 30 iampb "cloud.google.com/go/iam/apiv1/iampb" 31 "cloud.google.com/go/longrunning" 32 lroauto "cloud.google.com/go/longrunning/autogen" 33 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" 34 gax "github.com/googleapis/gax-go/v2" 35 "google.golang.org/api/iterator" 36 "google.golang.org/api/option" 37 "google.golang.org/api/option/internaloption" 38 gtransport "google.golang.org/api/transport/grpc" 39 httptransport "google.golang.org/api/transport/http" 40 locationpb "google.golang.org/genproto/googleapis/cloud/location" 41 "google.golang.org/grpc" 42 "google.golang.org/protobuf/encoding/protojson" 43 "google.golang.org/protobuf/proto" 44 ) 45 46 var newFeaturestoreClientHook clientHook 47 48 // FeaturestoreCallOptions contains the retry settings for each method of FeaturestoreClient. 49 type FeaturestoreCallOptions struct { 50 CreateFeaturestore []gax.CallOption 51 GetFeaturestore []gax.CallOption 52 ListFeaturestores []gax.CallOption 53 UpdateFeaturestore []gax.CallOption 54 DeleteFeaturestore []gax.CallOption 55 CreateEntityType []gax.CallOption 56 GetEntityType []gax.CallOption 57 ListEntityTypes []gax.CallOption 58 UpdateEntityType []gax.CallOption 59 DeleteEntityType []gax.CallOption 60 CreateFeature []gax.CallOption 61 BatchCreateFeatures []gax.CallOption 62 GetFeature []gax.CallOption 63 ListFeatures []gax.CallOption 64 UpdateFeature []gax.CallOption 65 DeleteFeature []gax.CallOption 66 ImportFeatureValues []gax.CallOption 67 BatchReadFeatureValues []gax.CallOption 68 ExportFeatureValues []gax.CallOption 69 DeleteFeatureValues []gax.CallOption 70 SearchFeatures []gax.CallOption 71 GetLocation []gax.CallOption 72 ListLocations []gax.CallOption 73 GetIamPolicy []gax.CallOption 74 SetIamPolicy []gax.CallOption 75 TestIamPermissions []gax.CallOption 76 CancelOperation []gax.CallOption 77 DeleteOperation []gax.CallOption 78 GetOperation []gax.CallOption 79 ListOperations []gax.CallOption 80 WaitOperation []gax.CallOption 81 } 82 83 func defaultFeaturestoreGRPCClientOptions() []option.ClientOption { 84 return []option.ClientOption{ 85 internaloption.WithDefaultEndpoint("aiplatform.googleapis.com:443"), 86 internaloption.WithDefaultEndpointTemplate("aiplatform.UNIVERSE_DOMAIN:443"), 87 internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"), 88 internaloption.WithDefaultUniverseDomain("googleapis.com"), 89 internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), 90 internaloption.WithDefaultScopes(DefaultAuthScopes()...), 91 internaloption.EnableJwtWithScope(), 92 internaloption.EnableNewAuthLibrary(), 93 option.WithGRPCDialOption(grpc.WithDefaultCallOptions( 94 grpc.MaxCallRecvMsgSize(math.MaxInt32))), 95 } 96 } 97 98 func defaultFeaturestoreCallOptions() *FeaturestoreCallOptions { 99 return &FeaturestoreCallOptions{ 100 CreateFeaturestore: []gax.CallOption{ 101 gax.WithTimeout(5000 * time.Millisecond), 102 }, 103 GetFeaturestore: []gax.CallOption{ 104 gax.WithTimeout(5000 * time.Millisecond), 105 }, 106 ListFeaturestores: []gax.CallOption{ 107 gax.WithTimeout(5000 * time.Millisecond), 108 }, 109 UpdateFeaturestore: []gax.CallOption{ 110 gax.WithTimeout(5000 * time.Millisecond), 111 }, 112 DeleteFeaturestore: []gax.CallOption{ 113 gax.WithTimeout(5000 * time.Millisecond), 114 }, 115 CreateEntityType: []gax.CallOption{ 116 gax.WithTimeout(5000 * time.Millisecond), 117 }, 118 GetEntityType: []gax.CallOption{ 119 gax.WithTimeout(5000 * time.Millisecond), 120 }, 121 ListEntityTypes: []gax.CallOption{ 122 gax.WithTimeout(5000 * time.Millisecond), 123 }, 124 UpdateEntityType: []gax.CallOption{ 125 gax.WithTimeout(5000 * time.Millisecond), 126 }, 127 DeleteEntityType: []gax.CallOption{ 128 gax.WithTimeout(5000 * time.Millisecond), 129 }, 130 CreateFeature: []gax.CallOption{ 131 gax.WithTimeout(5000 * time.Millisecond), 132 }, 133 BatchCreateFeatures: []gax.CallOption{ 134 gax.WithTimeout(5000 * time.Millisecond), 135 }, 136 GetFeature: []gax.CallOption{ 137 gax.WithTimeout(5000 * time.Millisecond), 138 }, 139 ListFeatures: []gax.CallOption{ 140 gax.WithTimeout(5000 * time.Millisecond), 141 }, 142 UpdateFeature: []gax.CallOption{ 143 gax.WithTimeout(5000 * time.Millisecond), 144 }, 145 DeleteFeature: []gax.CallOption{ 146 gax.WithTimeout(5000 * time.Millisecond), 147 }, 148 ImportFeatureValues: []gax.CallOption{ 149 gax.WithTimeout(5000 * time.Millisecond), 150 }, 151 BatchReadFeatureValues: []gax.CallOption{ 152 gax.WithTimeout(5000 * time.Millisecond), 153 }, 154 ExportFeatureValues: []gax.CallOption{}, 155 DeleteFeatureValues: []gax.CallOption{}, 156 SearchFeatures: []gax.CallOption{ 157 gax.WithTimeout(5000 * time.Millisecond), 158 }, 159 GetLocation: []gax.CallOption{}, 160 ListLocations: []gax.CallOption{}, 161 GetIamPolicy: []gax.CallOption{}, 162 SetIamPolicy: []gax.CallOption{}, 163 TestIamPermissions: []gax.CallOption{}, 164 CancelOperation: []gax.CallOption{}, 165 DeleteOperation: []gax.CallOption{}, 166 GetOperation: []gax.CallOption{}, 167 ListOperations: []gax.CallOption{}, 168 WaitOperation: []gax.CallOption{}, 169 } 170 } 171 172 func defaultFeaturestoreRESTCallOptions() *FeaturestoreCallOptions { 173 return &FeaturestoreCallOptions{ 174 CreateFeaturestore: []gax.CallOption{ 175 gax.WithTimeout(5000 * time.Millisecond), 176 }, 177 GetFeaturestore: []gax.CallOption{ 178 gax.WithTimeout(5000 * time.Millisecond), 179 }, 180 ListFeaturestores: []gax.CallOption{ 181 gax.WithTimeout(5000 * time.Millisecond), 182 }, 183 UpdateFeaturestore: []gax.CallOption{ 184 gax.WithTimeout(5000 * time.Millisecond), 185 }, 186 DeleteFeaturestore: []gax.CallOption{ 187 gax.WithTimeout(5000 * time.Millisecond), 188 }, 189 CreateEntityType: []gax.CallOption{ 190 gax.WithTimeout(5000 * time.Millisecond), 191 }, 192 GetEntityType: []gax.CallOption{ 193 gax.WithTimeout(5000 * time.Millisecond), 194 }, 195 ListEntityTypes: []gax.CallOption{ 196 gax.WithTimeout(5000 * time.Millisecond), 197 }, 198 UpdateEntityType: []gax.CallOption{ 199 gax.WithTimeout(5000 * time.Millisecond), 200 }, 201 DeleteEntityType: []gax.CallOption{ 202 gax.WithTimeout(5000 * time.Millisecond), 203 }, 204 CreateFeature: []gax.CallOption{ 205 gax.WithTimeout(5000 * time.Millisecond), 206 }, 207 BatchCreateFeatures: []gax.CallOption{ 208 gax.WithTimeout(5000 * time.Millisecond), 209 }, 210 GetFeature: []gax.CallOption{ 211 gax.WithTimeout(5000 * time.Millisecond), 212 }, 213 ListFeatures: []gax.CallOption{ 214 gax.WithTimeout(5000 * time.Millisecond), 215 }, 216 UpdateFeature: []gax.CallOption{ 217 gax.WithTimeout(5000 * time.Millisecond), 218 }, 219 DeleteFeature: []gax.CallOption{ 220 gax.WithTimeout(5000 * time.Millisecond), 221 }, 222 ImportFeatureValues: []gax.CallOption{ 223 gax.WithTimeout(5000 * time.Millisecond), 224 }, 225 BatchReadFeatureValues: []gax.CallOption{ 226 gax.WithTimeout(5000 * time.Millisecond), 227 }, 228 ExportFeatureValues: []gax.CallOption{}, 229 DeleteFeatureValues: []gax.CallOption{}, 230 SearchFeatures: []gax.CallOption{ 231 gax.WithTimeout(5000 * time.Millisecond), 232 }, 233 GetLocation: []gax.CallOption{}, 234 ListLocations: []gax.CallOption{}, 235 GetIamPolicy: []gax.CallOption{}, 236 SetIamPolicy: []gax.CallOption{}, 237 TestIamPermissions: []gax.CallOption{}, 238 CancelOperation: []gax.CallOption{}, 239 DeleteOperation: []gax.CallOption{}, 240 GetOperation: []gax.CallOption{}, 241 ListOperations: []gax.CallOption{}, 242 WaitOperation: []gax.CallOption{}, 243 } 244 } 245 246 // internalFeaturestoreClient is an interface that defines the methods available from Vertex AI API. 247 type internalFeaturestoreClient interface { 248 Close() error 249 setGoogleClientInfo(...string) 250 Connection() *grpc.ClientConn 251 CreateFeaturestore(context.Context, *aiplatformpb.CreateFeaturestoreRequest, ...gax.CallOption) (*CreateFeaturestoreOperation, error) 252 CreateFeaturestoreOperation(name string) *CreateFeaturestoreOperation 253 GetFeaturestore(context.Context, *aiplatformpb.GetFeaturestoreRequest, ...gax.CallOption) (*aiplatformpb.Featurestore, error) 254 ListFeaturestores(context.Context, *aiplatformpb.ListFeaturestoresRequest, ...gax.CallOption) *FeaturestoreIterator 255 UpdateFeaturestore(context.Context, *aiplatformpb.UpdateFeaturestoreRequest, ...gax.CallOption) (*UpdateFeaturestoreOperation, error) 256 UpdateFeaturestoreOperation(name string) *UpdateFeaturestoreOperation 257 DeleteFeaturestore(context.Context, *aiplatformpb.DeleteFeaturestoreRequest, ...gax.CallOption) (*DeleteFeaturestoreOperation, error) 258 DeleteFeaturestoreOperation(name string) *DeleteFeaturestoreOperation 259 CreateEntityType(context.Context, *aiplatformpb.CreateEntityTypeRequest, ...gax.CallOption) (*CreateEntityTypeOperation, error) 260 CreateEntityTypeOperation(name string) *CreateEntityTypeOperation 261 GetEntityType(context.Context, *aiplatformpb.GetEntityTypeRequest, ...gax.CallOption) (*aiplatformpb.EntityType, error) 262 ListEntityTypes(context.Context, *aiplatformpb.ListEntityTypesRequest, ...gax.CallOption) *EntityTypeIterator 263 UpdateEntityType(context.Context, *aiplatformpb.UpdateEntityTypeRequest, ...gax.CallOption) (*aiplatformpb.EntityType, error) 264 DeleteEntityType(context.Context, *aiplatformpb.DeleteEntityTypeRequest, ...gax.CallOption) (*DeleteEntityTypeOperation, error) 265 DeleteEntityTypeOperation(name string) *DeleteEntityTypeOperation 266 CreateFeature(context.Context, *aiplatformpb.CreateFeatureRequest, ...gax.CallOption) (*CreateFeatureOperation, error) 267 CreateFeatureOperation(name string) *CreateFeatureOperation 268 BatchCreateFeatures(context.Context, *aiplatformpb.BatchCreateFeaturesRequest, ...gax.CallOption) (*BatchCreateFeaturesOperation, error) 269 BatchCreateFeaturesOperation(name string) *BatchCreateFeaturesOperation 270 GetFeature(context.Context, *aiplatformpb.GetFeatureRequest, ...gax.CallOption) (*aiplatformpb.Feature, error) 271 ListFeatures(context.Context, *aiplatformpb.ListFeaturesRequest, ...gax.CallOption) *FeatureIterator 272 UpdateFeature(context.Context, *aiplatformpb.UpdateFeatureRequest, ...gax.CallOption) (*aiplatformpb.Feature, error) 273 DeleteFeature(context.Context, *aiplatformpb.DeleteFeatureRequest, ...gax.CallOption) (*DeleteFeatureOperation, error) 274 DeleteFeatureOperation(name string) *DeleteFeatureOperation 275 ImportFeatureValues(context.Context, *aiplatformpb.ImportFeatureValuesRequest, ...gax.CallOption) (*ImportFeatureValuesOperation, error) 276 ImportFeatureValuesOperation(name string) *ImportFeatureValuesOperation 277 BatchReadFeatureValues(context.Context, *aiplatformpb.BatchReadFeatureValuesRequest, ...gax.CallOption) (*BatchReadFeatureValuesOperation, error) 278 BatchReadFeatureValuesOperation(name string) *BatchReadFeatureValuesOperation 279 ExportFeatureValues(context.Context, *aiplatformpb.ExportFeatureValuesRequest, ...gax.CallOption) (*ExportFeatureValuesOperation, error) 280 ExportFeatureValuesOperation(name string) *ExportFeatureValuesOperation 281 DeleteFeatureValues(context.Context, *aiplatformpb.DeleteFeatureValuesRequest, ...gax.CallOption) (*DeleteFeatureValuesOperation, error) 282 DeleteFeatureValuesOperation(name string) *DeleteFeatureValuesOperation 283 SearchFeatures(context.Context, *aiplatformpb.SearchFeaturesRequest, ...gax.CallOption) *FeatureIterator 284 GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error) 285 ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator 286 GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) 287 SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) 288 TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) 289 CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error 290 DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error 291 GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error) 292 ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator 293 WaitOperation(context.Context, *longrunningpb.WaitOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error) 294 } 295 296 // FeaturestoreClient is a client for interacting with Vertex AI API. 297 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. 298 // 299 // The service that handles CRUD and List for resources for Featurestore. 300 type FeaturestoreClient struct { 301 // The internal transport-dependent client. 302 internalClient internalFeaturestoreClient 303 304 // The call options for this service. 305 CallOptions *FeaturestoreCallOptions 306 307 // LROClient is used internally to handle long-running operations. 308 // It is exposed so that its CallOptions can be modified if required. 309 // Users should not Close this client. 310 LROClient *lroauto.OperationsClient 311 } 312 313 // Wrapper methods routed to the internal client. 314 315 // Close closes the connection to the API service. The user should invoke this when 316 // the client is no longer required. 317 func (c *FeaturestoreClient) Close() error { 318 return c.internalClient.Close() 319 } 320 321 // setGoogleClientInfo sets the name and version of the application in 322 // the `x-goog-api-client` header passed on each request. Intended for 323 // use by Google-written clients. 324 func (c *FeaturestoreClient) setGoogleClientInfo(keyval ...string) { 325 c.internalClient.setGoogleClientInfo(keyval...) 326 } 327 328 // Connection returns a connection to the API service. 329 // 330 // Deprecated: Connections are now pooled so this method does not always 331 // return the same resource. 332 func (c *FeaturestoreClient) Connection() *grpc.ClientConn { 333 return c.internalClient.Connection() 334 } 335 336 // CreateFeaturestore creates a new Featurestore in a given project and location. 337 func (c *FeaturestoreClient) CreateFeaturestore(ctx context.Context, req *aiplatformpb.CreateFeaturestoreRequest, opts ...gax.CallOption) (*CreateFeaturestoreOperation, error) { 338 return c.internalClient.CreateFeaturestore(ctx, req, opts...) 339 } 340 341 // CreateFeaturestoreOperation returns a new CreateFeaturestoreOperation from a given name. 342 // The name must be that of a previously created CreateFeaturestoreOperation, possibly from a different process. 343 func (c *FeaturestoreClient) CreateFeaturestoreOperation(name string) *CreateFeaturestoreOperation { 344 return c.internalClient.CreateFeaturestoreOperation(name) 345 } 346 347 // GetFeaturestore gets details of a single Featurestore. 348 func (c *FeaturestoreClient) GetFeaturestore(ctx context.Context, req *aiplatformpb.GetFeaturestoreRequest, opts ...gax.CallOption) (*aiplatformpb.Featurestore, error) { 349 return c.internalClient.GetFeaturestore(ctx, req, opts...) 350 } 351 352 // ListFeaturestores lists Featurestores in a given project and location. 353 func (c *FeaturestoreClient) ListFeaturestores(ctx context.Context, req *aiplatformpb.ListFeaturestoresRequest, opts ...gax.CallOption) *FeaturestoreIterator { 354 return c.internalClient.ListFeaturestores(ctx, req, opts...) 355 } 356 357 // UpdateFeaturestore updates the parameters of a single Featurestore. 358 func (c *FeaturestoreClient) UpdateFeaturestore(ctx context.Context, req *aiplatformpb.UpdateFeaturestoreRequest, opts ...gax.CallOption) (*UpdateFeaturestoreOperation, error) { 359 return c.internalClient.UpdateFeaturestore(ctx, req, opts...) 360 } 361 362 // UpdateFeaturestoreOperation returns a new UpdateFeaturestoreOperation from a given name. 363 // The name must be that of a previously created UpdateFeaturestoreOperation, possibly from a different process. 364 func (c *FeaturestoreClient) UpdateFeaturestoreOperation(name string) *UpdateFeaturestoreOperation { 365 return c.internalClient.UpdateFeaturestoreOperation(name) 366 } 367 368 // DeleteFeaturestore deletes a single Featurestore. The Featurestore must not contain any 369 // EntityTypes or force must be set to true for the request to succeed. 370 func (c *FeaturestoreClient) DeleteFeaturestore(ctx context.Context, req *aiplatformpb.DeleteFeaturestoreRequest, opts ...gax.CallOption) (*DeleteFeaturestoreOperation, error) { 371 return c.internalClient.DeleteFeaturestore(ctx, req, opts...) 372 } 373 374 // DeleteFeaturestoreOperation returns a new DeleteFeaturestoreOperation from a given name. 375 // The name must be that of a previously created DeleteFeaturestoreOperation, possibly from a different process. 376 func (c *FeaturestoreClient) DeleteFeaturestoreOperation(name string) *DeleteFeaturestoreOperation { 377 return c.internalClient.DeleteFeaturestoreOperation(name) 378 } 379 380 // CreateEntityType creates a new EntityType in a given Featurestore. 381 func (c *FeaturestoreClient) CreateEntityType(ctx context.Context, req *aiplatformpb.CreateEntityTypeRequest, opts ...gax.CallOption) (*CreateEntityTypeOperation, error) { 382 return c.internalClient.CreateEntityType(ctx, req, opts...) 383 } 384 385 // CreateEntityTypeOperation returns a new CreateEntityTypeOperation from a given name. 386 // The name must be that of a previously created CreateEntityTypeOperation, possibly from a different process. 387 func (c *FeaturestoreClient) CreateEntityTypeOperation(name string) *CreateEntityTypeOperation { 388 return c.internalClient.CreateEntityTypeOperation(name) 389 } 390 391 // GetEntityType gets details of a single EntityType. 392 func (c *FeaturestoreClient) GetEntityType(ctx context.Context, req *aiplatformpb.GetEntityTypeRequest, opts ...gax.CallOption) (*aiplatformpb.EntityType, error) { 393 return c.internalClient.GetEntityType(ctx, req, opts...) 394 } 395 396 // ListEntityTypes lists EntityTypes in a given Featurestore. 397 func (c *FeaturestoreClient) ListEntityTypes(ctx context.Context, req *aiplatformpb.ListEntityTypesRequest, opts ...gax.CallOption) *EntityTypeIterator { 398 return c.internalClient.ListEntityTypes(ctx, req, opts...) 399 } 400 401 // UpdateEntityType updates the parameters of a single EntityType. 402 func (c *FeaturestoreClient) UpdateEntityType(ctx context.Context, req *aiplatformpb.UpdateEntityTypeRequest, opts ...gax.CallOption) (*aiplatformpb.EntityType, error) { 403 return c.internalClient.UpdateEntityType(ctx, req, opts...) 404 } 405 406 // DeleteEntityType deletes a single EntityType. The EntityType must not have any Features 407 // or force must be set to true for the request to succeed. 408 func (c *FeaturestoreClient) DeleteEntityType(ctx context.Context, req *aiplatformpb.DeleteEntityTypeRequest, opts ...gax.CallOption) (*DeleteEntityTypeOperation, error) { 409 return c.internalClient.DeleteEntityType(ctx, req, opts...) 410 } 411 412 // DeleteEntityTypeOperation returns a new DeleteEntityTypeOperation from a given name. 413 // The name must be that of a previously created DeleteEntityTypeOperation, possibly from a different process. 414 func (c *FeaturestoreClient) DeleteEntityTypeOperation(name string) *DeleteEntityTypeOperation { 415 return c.internalClient.DeleteEntityTypeOperation(name) 416 } 417 418 // CreateFeature creates a new Feature in a given EntityType. 419 func (c *FeaturestoreClient) CreateFeature(ctx context.Context, req *aiplatformpb.CreateFeatureRequest, opts ...gax.CallOption) (*CreateFeatureOperation, error) { 420 return c.internalClient.CreateFeature(ctx, req, opts...) 421 } 422 423 // CreateFeatureOperation returns a new CreateFeatureOperation from a given name. 424 // The name must be that of a previously created CreateFeatureOperation, possibly from a different process. 425 func (c *FeaturestoreClient) CreateFeatureOperation(name string) *CreateFeatureOperation { 426 return c.internalClient.CreateFeatureOperation(name) 427 } 428 429 // BatchCreateFeatures creates a batch of Features in a given EntityType. 430 func (c *FeaturestoreClient) BatchCreateFeatures(ctx context.Context, req *aiplatformpb.BatchCreateFeaturesRequest, opts ...gax.CallOption) (*BatchCreateFeaturesOperation, error) { 431 return c.internalClient.BatchCreateFeatures(ctx, req, opts...) 432 } 433 434 // BatchCreateFeaturesOperation returns a new BatchCreateFeaturesOperation from a given name. 435 // The name must be that of a previously created BatchCreateFeaturesOperation, possibly from a different process. 436 func (c *FeaturestoreClient) BatchCreateFeaturesOperation(name string) *BatchCreateFeaturesOperation { 437 return c.internalClient.BatchCreateFeaturesOperation(name) 438 } 439 440 // GetFeature gets details of a single Feature. 441 func (c *FeaturestoreClient) GetFeature(ctx context.Context, req *aiplatformpb.GetFeatureRequest, opts ...gax.CallOption) (*aiplatformpb.Feature, error) { 442 return c.internalClient.GetFeature(ctx, req, opts...) 443 } 444 445 // ListFeatures lists Features in a given EntityType. 446 func (c *FeaturestoreClient) ListFeatures(ctx context.Context, req *aiplatformpb.ListFeaturesRequest, opts ...gax.CallOption) *FeatureIterator { 447 return c.internalClient.ListFeatures(ctx, req, opts...) 448 } 449 450 // UpdateFeature updates the parameters of a single Feature. 451 func (c *FeaturestoreClient) UpdateFeature(ctx context.Context, req *aiplatformpb.UpdateFeatureRequest, opts ...gax.CallOption) (*aiplatformpb.Feature, error) { 452 return c.internalClient.UpdateFeature(ctx, req, opts...) 453 } 454 455 // DeleteFeature deletes a single Feature. 456 func (c *FeaturestoreClient) DeleteFeature(ctx context.Context, req *aiplatformpb.DeleteFeatureRequest, opts ...gax.CallOption) (*DeleteFeatureOperation, error) { 457 return c.internalClient.DeleteFeature(ctx, req, opts...) 458 } 459 460 // DeleteFeatureOperation returns a new DeleteFeatureOperation from a given name. 461 // The name must be that of a previously created DeleteFeatureOperation, possibly from a different process. 462 func (c *FeaturestoreClient) DeleteFeatureOperation(name string) *DeleteFeatureOperation { 463 return c.internalClient.DeleteFeatureOperation(name) 464 } 465 466 // ImportFeatureValues imports Feature values into the Featurestore from a source storage. 467 // 468 // The progress of the import is tracked by the returned operation. The 469 // imported features are guaranteed to be visible to subsequent read 470 // operations after the operation is marked as successfully done. 471 // 472 // If an import operation fails, the Feature values returned from 473 // reads and exports may be inconsistent. If consistency is 474 // required, the caller must retry the same import request again and wait till 475 // the new operation returned is marked as successfully done. 476 // 477 // There are also scenarios where the caller can cause inconsistency. 478 // 479 // Source data for import contains multiple distinct Feature values for 480 // the same entity ID and timestamp. 481 // 482 // Source is modified during an import. This includes adding, updating, or 483 // removing source data and/or metadata. Examples of updating metadata 484 // include but are not limited to changing storage location, storage class, 485 // or retention policy. 486 // 487 // Online serving cluster is under-provisioned. 488 func (c *FeaturestoreClient) ImportFeatureValues(ctx context.Context, req *aiplatformpb.ImportFeatureValuesRequest, opts ...gax.CallOption) (*ImportFeatureValuesOperation, error) { 489 return c.internalClient.ImportFeatureValues(ctx, req, opts...) 490 } 491 492 // ImportFeatureValuesOperation returns a new ImportFeatureValuesOperation from a given name. 493 // The name must be that of a previously created ImportFeatureValuesOperation, possibly from a different process. 494 func (c *FeaturestoreClient) ImportFeatureValuesOperation(name string) *ImportFeatureValuesOperation { 495 return c.internalClient.ImportFeatureValuesOperation(name) 496 } 497 498 // BatchReadFeatureValues batch reads Feature values from a Featurestore. 499 // 500 // This API enables batch reading Feature values, where each read 501 // instance in the batch may read Feature values of entities from one or 502 // more EntityTypes. Point-in-time correctness is guaranteed for Feature 503 // values of each read instance as of each instance’s read timestamp. 504 func (c *FeaturestoreClient) BatchReadFeatureValues(ctx context.Context, req *aiplatformpb.BatchReadFeatureValuesRequest, opts ...gax.CallOption) (*BatchReadFeatureValuesOperation, error) { 505 return c.internalClient.BatchReadFeatureValues(ctx, req, opts...) 506 } 507 508 // BatchReadFeatureValuesOperation returns a new BatchReadFeatureValuesOperation from a given name. 509 // The name must be that of a previously created BatchReadFeatureValuesOperation, possibly from a different process. 510 func (c *FeaturestoreClient) BatchReadFeatureValuesOperation(name string) *BatchReadFeatureValuesOperation { 511 return c.internalClient.BatchReadFeatureValuesOperation(name) 512 } 513 514 // ExportFeatureValues exports Feature values from all the entities of a target EntityType. 515 func (c *FeaturestoreClient) ExportFeatureValues(ctx context.Context, req *aiplatformpb.ExportFeatureValuesRequest, opts ...gax.CallOption) (*ExportFeatureValuesOperation, error) { 516 return c.internalClient.ExportFeatureValues(ctx, req, opts...) 517 } 518 519 // ExportFeatureValuesOperation returns a new ExportFeatureValuesOperation from a given name. 520 // The name must be that of a previously created ExportFeatureValuesOperation, possibly from a different process. 521 func (c *FeaturestoreClient) ExportFeatureValuesOperation(name string) *ExportFeatureValuesOperation { 522 return c.internalClient.ExportFeatureValuesOperation(name) 523 } 524 525 // DeleteFeatureValues delete Feature values from Featurestore. 526 // 527 // The progress of the deletion is tracked by the returned operation. The 528 // deleted feature values are guaranteed to be invisible to subsequent read 529 // operations after the operation is marked as successfully done. 530 // 531 // If a delete feature values operation fails, the feature values 532 // returned from reads and exports may be inconsistent. If consistency is 533 // required, the caller must retry the same delete request again and wait till 534 // the new operation returned is marked as successfully done. 535 func (c *FeaturestoreClient) DeleteFeatureValues(ctx context.Context, req *aiplatformpb.DeleteFeatureValuesRequest, opts ...gax.CallOption) (*DeleteFeatureValuesOperation, error) { 536 return c.internalClient.DeleteFeatureValues(ctx, req, opts...) 537 } 538 539 // DeleteFeatureValuesOperation returns a new DeleteFeatureValuesOperation from a given name. 540 // The name must be that of a previously created DeleteFeatureValuesOperation, possibly from a different process. 541 func (c *FeaturestoreClient) DeleteFeatureValuesOperation(name string) *DeleteFeatureValuesOperation { 542 return c.internalClient.DeleteFeatureValuesOperation(name) 543 } 544 545 // SearchFeatures searches Features matching a query in a given project. 546 func (c *FeaturestoreClient) SearchFeatures(ctx context.Context, req *aiplatformpb.SearchFeaturesRequest, opts ...gax.CallOption) *FeatureIterator { 547 return c.internalClient.SearchFeatures(ctx, req, opts...) 548 } 549 550 // GetLocation gets information about a location. 551 func (c *FeaturestoreClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { 552 return c.internalClient.GetLocation(ctx, req, opts...) 553 } 554 555 // ListLocations lists information about the supported locations for this service. 556 func (c *FeaturestoreClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { 557 return c.internalClient.ListLocations(ctx, req, opts...) 558 } 559 560 // GetIamPolicy gets the access control policy for a resource. Returns an empty policy 561 // if the resource exists and does not have a policy set. 562 func (c *FeaturestoreClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 563 return c.internalClient.GetIamPolicy(ctx, req, opts...) 564 } 565 566 // SetIamPolicy sets the access control policy on the specified resource. Replaces 567 // any existing policy. 568 // 569 // Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED 570 // errors. 571 func (c *FeaturestoreClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 572 return c.internalClient.SetIamPolicy(ctx, req, opts...) 573 } 574 575 // TestIamPermissions returns permissions that a caller has on the specified resource. If the 576 // resource does not exist, this will return an empty set of 577 // permissions, not a NOT_FOUND error. 578 // 579 // Note: This operation is designed to be used for building 580 // permission-aware UIs and command-line tools, not for authorization 581 // checking. This operation may “fail open” without warning. 582 func (c *FeaturestoreClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { 583 return c.internalClient.TestIamPermissions(ctx, req, opts...) 584 } 585 586 // CancelOperation is a utility method from google.longrunning.Operations. 587 func (c *FeaturestoreClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { 588 return c.internalClient.CancelOperation(ctx, req, opts...) 589 } 590 591 // DeleteOperation is a utility method from google.longrunning.Operations. 592 func (c *FeaturestoreClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { 593 return c.internalClient.DeleteOperation(ctx, req, opts...) 594 } 595 596 // GetOperation is a utility method from google.longrunning.Operations. 597 func (c *FeaturestoreClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 598 return c.internalClient.GetOperation(ctx, req, opts...) 599 } 600 601 // ListOperations is a utility method from google.longrunning.Operations. 602 func (c *FeaturestoreClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { 603 return c.internalClient.ListOperations(ctx, req, opts...) 604 } 605 606 // WaitOperation is a utility method from google.longrunning.Operations. 607 func (c *FeaturestoreClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 608 return c.internalClient.WaitOperation(ctx, req, opts...) 609 } 610 611 // featurestoreGRPCClient is a client for interacting with Vertex AI API over gRPC transport. 612 // 613 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. 614 type featurestoreGRPCClient struct { 615 // Connection pool of gRPC connections to the service. 616 connPool gtransport.ConnPool 617 618 // Points back to the CallOptions field of the containing FeaturestoreClient 619 CallOptions **FeaturestoreCallOptions 620 621 // The gRPC API client. 622 featurestoreClient aiplatformpb.FeaturestoreServiceClient 623 624 // LROClient is used internally to handle long-running operations. 625 // It is exposed so that its CallOptions can be modified if required. 626 // Users should not Close this client. 627 LROClient **lroauto.OperationsClient 628 629 operationsClient longrunningpb.OperationsClient 630 631 iamPolicyClient iampb.IAMPolicyClient 632 633 locationsClient locationpb.LocationsClient 634 635 // The x-goog-* metadata to be sent with each request. 636 xGoogHeaders []string 637 638 logger *slog.Logger 639 } 640 641 // NewFeaturestoreClient creates a new featurestore service client based on gRPC. 642 // The returned client must be Closed when it is done being used to clean up its underlying connections. 643 // 644 // The service that handles CRUD and List for resources for Featurestore. 645 func NewFeaturestoreClient(ctx context.Context, opts ...option.ClientOption) (*FeaturestoreClient, error) { 646 clientOpts := defaultFeaturestoreGRPCClientOptions() 647 if newFeaturestoreClientHook != nil { 648 hookOpts, err := newFeaturestoreClientHook(ctx, clientHookParams{}) 649 if err != nil { 650 return nil, err 651 } 652 clientOpts = append(clientOpts, hookOpts...) 653 } 654 655 connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) 656 if err != nil { 657 return nil, err 658 } 659 client := FeaturestoreClient{CallOptions: defaultFeaturestoreCallOptions()} 660 661 c := &featurestoreGRPCClient{ 662 connPool: connPool, 663 featurestoreClient: aiplatformpb.NewFeaturestoreServiceClient(connPool), 664 CallOptions: &client.CallOptions, 665 logger: internaloption.GetLogger(opts), 666 operationsClient: longrunningpb.NewOperationsClient(connPool), 667 iamPolicyClient: iampb.NewIAMPolicyClient(connPool), 668 locationsClient: locationpb.NewLocationsClient(connPool), 669 } 670 c.setGoogleClientInfo() 671 672 client.internalClient = c 673 674 client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool)) 675 if err != nil { 676 // This error "should not happen", since we are just reusing old connection pool 677 // and never actually need to dial. 678 // If this does happen, we could leak connp. However, we cannot close conn: 679 // If the user invoked the constructor with option.WithGRPCConn, 680 // we would close a connection that's still in use. 681 // TODO: investigate error conditions. 682 return nil, err 683 } 684 c.LROClient = &client.LROClient 685 return &client, nil 686 } 687 688 // Connection returns a connection to the API service. 689 // 690 // Deprecated: Connections are now pooled so this method does not always 691 // return the same resource. 692 func (c *featurestoreGRPCClient) Connection() *grpc.ClientConn { 693 return c.connPool.Conn() 694 } 695 696 // setGoogleClientInfo sets the name and version of the application in 697 // the `x-goog-api-client` header passed on each request. Intended for 698 // use by Google-written clients. 699 func (c *featurestoreGRPCClient) setGoogleClientInfo(keyval ...string) { 700 kv := append([]string{"gl-go", gax.GoVersion}, keyval...) 701 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion) 702 c.xGoogHeaders = []string{ 703 "x-goog-api-client", gax.XGoogHeader(kv...), 704 } 705 } 706 707 // Close closes the connection to the API service. The user should invoke this when 708 // the client is no longer required. 709 func (c *featurestoreGRPCClient) Close() error { 710 return c.connPool.Close() 711 } 712 713 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. 714 type featurestoreRESTClient struct { 715 // The http endpoint to connect to. 716 endpoint string 717 718 // The http client. 719 httpClient *http.Client 720 721 // LROClient is used internally to handle long-running operations. 722 // It is exposed so that its CallOptions can be modified if required. 723 // Users should not Close this client. 724 LROClient **lroauto.OperationsClient 725 726 // The x-goog-* headers to be sent with each request. 727 xGoogHeaders []string 728 729 // Points back to the CallOptions field of the containing FeaturestoreClient 730 CallOptions **FeaturestoreCallOptions 731 732 logger *slog.Logger 733 } 734 735 // NewFeaturestoreRESTClient creates a new featurestore service rest client. 736 // 737 // The service that handles CRUD and List for resources for Featurestore. 738 func NewFeaturestoreRESTClient(ctx context.Context, opts ...option.ClientOption) (*FeaturestoreClient, error) { 739 clientOpts := append(defaultFeaturestoreRESTClientOptions(), opts...) 740 httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) 741 if err != nil { 742 return nil, err 743 } 744 745 callOpts := defaultFeaturestoreRESTCallOptions() 746 c := &featurestoreRESTClient{ 747 endpoint: endpoint, 748 httpClient: httpClient, 749 CallOptions: &callOpts, 750 logger: internaloption.GetLogger(opts), 751 } 752 c.setGoogleClientInfo() 753 754 lroOpts := []option.ClientOption{ 755 option.WithHTTPClient(httpClient), 756 option.WithEndpoint(endpoint), 757 } 758 opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...) 759 if err != nil { 760 return nil, err 761 } 762 c.LROClient = &opClient 763 764 return &FeaturestoreClient{internalClient: c, CallOptions: callOpts}, nil 765 } 766 767 func defaultFeaturestoreRESTClientOptions() []option.ClientOption { 768 return []option.ClientOption{ 769 internaloption.WithDefaultEndpoint("https://aiplatform.googleapis.com"), 770 internaloption.WithDefaultEndpointTemplate("https://aiplatform.UNIVERSE_DOMAIN"), 771 internaloption.WithDefaultMTLSEndpoint("https://aiplatform.mtls.googleapis.com"), 772 internaloption.WithDefaultUniverseDomain("googleapis.com"), 773 internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), 774 internaloption.WithDefaultScopes(DefaultAuthScopes()...), 775 internaloption.EnableNewAuthLibrary(), 776 } 777 } 778 779 // setGoogleClientInfo sets the name and version of the application in 780 // the `x-goog-api-client` header passed on each request. Intended for 781 // use by Google-written clients. 782 func (c *featurestoreRESTClient) setGoogleClientInfo(keyval ...string) { 783 kv := append([]string{"gl-go", gax.GoVersion}, keyval...) 784 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN", "pb", protoVersion) 785 c.xGoogHeaders = []string{ 786 "x-goog-api-client", gax.XGoogHeader(kv...), 787 } 788 } 789 790 // Close closes the connection to the API service. The user should invoke this when 791 // the client is no longer required. 792 func (c *featurestoreRESTClient) Close() error { 793 // Replace httpClient with nil to force cleanup. 794 c.httpClient = nil 795 return nil 796 } 797 798 // Connection returns a connection to the API service. 799 // 800 // Deprecated: This method always returns nil. 801 func (c *featurestoreRESTClient) Connection() *grpc.ClientConn { 802 return nil 803 } 804 func (c *featurestoreGRPCClient) CreateFeaturestore(ctx context.Context, req *aiplatformpb.CreateFeaturestoreRequest, opts ...gax.CallOption) (*CreateFeaturestoreOperation, error) { 805 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 806 807 hds = append(c.xGoogHeaders, hds...) 808 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 809 opts = append((*c.CallOptions).CreateFeaturestore[0:len((*c.CallOptions).CreateFeaturestore):len((*c.CallOptions).CreateFeaturestore)], opts...) 810 var resp *longrunningpb.Operation 811 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 812 var err error 813 resp, err = executeRPC(ctx, c.featurestoreClient.CreateFeaturestore, req, settings.GRPC, c.logger, "CreateFeaturestore") 814 return err 815 }, opts...) 816 if err != nil { 817 return nil, err 818 } 819 return &CreateFeaturestoreOperation{ 820 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 821 }, nil 822 } 823 824 func (c *featurestoreGRPCClient) GetFeaturestore(ctx context.Context, req *aiplatformpb.GetFeaturestoreRequest, opts ...gax.CallOption) (*aiplatformpb.Featurestore, error) { 825 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 826 827 hds = append(c.xGoogHeaders, hds...) 828 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 829 opts = append((*c.CallOptions).GetFeaturestore[0:len((*c.CallOptions).GetFeaturestore):len((*c.CallOptions).GetFeaturestore)], opts...) 830 var resp *aiplatformpb.Featurestore 831 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 832 var err error 833 resp, err = executeRPC(ctx, c.featurestoreClient.GetFeaturestore, req, settings.GRPC, c.logger, "GetFeaturestore") 834 return err 835 }, opts...) 836 if err != nil { 837 return nil, err 838 } 839 return resp, nil 840 } 841 842 func (c *featurestoreGRPCClient) ListFeaturestores(ctx context.Context, req *aiplatformpb.ListFeaturestoresRequest, opts ...gax.CallOption) *FeaturestoreIterator { 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).ListFeaturestores[0:len((*c.CallOptions).ListFeaturestores):len((*c.CallOptions).ListFeaturestores)], opts...) 848 it := &FeaturestoreIterator{} 849 req = proto.Clone(req).(*aiplatformpb.ListFeaturestoresRequest) 850 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.Featurestore, string, error) { 851 resp := &aiplatformpb.ListFeaturestoresResponse{} 852 if pageToken != "" { 853 req.PageToken = pageToken 854 } 855 if pageSize > math.MaxInt32 { 856 req.PageSize = math.MaxInt32 857 } else if pageSize != 0 { 858 req.PageSize = int32(pageSize) 859 } 860 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 861 var err error 862 resp, err = executeRPC(ctx, c.featurestoreClient.ListFeaturestores, req, settings.GRPC, c.logger, "ListFeaturestores") 863 return err 864 }, opts...) 865 if err != nil { 866 return nil, "", err 867 } 868 869 it.Response = resp 870 return resp.GetFeaturestores(), resp.GetNextPageToken(), nil 871 } 872 fetch := func(pageSize int, pageToken string) (string, error) { 873 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 874 if err != nil { 875 return "", err 876 } 877 it.items = append(it.items, items...) 878 return nextPageToken, nil 879 } 880 881 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 882 it.pageInfo.MaxSize = int(req.GetPageSize()) 883 it.pageInfo.Token = req.GetPageToken() 884 885 return it 886 } 887 888 func (c *featurestoreGRPCClient) UpdateFeaturestore(ctx context.Context, req *aiplatformpb.UpdateFeaturestoreRequest, opts ...gax.CallOption) (*UpdateFeaturestoreOperation, error) { 889 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "featurestore.name", url.QueryEscape(req.GetFeaturestore().GetName()))} 890 891 hds = append(c.xGoogHeaders, hds...) 892 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 893 opts = append((*c.CallOptions).UpdateFeaturestore[0:len((*c.CallOptions).UpdateFeaturestore):len((*c.CallOptions).UpdateFeaturestore)], opts...) 894 var resp *longrunningpb.Operation 895 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 896 var err error 897 resp, err = executeRPC(ctx, c.featurestoreClient.UpdateFeaturestore, req, settings.GRPC, c.logger, "UpdateFeaturestore") 898 return err 899 }, opts...) 900 if err != nil { 901 return nil, err 902 } 903 return &UpdateFeaturestoreOperation{ 904 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 905 }, nil 906 } 907 908 func (c *featurestoreGRPCClient) DeleteFeaturestore(ctx context.Context, req *aiplatformpb.DeleteFeaturestoreRequest, opts ...gax.CallOption) (*DeleteFeaturestoreOperation, error) { 909 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 910 911 hds = append(c.xGoogHeaders, hds...) 912 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 913 opts = append((*c.CallOptions).DeleteFeaturestore[0:len((*c.CallOptions).DeleteFeaturestore):len((*c.CallOptions).DeleteFeaturestore)], opts...) 914 var resp *longrunningpb.Operation 915 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 916 var err error 917 resp, err = executeRPC(ctx, c.featurestoreClient.DeleteFeaturestore, req, settings.GRPC, c.logger, "DeleteFeaturestore") 918 return err 919 }, opts...) 920 if err != nil { 921 return nil, err 922 } 923 return &DeleteFeaturestoreOperation{ 924 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 925 }, nil 926 } 927 928 func (c *featurestoreGRPCClient) CreateEntityType(ctx context.Context, req *aiplatformpb.CreateEntityTypeRequest, opts ...gax.CallOption) (*CreateEntityTypeOperation, error) { 929 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 930 931 hds = append(c.xGoogHeaders, hds...) 932 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 933 opts = append((*c.CallOptions).CreateEntityType[0:len((*c.CallOptions).CreateEntityType):len((*c.CallOptions).CreateEntityType)], opts...) 934 var resp *longrunningpb.Operation 935 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 936 var err error 937 resp, err = executeRPC(ctx, c.featurestoreClient.CreateEntityType, req, settings.GRPC, c.logger, "CreateEntityType") 938 return err 939 }, opts...) 940 if err != nil { 941 return nil, err 942 } 943 return &CreateEntityTypeOperation{ 944 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 945 }, nil 946 } 947 948 func (c *featurestoreGRPCClient) GetEntityType(ctx context.Context, req *aiplatformpb.GetEntityTypeRequest, opts ...gax.CallOption) (*aiplatformpb.EntityType, error) { 949 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 950 951 hds = append(c.xGoogHeaders, hds...) 952 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 953 opts = append((*c.CallOptions).GetEntityType[0:len((*c.CallOptions).GetEntityType):len((*c.CallOptions).GetEntityType)], opts...) 954 var resp *aiplatformpb.EntityType 955 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 956 var err error 957 resp, err = executeRPC(ctx, c.featurestoreClient.GetEntityType, req, settings.GRPC, c.logger, "GetEntityType") 958 return err 959 }, opts...) 960 if err != nil { 961 return nil, err 962 } 963 return resp, nil 964 } 965 966 func (c *featurestoreGRPCClient) ListEntityTypes(ctx context.Context, req *aiplatformpb.ListEntityTypesRequest, opts ...gax.CallOption) *EntityTypeIterator { 967 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 968 969 hds = append(c.xGoogHeaders, hds...) 970 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 971 opts = append((*c.CallOptions).ListEntityTypes[0:len((*c.CallOptions).ListEntityTypes):len((*c.CallOptions).ListEntityTypes)], opts...) 972 it := &EntityTypeIterator{} 973 req = proto.Clone(req).(*aiplatformpb.ListEntityTypesRequest) 974 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.EntityType, string, error) { 975 resp := &aiplatformpb.ListEntityTypesResponse{} 976 if pageToken != "" { 977 req.PageToken = pageToken 978 } 979 if pageSize > math.MaxInt32 { 980 req.PageSize = math.MaxInt32 981 } else if pageSize != 0 { 982 req.PageSize = int32(pageSize) 983 } 984 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 985 var err error 986 resp, err = executeRPC(ctx, c.featurestoreClient.ListEntityTypes, req, settings.GRPC, c.logger, "ListEntityTypes") 987 return err 988 }, opts...) 989 if err != nil { 990 return nil, "", err 991 } 992 993 it.Response = resp 994 return resp.GetEntityTypes(), resp.GetNextPageToken(), nil 995 } 996 fetch := func(pageSize int, pageToken string) (string, error) { 997 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 998 if err != nil { 999 return "", err 1000 } 1001 it.items = append(it.items, items...) 1002 return nextPageToken, nil 1003 } 1004 1005 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 1006 it.pageInfo.MaxSize = int(req.GetPageSize()) 1007 it.pageInfo.Token = req.GetPageToken() 1008 1009 return it 1010 } 1011 1012 func (c *featurestoreGRPCClient) UpdateEntityType(ctx context.Context, req *aiplatformpb.UpdateEntityTypeRequest, opts ...gax.CallOption) (*aiplatformpb.EntityType, error) { 1013 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type.name", url.QueryEscape(req.GetEntityType().GetName()))} 1014 1015 hds = append(c.xGoogHeaders, hds...) 1016 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1017 opts = append((*c.CallOptions).UpdateEntityType[0:len((*c.CallOptions).UpdateEntityType):len((*c.CallOptions).UpdateEntityType)], opts...) 1018 var resp *aiplatformpb.EntityType 1019 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1020 var err error 1021 resp, err = executeRPC(ctx, c.featurestoreClient.UpdateEntityType, req, settings.GRPC, c.logger, "UpdateEntityType") 1022 return err 1023 }, opts...) 1024 if err != nil { 1025 return nil, err 1026 } 1027 return resp, nil 1028 } 1029 1030 func (c *featurestoreGRPCClient) DeleteEntityType(ctx context.Context, req *aiplatformpb.DeleteEntityTypeRequest, opts ...gax.CallOption) (*DeleteEntityTypeOperation, error) { 1031 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1032 1033 hds = append(c.xGoogHeaders, hds...) 1034 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1035 opts = append((*c.CallOptions).DeleteEntityType[0:len((*c.CallOptions).DeleteEntityType):len((*c.CallOptions).DeleteEntityType)], opts...) 1036 var resp *longrunningpb.Operation 1037 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1038 var err error 1039 resp, err = executeRPC(ctx, c.featurestoreClient.DeleteEntityType, req, settings.GRPC, c.logger, "DeleteEntityType") 1040 return err 1041 }, opts...) 1042 if err != nil { 1043 return nil, err 1044 } 1045 return &DeleteEntityTypeOperation{ 1046 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1047 }, nil 1048 } 1049 1050 func (c *featurestoreGRPCClient) CreateFeature(ctx context.Context, req *aiplatformpb.CreateFeatureRequest, opts ...gax.CallOption) (*CreateFeatureOperation, error) { 1051 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 1052 1053 hds = append(c.xGoogHeaders, hds...) 1054 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1055 opts = append((*c.CallOptions).CreateFeature[0:len((*c.CallOptions).CreateFeature):len((*c.CallOptions).CreateFeature)], opts...) 1056 var resp *longrunningpb.Operation 1057 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1058 var err error 1059 resp, err = executeRPC(ctx, c.featurestoreClient.CreateFeature, req, settings.GRPC, c.logger, "CreateFeature") 1060 return err 1061 }, opts...) 1062 if err != nil { 1063 return nil, err 1064 } 1065 return &CreateFeatureOperation{ 1066 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1067 }, nil 1068 } 1069 1070 func (c *featurestoreGRPCClient) BatchCreateFeatures(ctx context.Context, req *aiplatformpb.BatchCreateFeaturesRequest, opts ...gax.CallOption) (*BatchCreateFeaturesOperation, error) { 1071 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 1072 1073 hds = append(c.xGoogHeaders, hds...) 1074 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1075 opts = append((*c.CallOptions).BatchCreateFeatures[0:len((*c.CallOptions).BatchCreateFeatures):len((*c.CallOptions).BatchCreateFeatures)], opts...) 1076 var resp *longrunningpb.Operation 1077 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1078 var err error 1079 resp, err = executeRPC(ctx, c.featurestoreClient.BatchCreateFeatures, req, settings.GRPC, c.logger, "BatchCreateFeatures") 1080 return err 1081 }, opts...) 1082 if err != nil { 1083 return nil, err 1084 } 1085 return &BatchCreateFeaturesOperation{ 1086 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1087 }, nil 1088 } 1089 1090 func (c *featurestoreGRPCClient) GetFeature(ctx context.Context, req *aiplatformpb.GetFeatureRequest, opts ...gax.CallOption) (*aiplatformpb.Feature, error) { 1091 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1092 1093 hds = append(c.xGoogHeaders, hds...) 1094 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1095 opts = append((*c.CallOptions).GetFeature[0:len((*c.CallOptions).GetFeature):len((*c.CallOptions).GetFeature)], opts...) 1096 var resp *aiplatformpb.Feature 1097 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1098 var err error 1099 resp, err = executeRPC(ctx, c.featurestoreClient.GetFeature, req, settings.GRPC, c.logger, "GetFeature") 1100 return err 1101 }, opts...) 1102 if err != nil { 1103 return nil, err 1104 } 1105 return resp, nil 1106 } 1107 1108 func (c *featurestoreGRPCClient) ListFeatures(ctx context.Context, req *aiplatformpb.ListFeaturesRequest, opts ...gax.CallOption) *FeatureIterator { 1109 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 1110 1111 hds = append(c.xGoogHeaders, hds...) 1112 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1113 opts = append((*c.CallOptions).ListFeatures[0:len((*c.CallOptions).ListFeatures):len((*c.CallOptions).ListFeatures)], opts...) 1114 it := &FeatureIterator{} 1115 req = proto.Clone(req).(*aiplatformpb.ListFeaturesRequest) 1116 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.Feature, string, error) { 1117 resp := &aiplatformpb.ListFeaturesResponse{} 1118 if pageToken != "" { 1119 req.PageToken = pageToken 1120 } 1121 if pageSize > math.MaxInt32 { 1122 req.PageSize = math.MaxInt32 1123 } else if pageSize != 0 { 1124 req.PageSize = int32(pageSize) 1125 } 1126 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1127 var err error 1128 resp, err = executeRPC(ctx, c.featurestoreClient.ListFeatures, req, settings.GRPC, c.logger, "ListFeatures") 1129 return err 1130 }, opts...) 1131 if err != nil { 1132 return nil, "", err 1133 } 1134 1135 it.Response = resp 1136 return resp.GetFeatures(), resp.GetNextPageToken(), nil 1137 } 1138 fetch := func(pageSize int, pageToken string) (string, error) { 1139 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 1140 if err != nil { 1141 return "", err 1142 } 1143 it.items = append(it.items, items...) 1144 return nextPageToken, nil 1145 } 1146 1147 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 1148 it.pageInfo.MaxSize = int(req.GetPageSize()) 1149 it.pageInfo.Token = req.GetPageToken() 1150 1151 return it 1152 } 1153 1154 func (c *featurestoreGRPCClient) UpdateFeature(ctx context.Context, req *aiplatformpb.UpdateFeatureRequest, opts ...gax.CallOption) (*aiplatformpb.Feature, error) { 1155 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "feature.name", url.QueryEscape(req.GetFeature().GetName()))} 1156 1157 hds = append(c.xGoogHeaders, hds...) 1158 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1159 opts = append((*c.CallOptions).UpdateFeature[0:len((*c.CallOptions).UpdateFeature):len((*c.CallOptions).UpdateFeature)], opts...) 1160 var resp *aiplatformpb.Feature 1161 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1162 var err error 1163 resp, err = executeRPC(ctx, c.featurestoreClient.UpdateFeature, req, settings.GRPC, c.logger, "UpdateFeature") 1164 return err 1165 }, opts...) 1166 if err != nil { 1167 return nil, err 1168 } 1169 return resp, nil 1170 } 1171 1172 func (c *featurestoreGRPCClient) DeleteFeature(ctx context.Context, req *aiplatformpb.DeleteFeatureRequest, opts ...gax.CallOption) (*DeleteFeatureOperation, error) { 1173 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1174 1175 hds = append(c.xGoogHeaders, hds...) 1176 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1177 opts = append((*c.CallOptions).DeleteFeature[0:len((*c.CallOptions).DeleteFeature):len((*c.CallOptions).DeleteFeature)], opts...) 1178 var resp *longrunningpb.Operation 1179 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1180 var err error 1181 resp, err = executeRPC(ctx, c.featurestoreClient.DeleteFeature, req, settings.GRPC, c.logger, "DeleteFeature") 1182 return err 1183 }, opts...) 1184 if err != nil { 1185 return nil, err 1186 } 1187 return &DeleteFeatureOperation{ 1188 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1189 }, nil 1190 } 1191 1192 func (c *featurestoreGRPCClient) ImportFeatureValues(ctx context.Context, req *aiplatformpb.ImportFeatureValuesRequest, opts ...gax.CallOption) (*ImportFeatureValuesOperation, error) { 1193 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type", url.QueryEscape(req.GetEntityType()))} 1194 1195 hds = append(c.xGoogHeaders, hds...) 1196 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1197 opts = append((*c.CallOptions).ImportFeatureValues[0:len((*c.CallOptions).ImportFeatureValues):len((*c.CallOptions).ImportFeatureValues)], opts...) 1198 var resp *longrunningpb.Operation 1199 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1200 var err error 1201 resp, err = executeRPC(ctx, c.featurestoreClient.ImportFeatureValues, req, settings.GRPC, c.logger, "ImportFeatureValues") 1202 return err 1203 }, opts...) 1204 if err != nil { 1205 return nil, err 1206 } 1207 return &ImportFeatureValuesOperation{ 1208 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1209 }, nil 1210 } 1211 1212 func (c *featurestoreGRPCClient) BatchReadFeatureValues(ctx context.Context, req *aiplatformpb.BatchReadFeatureValuesRequest, opts ...gax.CallOption) (*BatchReadFeatureValuesOperation, error) { 1213 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "featurestore", url.QueryEscape(req.GetFeaturestore()))} 1214 1215 hds = append(c.xGoogHeaders, hds...) 1216 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1217 opts = append((*c.CallOptions).BatchReadFeatureValues[0:len((*c.CallOptions).BatchReadFeatureValues):len((*c.CallOptions).BatchReadFeatureValues)], opts...) 1218 var resp *longrunningpb.Operation 1219 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1220 var err error 1221 resp, err = executeRPC(ctx, c.featurestoreClient.BatchReadFeatureValues, req, settings.GRPC, c.logger, "BatchReadFeatureValues") 1222 return err 1223 }, opts...) 1224 if err != nil { 1225 return nil, err 1226 } 1227 return &BatchReadFeatureValuesOperation{ 1228 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1229 }, nil 1230 } 1231 1232 func (c *featurestoreGRPCClient) ExportFeatureValues(ctx context.Context, req *aiplatformpb.ExportFeatureValuesRequest, opts ...gax.CallOption) (*ExportFeatureValuesOperation, error) { 1233 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type", url.QueryEscape(req.GetEntityType()))} 1234 1235 hds = append(c.xGoogHeaders, hds...) 1236 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1237 opts = append((*c.CallOptions).ExportFeatureValues[0:len((*c.CallOptions).ExportFeatureValues):len((*c.CallOptions).ExportFeatureValues)], opts...) 1238 var resp *longrunningpb.Operation 1239 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1240 var err error 1241 resp, err = executeRPC(ctx, c.featurestoreClient.ExportFeatureValues, req, settings.GRPC, c.logger, "ExportFeatureValues") 1242 return err 1243 }, opts...) 1244 if err != nil { 1245 return nil, err 1246 } 1247 return &ExportFeatureValuesOperation{ 1248 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1249 }, nil 1250 } 1251 1252 func (c *featurestoreGRPCClient) DeleteFeatureValues(ctx context.Context, req *aiplatformpb.DeleteFeatureValuesRequest, opts ...gax.CallOption) (*DeleteFeatureValuesOperation, error) { 1253 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type", url.QueryEscape(req.GetEntityType()))} 1254 1255 hds = append(c.xGoogHeaders, hds...) 1256 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1257 opts = append((*c.CallOptions).DeleteFeatureValues[0:len((*c.CallOptions).DeleteFeatureValues):len((*c.CallOptions).DeleteFeatureValues)], opts...) 1258 var resp *longrunningpb.Operation 1259 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1260 var err error 1261 resp, err = executeRPC(ctx, c.featurestoreClient.DeleteFeatureValues, req, settings.GRPC, c.logger, "DeleteFeatureValues") 1262 return err 1263 }, opts...) 1264 if err != nil { 1265 return nil, err 1266 } 1267 return &DeleteFeatureValuesOperation{ 1268 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1269 }, nil 1270 } 1271 1272 func (c *featurestoreGRPCClient) SearchFeatures(ctx context.Context, req *aiplatformpb.SearchFeaturesRequest, opts ...gax.CallOption) *FeatureIterator { 1273 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "location", url.QueryEscape(req.GetLocation()))} 1274 1275 hds = append(c.xGoogHeaders, hds...) 1276 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1277 opts = append((*c.CallOptions).SearchFeatures[0:len((*c.CallOptions).SearchFeatures):len((*c.CallOptions).SearchFeatures)], opts...) 1278 it := &FeatureIterator{} 1279 req = proto.Clone(req).(*aiplatformpb.SearchFeaturesRequest) 1280 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.Feature, string, error) { 1281 resp := &aiplatformpb.SearchFeaturesResponse{} 1282 if pageToken != "" { 1283 req.PageToken = pageToken 1284 } 1285 if pageSize > math.MaxInt32 { 1286 req.PageSize = math.MaxInt32 1287 } else if pageSize != 0 { 1288 req.PageSize = int32(pageSize) 1289 } 1290 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1291 var err error 1292 resp, err = executeRPC(ctx, c.featurestoreClient.SearchFeatures, req, settings.GRPC, c.logger, "SearchFeatures") 1293 return err 1294 }, opts...) 1295 if err != nil { 1296 return nil, "", err 1297 } 1298 1299 it.Response = resp 1300 return resp.GetFeatures(), resp.GetNextPageToken(), nil 1301 } 1302 fetch := func(pageSize int, pageToken string) (string, error) { 1303 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 1304 if err != nil { 1305 return "", err 1306 } 1307 it.items = append(it.items, items...) 1308 return nextPageToken, nil 1309 } 1310 1311 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 1312 it.pageInfo.MaxSize = int(req.GetPageSize()) 1313 it.pageInfo.Token = req.GetPageToken() 1314 1315 return it 1316 } 1317 1318 func (c *featurestoreGRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { 1319 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1320 1321 hds = append(c.xGoogHeaders, hds...) 1322 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1323 opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...) 1324 var resp *locationpb.Location 1325 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1326 var err error 1327 resp, err = executeRPC(ctx, c.locationsClient.GetLocation, req, settings.GRPC, c.logger, "GetLocation") 1328 return err 1329 }, opts...) 1330 if err != nil { 1331 return nil, err 1332 } 1333 return resp, nil 1334 } 1335 1336 func (c *featurestoreGRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { 1337 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1338 1339 hds = append(c.xGoogHeaders, hds...) 1340 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1341 opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...) 1342 it := &LocationIterator{} 1343 req = proto.Clone(req).(*locationpb.ListLocationsRequest) 1344 it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) { 1345 resp := &locationpb.ListLocationsResponse{} 1346 if pageToken != "" { 1347 req.PageToken = pageToken 1348 } 1349 if pageSize > math.MaxInt32 { 1350 req.PageSize = math.MaxInt32 1351 } else if pageSize != 0 { 1352 req.PageSize = int32(pageSize) 1353 } 1354 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1355 var err error 1356 resp, err = executeRPC(ctx, c.locationsClient.ListLocations, req, settings.GRPC, c.logger, "ListLocations") 1357 return err 1358 }, opts...) 1359 if err != nil { 1360 return nil, "", err 1361 } 1362 1363 it.Response = resp 1364 return resp.GetLocations(), resp.GetNextPageToken(), nil 1365 } 1366 fetch := func(pageSize int, pageToken string) (string, error) { 1367 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 1368 if err != nil { 1369 return "", err 1370 } 1371 it.items = append(it.items, items...) 1372 return nextPageToken, nil 1373 } 1374 1375 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 1376 it.pageInfo.MaxSize = int(req.GetPageSize()) 1377 it.pageInfo.Token = req.GetPageToken() 1378 1379 return it 1380 } 1381 1382 func (c *featurestoreGRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 1383 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 1384 1385 hds = append(c.xGoogHeaders, hds...) 1386 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1387 opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...) 1388 var resp *iampb.Policy 1389 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1390 var err error 1391 resp, err = executeRPC(ctx, c.iamPolicyClient.GetIamPolicy, req, settings.GRPC, c.logger, "GetIamPolicy") 1392 return err 1393 }, opts...) 1394 if err != nil { 1395 return nil, err 1396 } 1397 return resp, nil 1398 } 1399 1400 func (c *featurestoreGRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 1401 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 1402 1403 hds = append(c.xGoogHeaders, hds...) 1404 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1405 opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...) 1406 var resp *iampb.Policy 1407 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1408 var err error 1409 resp, err = executeRPC(ctx, c.iamPolicyClient.SetIamPolicy, req, settings.GRPC, c.logger, "SetIamPolicy") 1410 return err 1411 }, opts...) 1412 if err != nil { 1413 return nil, err 1414 } 1415 return resp, nil 1416 } 1417 1418 func (c *featurestoreGRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { 1419 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 1420 1421 hds = append(c.xGoogHeaders, hds...) 1422 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1423 opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...) 1424 var resp *iampb.TestIamPermissionsResponse 1425 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1426 var err error 1427 resp, err = executeRPC(ctx, c.iamPolicyClient.TestIamPermissions, req, settings.GRPC, c.logger, "TestIamPermissions") 1428 return err 1429 }, opts...) 1430 if err != nil { 1431 return nil, err 1432 } 1433 return resp, nil 1434 } 1435 1436 func (c *featurestoreGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { 1437 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1438 1439 hds = append(c.xGoogHeaders, hds...) 1440 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1441 opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...) 1442 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1443 var err error 1444 _, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation") 1445 return err 1446 }, opts...) 1447 return err 1448 } 1449 1450 func (c *featurestoreGRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { 1451 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1452 1453 hds = append(c.xGoogHeaders, hds...) 1454 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1455 opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...) 1456 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1457 var err error 1458 _, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation") 1459 return err 1460 }, opts...) 1461 return err 1462 } 1463 1464 func (c *featurestoreGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 1465 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1466 1467 hds = append(c.xGoogHeaders, hds...) 1468 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1469 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...) 1470 var resp *longrunningpb.Operation 1471 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1472 var err error 1473 resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation") 1474 return err 1475 }, opts...) 1476 if err != nil { 1477 return nil, err 1478 } 1479 return resp, nil 1480 } 1481 1482 func (c *featurestoreGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { 1483 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1484 1485 hds = append(c.xGoogHeaders, hds...) 1486 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1487 opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...) 1488 it := &OperationIterator{} 1489 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest) 1490 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) { 1491 resp := &longrunningpb.ListOperationsResponse{} 1492 if pageToken != "" { 1493 req.PageToken = pageToken 1494 } 1495 if pageSize > math.MaxInt32 { 1496 req.PageSize = math.MaxInt32 1497 } else if pageSize != 0 { 1498 req.PageSize = int32(pageSize) 1499 } 1500 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1501 var err error 1502 resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations") 1503 return err 1504 }, opts...) 1505 if err != nil { 1506 return nil, "", err 1507 } 1508 1509 it.Response = resp 1510 return resp.GetOperations(), resp.GetNextPageToken(), nil 1511 } 1512 fetch := func(pageSize int, pageToken string) (string, error) { 1513 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 1514 if err != nil { 1515 return "", err 1516 } 1517 it.items = append(it.items, items...) 1518 return nextPageToken, nil 1519 } 1520 1521 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 1522 it.pageInfo.MaxSize = int(req.GetPageSize()) 1523 it.pageInfo.Token = req.GetPageToken() 1524 1525 return it 1526 } 1527 1528 func (c *featurestoreGRPCClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 1529 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1530 1531 hds = append(c.xGoogHeaders, hds...) 1532 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1533 opts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...) 1534 var resp *longrunningpb.Operation 1535 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1536 var err error 1537 resp, err = executeRPC(ctx, c.operationsClient.WaitOperation, req, settings.GRPC, c.logger, "WaitOperation") 1538 return err 1539 }, opts...) 1540 if err != nil { 1541 return nil, err 1542 } 1543 return resp, nil 1544 } 1545 1546 // CreateFeaturestore creates a new Featurestore in a given project and location. 1547 func (c *featurestoreRESTClient) CreateFeaturestore(ctx context.Context, req *aiplatformpb.CreateFeaturestoreRequest, opts ...gax.CallOption) (*CreateFeaturestoreOperation, error) { 1548 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 1549 body := req.GetFeaturestore() 1550 jsonReq, err := m.Marshal(body) 1551 if err != nil { 1552 return nil, err 1553 } 1554 1555 baseUrl, err := url.Parse(c.endpoint) 1556 if err != nil { 1557 return nil, err 1558 } 1559 baseUrl.Path += fmt.Sprintf("/v1beta1/%v/featurestores", req.GetParent()) 1560 1561 params := url.Values{} 1562 params.Add("$alt", "json;enum-encoding=int") 1563 params.Add("featurestoreId", fmt.Sprintf("%v", req.GetFeaturestoreId())) 1564 1565 baseUrl.RawQuery = params.Encode() 1566 1567 // Build HTTP headers from client and context metadata. 1568 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 1569 1570 hds = append(c.xGoogHeaders, hds...) 1571 hds = append(hds, "Content-Type", "application/json") 1572 headers := gax.BuildHeaders(ctx, hds...) 1573 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1574 resp := &longrunningpb.Operation{} 1575 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1576 if settings.Path != "" { 1577 baseUrl.Path = settings.Path 1578 } 1579 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 1580 if err != nil { 1581 return err 1582 } 1583 httpReq = httpReq.WithContext(ctx) 1584 httpReq.Header = headers 1585 1586 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateFeaturestore") 1587 if err != nil { 1588 return err 1589 } 1590 if err := unm.Unmarshal(buf, resp); err != nil { 1591 return err 1592 } 1593 1594 return nil 1595 }, opts...) 1596 if e != nil { 1597 return nil, e 1598 } 1599 1600 override := fmt.Sprintf("/ui/%s", resp.GetName()) 1601 return &CreateFeaturestoreOperation{ 1602 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1603 pollPath: override, 1604 }, nil 1605 } 1606 1607 // GetFeaturestore gets details of a single Featurestore. 1608 func (c *featurestoreRESTClient) GetFeaturestore(ctx context.Context, req *aiplatformpb.GetFeaturestoreRequest, opts ...gax.CallOption) (*aiplatformpb.Featurestore, error) { 1609 baseUrl, err := url.Parse(c.endpoint) 1610 if err != nil { 1611 return nil, err 1612 } 1613 baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetName()) 1614 1615 params := url.Values{} 1616 params.Add("$alt", "json;enum-encoding=int") 1617 1618 baseUrl.RawQuery = params.Encode() 1619 1620 // Build HTTP headers from client and context metadata. 1621 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1622 1623 hds = append(c.xGoogHeaders, hds...) 1624 hds = append(hds, "Content-Type", "application/json") 1625 headers := gax.BuildHeaders(ctx, hds...) 1626 opts = append((*c.CallOptions).GetFeaturestore[0:len((*c.CallOptions).GetFeaturestore):len((*c.CallOptions).GetFeaturestore)], opts...) 1627 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1628 resp := &aiplatformpb.Featurestore{} 1629 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1630 if settings.Path != "" { 1631 baseUrl.Path = settings.Path 1632 } 1633 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 1634 if err != nil { 1635 return err 1636 } 1637 httpReq = httpReq.WithContext(ctx) 1638 httpReq.Header = headers 1639 1640 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetFeaturestore") 1641 if err != nil { 1642 return err 1643 } 1644 1645 if err := unm.Unmarshal(buf, resp); err != nil { 1646 return err 1647 } 1648 1649 return nil 1650 }, opts...) 1651 if e != nil { 1652 return nil, e 1653 } 1654 return resp, nil 1655 } 1656 1657 // ListFeaturestores lists Featurestores in a given project and location. 1658 func (c *featurestoreRESTClient) ListFeaturestores(ctx context.Context, req *aiplatformpb.ListFeaturestoresRequest, opts ...gax.CallOption) *FeaturestoreIterator { 1659 it := &FeaturestoreIterator{} 1660 req = proto.Clone(req).(*aiplatformpb.ListFeaturestoresRequest) 1661 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1662 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.Featurestore, string, error) { 1663 resp := &aiplatformpb.ListFeaturestoresResponse{} 1664 if pageToken != "" { 1665 req.PageToken = pageToken 1666 } 1667 if pageSize > math.MaxInt32 { 1668 req.PageSize = math.MaxInt32 1669 } else if pageSize != 0 { 1670 req.PageSize = int32(pageSize) 1671 } 1672 baseUrl, err := url.Parse(c.endpoint) 1673 if err != nil { 1674 return nil, "", err 1675 } 1676 baseUrl.Path += fmt.Sprintf("/v1beta1/%v/featurestores", req.GetParent()) 1677 1678 params := url.Values{} 1679 params.Add("$alt", "json;enum-encoding=int") 1680 if req.GetFilter() != "" { 1681 params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) 1682 } 1683 if req.GetOrderBy() != "" { 1684 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) 1685 } 1686 if req.GetPageSize() != 0 { 1687 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) 1688 } 1689 if req.GetPageToken() != "" { 1690 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) 1691 } 1692 if req.GetReadMask() != nil { 1693 field, err := protojson.Marshal(req.GetReadMask()) 1694 if err != nil { 1695 return nil, "", err 1696 } 1697 params.Add("readMask", string(field[1:len(field)-1])) 1698 } 1699 1700 baseUrl.RawQuery = params.Encode() 1701 1702 // Build HTTP headers from client and context metadata. 1703 hds := append(c.xGoogHeaders, "Content-Type", "application/json") 1704 headers := gax.BuildHeaders(ctx, hds...) 1705 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1706 if settings.Path != "" { 1707 baseUrl.Path = settings.Path 1708 } 1709 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 1710 if err != nil { 1711 return err 1712 } 1713 httpReq.Header = headers 1714 1715 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListFeaturestores") 1716 if err != nil { 1717 return err 1718 } 1719 if err := unm.Unmarshal(buf, resp); err != nil { 1720 return err 1721 } 1722 1723 return nil 1724 }, opts...) 1725 if e != nil { 1726 return nil, "", e 1727 } 1728 it.Response = resp 1729 return resp.GetFeaturestores(), resp.GetNextPageToken(), nil 1730 } 1731 1732 fetch := func(pageSize int, pageToken string) (string, error) { 1733 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 1734 if err != nil { 1735 return "", err 1736 } 1737 it.items = append(it.items, items...) 1738 return nextPageToken, nil 1739 } 1740 1741 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 1742 it.pageInfo.MaxSize = int(req.GetPageSize()) 1743 it.pageInfo.Token = req.GetPageToken() 1744 1745 return it 1746 } 1747 1748 // UpdateFeaturestore updates the parameters of a single Featurestore. 1749 func (c *featurestoreRESTClient) UpdateFeaturestore(ctx context.Context, req *aiplatformpb.UpdateFeaturestoreRequest, opts ...gax.CallOption) (*UpdateFeaturestoreOperation, error) { 1750 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 1751 body := req.GetFeaturestore() 1752 jsonReq, err := m.Marshal(body) 1753 if err != nil { 1754 return nil, err 1755 } 1756 1757 baseUrl, err := url.Parse(c.endpoint) 1758 if err != nil { 1759 return nil, err 1760 } 1761 baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetFeaturestore().GetName()) 1762 1763 params := url.Values{} 1764 params.Add("$alt", "json;enum-encoding=int") 1765 if req.GetUpdateMask() != nil { 1766 field, err := protojson.Marshal(req.GetUpdateMask()) 1767 if err != nil { 1768 return nil, err 1769 } 1770 params.Add("updateMask", string(field[1:len(field)-1])) 1771 } 1772 1773 baseUrl.RawQuery = params.Encode() 1774 1775 // Build HTTP headers from client and context metadata. 1776 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "featurestore.name", url.QueryEscape(req.GetFeaturestore().GetName()))} 1777 1778 hds = append(c.xGoogHeaders, hds...) 1779 hds = append(hds, "Content-Type", "application/json") 1780 headers := gax.BuildHeaders(ctx, hds...) 1781 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1782 resp := &longrunningpb.Operation{} 1783 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1784 if settings.Path != "" { 1785 baseUrl.Path = settings.Path 1786 } 1787 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) 1788 if err != nil { 1789 return err 1790 } 1791 httpReq = httpReq.WithContext(ctx) 1792 httpReq.Header = headers 1793 1794 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateFeaturestore") 1795 if err != nil { 1796 return err 1797 } 1798 if err := unm.Unmarshal(buf, resp); err != nil { 1799 return err 1800 } 1801 1802 return nil 1803 }, opts...) 1804 if e != nil { 1805 return nil, e 1806 } 1807 1808 override := fmt.Sprintf("/ui/%s", resp.GetName()) 1809 return &UpdateFeaturestoreOperation{ 1810 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1811 pollPath: override, 1812 }, nil 1813 } 1814 1815 // DeleteFeaturestore deletes a single Featurestore. The Featurestore must not contain any 1816 // EntityTypes or force must be set to true for the request to succeed. 1817 func (c *featurestoreRESTClient) DeleteFeaturestore(ctx context.Context, req *aiplatformpb.DeleteFeaturestoreRequest, opts ...gax.CallOption) (*DeleteFeaturestoreOperation, error) { 1818 baseUrl, err := url.Parse(c.endpoint) 1819 if err != nil { 1820 return nil, err 1821 } 1822 baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetName()) 1823 1824 params := url.Values{} 1825 params.Add("$alt", "json;enum-encoding=int") 1826 if req.GetForce() { 1827 params.Add("force", fmt.Sprintf("%v", req.GetForce())) 1828 } 1829 1830 baseUrl.RawQuery = params.Encode() 1831 1832 // Build HTTP headers from client and context metadata. 1833 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1834 1835 hds = append(c.xGoogHeaders, hds...) 1836 hds = append(hds, "Content-Type", "application/json") 1837 headers := gax.BuildHeaders(ctx, hds...) 1838 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1839 resp := &longrunningpb.Operation{} 1840 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1841 if settings.Path != "" { 1842 baseUrl.Path = settings.Path 1843 } 1844 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) 1845 if err != nil { 1846 return err 1847 } 1848 httpReq = httpReq.WithContext(ctx) 1849 httpReq.Header = headers 1850 1851 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteFeaturestore") 1852 if err != nil { 1853 return err 1854 } 1855 if err := unm.Unmarshal(buf, resp); err != nil { 1856 return err 1857 } 1858 1859 return nil 1860 }, opts...) 1861 if e != nil { 1862 return nil, e 1863 } 1864 1865 override := fmt.Sprintf("/ui/%s", resp.GetName()) 1866 return &DeleteFeaturestoreOperation{ 1867 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1868 pollPath: override, 1869 }, nil 1870 } 1871 1872 // CreateEntityType creates a new EntityType in a given Featurestore. 1873 func (c *featurestoreRESTClient) CreateEntityType(ctx context.Context, req *aiplatformpb.CreateEntityTypeRequest, opts ...gax.CallOption) (*CreateEntityTypeOperation, error) { 1874 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 1875 body := req.GetEntityType() 1876 jsonReq, err := m.Marshal(body) 1877 if err != nil { 1878 return nil, err 1879 } 1880 1881 baseUrl, err := url.Parse(c.endpoint) 1882 if err != nil { 1883 return nil, err 1884 } 1885 baseUrl.Path += fmt.Sprintf("/v1beta1/%v/entityTypes", req.GetParent()) 1886 1887 params := url.Values{} 1888 params.Add("$alt", "json;enum-encoding=int") 1889 params.Add("entityTypeId", fmt.Sprintf("%v", req.GetEntityTypeId())) 1890 1891 baseUrl.RawQuery = params.Encode() 1892 1893 // Build HTTP headers from client and context metadata. 1894 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 1895 1896 hds = append(c.xGoogHeaders, hds...) 1897 hds = append(hds, "Content-Type", "application/json") 1898 headers := gax.BuildHeaders(ctx, hds...) 1899 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1900 resp := &longrunningpb.Operation{} 1901 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1902 if settings.Path != "" { 1903 baseUrl.Path = settings.Path 1904 } 1905 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 1906 if err != nil { 1907 return err 1908 } 1909 httpReq = httpReq.WithContext(ctx) 1910 httpReq.Header = headers 1911 1912 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateEntityType") 1913 if err != nil { 1914 return err 1915 } 1916 if err := unm.Unmarshal(buf, resp); err != nil { 1917 return err 1918 } 1919 1920 return nil 1921 }, opts...) 1922 if e != nil { 1923 return nil, e 1924 } 1925 1926 override := fmt.Sprintf("/ui/%s", resp.GetName()) 1927 return &CreateEntityTypeOperation{ 1928 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1929 pollPath: override, 1930 }, nil 1931 } 1932 1933 // GetEntityType gets details of a single EntityType. 1934 func (c *featurestoreRESTClient) GetEntityType(ctx context.Context, req *aiplatformpb.GetEntityTypeRequest, opts ...gax.CallOption) (*aiplatformpb.EntityType, error) { 1935 baseUrl, err := url.Parse(c.endpoint) 1936 if err != nil { 1937 return nil, err 1938 } 1939 baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetName()) 1940 1941 params := url.Values{} 1942 params.Add("$alt", "json;enum-encoding=int") 1943 1944 baseUrl.RawQuery = params.Encode() 1945 1946 // Build HTTP headers from client and context metadata. 1947 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1948 1949 hds = append(c.xGoogHeaders, hds...) 1950 hds = append(hds, "Content-Type", "application/json") 1951 headers := gax.BuildHeaders(ctx, hds...) 1952 opts = append((*c.CallOptions).GetEntityType[0:len((*c.CallOptions).GetEntityType):len((*c.CallOptions).GetEntityType)], opts...) 1953 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1954 resp := &aiplatformpb.EntityType{} 1955 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1956 if settings.Path != "" { 1957 baseUrl.Path = settings.Path 1958 } 1959 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 1960 if err != nil { 1961 return err 1962 } 1963 httpReq = httpReq.WithContext(ctx) 1964 httpReq.Header = headers 1965 1966 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetEntityType") 1967 if err != nil { 1968 return err 1969 } 1970 1971 if err := unm.Unmarshal(buf, resp); err != nil { 1972 return err 1973 } 1974 1975 return nil 1976 }, opts...) 1977 if e != nil { 1978 return nil, e 1979 } 1980 return resp, nil 1981 } 1982 1983 // ListEntityTypes lists EntityTypes in a given Featurestore. 1984 func (c *featurestoreRESTClient) ListEntityTypes(ctx context.Context, req *aiplatformpb.ListEntityTypesRequest, opts ...gax.CallOption) *EntityTypeIterator { 1985 it := &EntityTypeIterator{} 1986 req = proto.Clone(req).(*aiplatformpb.ListEntityTypesRequest) 1987 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1988 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.EntityType, string, error) { 1989 resp := &aiplatformpb.ListEntityTypesResponse{} 1990 if pageToken != "" { 1991 req.PageToken = pageToken 1992 } 1993 if pageSize > math.MaxInt32 { 1994 req.PageSize = math.MaxInt32 1995 } else if pageSize != 0 { 1996 req.PageSize = int32(pageSize) 1997 } 1998 baseUrl, err := url.Parse(c.endpoint) 1999 if err != nil { 2000 return nil, "", err 2001 } 2002 baseUrl.Path += fmt.Sprintf("/v1beta1/%v/entityTypes", req.GetParent()) 2003 2004 params := url.Values{} 2005 params.Add("$alt", "json;enum-encoding=int") 2006 if req.GetFilter() != "" { 2007 params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) 2008 } 2009 if req.GetOrderBy() != "" { 2010 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) 2011 } 2012 if req.GetPageSize() != 0 { 2013 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) 2014 } 2015 if req.GetPageToken() != "" { 2016 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) 2017 } 2018 if req.GetReadMask() != nil { 2019 field, err := protojson.Marshal(req.GetReadMask()) 2020 if err != nil { 2021 return nil, "", err 2022 } 2023 params.Add("readMask", string(field[1:len(field)-1])) 2024 } 2025 2026 baseUrl.RawQuery = params.Encode() 2027 2028 // Build HTTP headers from client and context metadata. 2029 hds := append(c.xGoogHeaders, "Content-Type", "application/json") 2030 headers := gax.BuildHeaders(ctx, hds...) 2031 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2032 if settings.Path != "" { 2033 baseUrl.Path = settings.Path 2034 } 2035 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 2036 if err != nil { 2037 return err 2038 } 2039 httpReq.Header = headers 2040 2041 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListEntityTypes") 2042 if err != nil { 2043 return err 2044 } 2045 if err := unm.Unmarshal(buf, resp); err != nil { 2046 return err 2047 } 2048 2049 return nil 2050 }, opts...) 2051 if e != nil { 2052 return nil, "", e 2053 } 2054 it.Response = resp 2055 return resp.GetEntityTypes(), resp.GetNextPageToken(), nil 2056 } 2057 2058 fetch := func(pageSize int, pageToken string) (string, error) { 2059 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 2060 if err != nil { 2061 return "", err 2062 } 2063 it.items = append(it.items, items...) 2064 return nextPageToken, nil 2065 } 2066 2067 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 2068 it.pageInfo.MaxSize = int(req.GetPageSize()) 2069 it.pageInfo.Token = req.GetPageToken() 2070 2071 return it 2072 } 2073 2074 // UpdateEntityType updates the parameters of a single EntityType. 2075 func (c *featurestoreRESTClient) UpdateEntityType(ctx context.Context, req *aiplatformpb.UpdateEntityTypeRequest, opts ...gax.CallOption) (*aiplatformpb.EntityType, error) { 2076 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 2077 body := req.GetEntityType() 2078 jsonReq, err := m.Marshal(body) 2079 if err != nil { 2080 return nil, err 2081 } 2082 2083 baseUrl, err := url.Parse(c.endpoint) 2084 if err != nil { 2085 return nil, err 2086 } 2087 baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetEntityType().GetName()) 2088 2089 params := url.Values{} 2090 params.Add("$alt", "json;enum-encoding=int") 2091 if req.GetUpdateMask() != nil { 2092 field, err := protojson.Marshal(req.GetUpdateMask()) 2093 if err != nil { 2094 return nil, err 2095 } 2096 params.Add("updateMask", string(field[1:len(field)-1])) 2097 } 2098 2099 baseUrl.RawQuery = params.Encode() 2100 2101 // Build HTTP headers from client and context metadata. 2102 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type.name", url.QueryEscape(req.GetEntityType().GetName()))} 2103 2104 hds = append(c.xGoogHeaders, hds...) 2105 hds = append(hds, "Content-Type", "application/json") 2106 headers := gax.BuildHeaders(ctx, hds...) 2107 opts = append((*c.CallOptions).UpdateEntityType[0:len((*c.CallOptions).UpdateEntityType):len((*c.CallOptions).UpdateEntityType)], opts...) 2108 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2109 resp := &aiplatformpb.EntityType{} 2110 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2111 if settings.Path != "" { 2112 baseUrl.Path = settings.Path 2113 } 2114 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) 2115 if err != nil { 2116 return err 2117 } 2118 httpReq = httpReq.WithContext(ctx) 2119 httpReq.Header = headers 2120 2121 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateEntityType") 2122 if err != nil { 2123 return err 2124 } 2125 2126 if err := unm.Unmarshal(buf, resp); err != nil { 2127 return err 2128 } 2129 2130 return nil 2131 }, opts...) 2132 if e != nil { 2133 return nil, e 2134 } 2135 return resp, nil 2136 } 2137 2138 // DeleteEntityType deletes a single EntityType. The EntityType must not have any Features 2139 // or force must be set to true for the request to succeed. 2140 func (c *featurestoreRESTClient) DeleteEntityType(ctx context.Context, req *aiplatformpb.DeleteEntityTypeRequest, opts ...gax.CallOption) (*DeleteEntityTypeOperation, error) { 2141 baseUrl, err := url.Parse(c.endpoint) 2142 if err != nil { 2143 return nil, err 2144 } 2145 baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetName()) 2146 2147 params := url.Values{} 2148 params.Add("$alt", "json;enum-encoding=int") 2149 if req.GetForce() { 2150 params.Add("force", fmt.Sprintf("%v", req.GetForce())) 2151 } 2152 2153 baseUrl.RawQuery = params.Encode() 2154 2155 // Build HTTP headers from client and context metadata. 2156 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 2157 2158 hds = append(c.xGoogHeaders, hds...) 2159 hds = append(hds, "Content-Type", "application/json") 2160 headers := gax.BuildHeaders(ctx, hds...) 2161 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2162 resp := &longrunningpb.Operation{} 2163 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2164 if settings.Path != "" { 2165 baseUrl.Path = settings.Path 2166 } 2167 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) 2168 if err != nil { 2169 return err 2170 } 2171 httpReq = httpReq.WithContext(ctx) 2172 httpReq.Header = headers 2173 2174 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteEntityType") 2175 if err != nil { 2176 return err 2177 } 2178 if err := unm.Unmarshal(buf, resp); err != nil { 2179 return err 2180 } 2181 2182 return nil 2183 }, opts...) 2184 if e != nil { 2185 return nil, e 2186 } 2187 2188 override := fmt.Sprintf("/ui/%s", resp.GetName()) 2189 return &DeleteEntityTypeOperation{ 2190 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 2191 pollPath: override, 2192 }, nil 2193 } 2194 2195 // CreateFeature creates a new Feature in a given EntityType. 2196 func (c *featurestoreRESTClient) CreateFeature(ctx context.Context, req *aiplatformpb.CreateFeatureRequest, opts ...gax.CallOption) (*CreateFeatureOperation, error) { 2197 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 2198 body := req.GetFeature() 2199 jsonReq, err := m.Marshal(body) 2200 if err != nil { 2201 return nil, err 2202 } 2203 2204 baseUrl, err := url.Parse(c.endpoint) 2205 if err != nil { 2206 return nil, err 2207 } 2208 baseUrl.Path += fmt.Sprintf("/v1beta1/%v/features", req.GetParent()) 2209 2210 params := url.Values{} 2211 params.Add("$alt", "json;enum-encoding=int") 2212 params.Add("featureId", fmt.Sprintf("%v", req.GetFeatureId())) 2213 2214 baseUrl.RawQuery = params.Encode() 2215 2216 // Build HTTP headers from client and context metadata. 2217 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 2218 2219 hds = append(c.xGoogHeaders, hds...) 2220 hds = append(hds, "Content-Type", "application/json") 2221 headers := gax.BuildHeaders(ctx, hds...) 2222 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2223 resp := &longrunningpb.Operation{} 2224 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2225 if settings.Path != "" { 2226 baseUrl.Path = settings.Path 2227 } 2228 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 2229 if err != nil { 2230 return err 2231 } 2232 httpReq = httpReq.WithContext(ctx) 2233 httpReq.Header = headers 2234 2235 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateFeature") 2236 if err != nil { 2237 return err 2238 } 2239 if err := unm.Unmarshal(buf, resp); err != nil { 2240 return err 2241 } 2242 2243 return nil 2244 }, opts...) 2245 if e != nil { 2246 return nil, e 2247 } 2248 2249 override := fmt.Sprintf("/ui/%s", resp.GetName()) 2250 return &CreateFeatureOperation{ 2251 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 2252 pollPath: override, 2253 }, nil 2254 } 2255 2256 // BatchCreateFeatures creates a batch of Features in a given EntityType. 2257 func (c *featurestoreRESTClient) BatchCreateFeatures(ctx context.Context, req *aiplatformpb.BatchCreateFeaturesRequest, opts ...gax.CallOption) (*BatchCreateFeaturesOperation, error) { 2258 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 2259 jsonReq, err := m.Marshal(req) 2260 if err != nil { 2261 return nil, err 2262 } 2263 2264 baseUrl, err := url.Parse(c.endpoint) 2265 if err != nil { 2266 return nil, err 2267 } 2268 baseUrl.Path += fmt.Sprintf("/v1beta1/%v/features:batchCreate", req.GetParent()) 2269 2270 params := url.Values{} 2271 params.Add("$alt", "json;enum-encoding=int") 2272 2273 baseUrl.RawQuery = params.Encode() 2274 2275 // Build HTTP headers from client and context metadata. 2276 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 2277 2278 hds = append(c.xGoogHeaders, hds...) 2279 hds = append(hds, "Content-Type", "application/json") 2280 headers := gax.BuildHeaders(ctx, hds...) 2281 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2282 resp := &longrunningpb.Operation{} 2283 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2284 if settings.Path != "" { 2285 baseUrl.Path = settings.Path 2286 } 2287 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 2288 if err != nil { 2289 return err 2290 } 2291 httpReq = httpReq.WithContext(ctx) 2292 httpReq.Header = headers 2293 2294 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "BatchCreateFeatures") 2295 if err != nil { 2296 return err 2297 } 2298 if err := unm.Unmarshal(buf, resp); err != nil { 2299 return err 2300 } 2301 2302 return nil 2303 }, opts...) 2304 if e != nil { 2305 return nil, e 2306 } 2307 2308 override := fmt.Sprintf("/ui/%s", resp.GetName()) 2309 return &BatchCreateFeaturesOperation{ 2310 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 2311 pollPath: override, 2312 }, nil 2313 } 2314 2315 // GetFeature gets details of a single Feature. 2316 func (c *featurestoreRESTClient) GetFeature(ctx context.Context, req *aiplatformpb.GetFeatureRequest, opts ...gax.CallOption) (*aiplatformpb.Feature, error) { 2317 baseUrl, err := url.Parse(c.endpoint) 2318 if err != nil { 2319 return nil, err 2320 } 2321 baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetName()) 2322 2323 params := url.Values{} 2324 params.Add("$alt", "json;enum-encoding=int") 2325 if req.GetFeatureStatsAndAnomalySpec() != nil && req.GetFeatureStatsAndAnomalySpec().LatestStatsCount != nil { 2326 params.Add("featureStatsAndAnomalySpec.latestStatsCount", fmt.Sprintf("%v", req.GetFeatureStatsAndAnomalySpec().GetLatestStatsCount())) 2327 } 2328 if req.GetFeatureStatsAndAnomalySpec().GetStatsTimeRange().GetEndTime() != nil { 2329 field, err := protojson.Marshal(req.GetFeatureStatsAndAnomalySpec().GetStatsTimeRange().GetEndTime()) 2330 if err != nil { 2331 return nil, err 2332 } 2333 params.Add("featureStatsAndAnomalySpec.statsTimeRange.endTime", string(field[1:len(field)-1])) 2334 } 2335 if req.GetFeatureStatsAndAnomalySpec().GetStatsTimeRange().GetStartTime() != nil { 2336 field, err := protojson.Marshal(req.GetFeatureStatsAndAnomalySpec().GetStatsTimeRange().GetStartTime()) 2337 if err != nil { 2338 return nil, err 2339 } 2340 params.Add("featureStatsAndAnomalySpec.statsTimeRange.startTime", string(field[1:len(field)-1])) 2341 } 2342 2343 baseUrl.RawQuery = params.Encode() 2344 2345 // Build HTTP headers from client and context metadata. 2346 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 2347 2348 hds = append(c.xGoogHeaders, hds...) 2349 hds = append(hds, "Content-Type", "application/json") 2350 headers := gax.BuildHeaders(ctx, hds...) 2351 opts = append((*c.CallOptions).GetFeature[0:len((*c.CallOptions).GetFeature):len((*c.CallOptions).GetFeature)], opts...) 2352 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2353 resp := &aiplatformpb.Feature{} 2354 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2355 if settings.Path != "" { 2356 baseUrl.Path = settings.Path 2357 } 2358 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 2359 if err != nil { 2360 return err 2361 } 2362 httpReq = httpReq.WithContext(ctx) 2363 httpReq.Header = headers 2364 2365 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetFeature") 2366 if err != nil { 2367 return err 2368 } 2369 2370 if err := unm.Unmarshal(buf, resp); err != nil { 2371 return err 2372 } 2373 2374 return nil 2375 }, opts...) 2376 if e != nil { 2377 return nil, e 2378 } 2379 return resp, nil 2380 } 2381 2382 // ListFeatures lists Features in a given EntityType. 2383 func (c *featurestoreRESTClient) ListFeatures(ctx context.Context, req *aiplatformpb.ListFeaturesRequest, opts ...gax.CallOption) *FeatureIterator { 2384 it := &FeatureIterator{} 2385 req = proto.Clone(req).(*aiplatformpb.ListFeaturesRequest) 2386 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2387 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.Feature, string, error) { 2388 resp := &aiplatformpb.ListFeaturesResponse{} 2389 if pageToken != "" { 2390 req.PageToken = pageToken 2391 } 2392 if pageSize > math.MaxInt32 { 2393 req.PageSize = math.MaxInt32 2394 } else if pageSize != 0 { 2395 req.PageSize = int32(pageSize) 2396 } 2397 baseUrl, err := url.Parse(c.endpoint) 2398 if err != nil { 2399 return nil, "", err 2400 } 2401 baseUrl.Path += fmt.Sprintf("/v1beta1/%v/features", req.GetParent()) 2402 2403 params := url.Values{} 2404 params.Add("$alt", "json;enum-encoding=int") 2405 if req.GetFilter() != "" { 2406 params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) 2407 } 2408 if req.GetLatestStatsCount() != 0 { 2409 params.Add("latestStatsCount", fmt.Sprintf("%v", req.GetLatestStatsCount())) 2410 } 2411 if req.GetOrderBy() != "" { 2412 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) 2413 } 2414 if req.GetPageSize() != 0 { 2415 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) 2416 } 2417 if req.GetPageToken() != "" { 2418 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) 2419 } 2420 if req.GetReadMask() != nil { 2421 field, err := protojson.Marshal(req.GetReadMask()) 2422 if err != nil { 2423 return nil, "", err 2424 } 2425 params.Add("readMask", string(field[1:len(field)-1])) 2426 } 2427 2428 baseUrl.RawQuery = params.Encode() 2429 2430 // Build HTTP headers from client and context metadata. 2431 hds := append(c.xGoogHeaders, "Content-Type", "application/json") 2432 headers := gax.BuildHeaders(ctx, hds...) 2433 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2434 if settings.Path != "" { 2435 baseUrl.Path = settings.Path 2436 } 2437 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 2438 if err != nil { 2439 return err 2440 } 2441 httpReq.Header = headers 2442 2443 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListFeatures") 2444 if err != nil { 2445 return err 2446 } 2447 if err := unm.Unmarshal(buf, resp); err != nil { 2448 return err 2449 } 2450 2451 return nil 2452 }, opts...) 2453 if e != nil { 2454 return nil, "", e 2455 } 2456 it.Response = resp 2457 return resp.GetFeatures(), resp.GetNextPageToken(), nil 2458 } 2459 2460 fetch := func(pageSize int, pageToken string) (string, error) { 2461 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 2462 if err != nil { 2463 return "", err 2464 } 2465 it.items = append(it.items, items...) 2466 return nextPageToken, nil 2467 } 2468 2469 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 2470 it.pageInfo.MaxSize = int(req.GetPageSize()) 2471 it.pageInfo.Token = req.GetPageToken() 2472 2473 return it 2474 } 2475 2476 // UpdateFeature updates the parameters of a single Feature. 2477 func (c *featurestoreRESTClient) UpdateFeature(ctx context.Context, req *aiplatformpb.UpdateFeatureRequest, opts ...gax.CallOption) (*aiplatformpb.Feature, error) { 2478 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 2479 body := req.GetFeature() 2480 jsonReq, err := m.Marshal(body) 2481 if err != nil { 2482 return nil, err 2483 } 2484 2485 baseUrl, err := url.Parse(c.endpoint) 2486 if err != nil { 2487 return nil, err 2488 } 2489 baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetFeature().GetName()) 2490 2491 params := url.Values{} 2492 params.Add("$alt", "json;enum-encoding=int") 2493 if req.GetUpdateMask() != nil { 2494 field, err := protojson.Marshal(req.GetUpdateMask()) 2495 if err != nil { 2496 return nil, err 2497 } 2498 params.Add("updateMask", string(field[1:len(field)-1])) 2499 } 2500 2501 baseUrl.RawQuery = params.Encode() 2502 2503 // Build HTTP headers from client and context metadata. 2504 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "feature.name", url.QueryEscape(req.GetFeature().GetName()))} 2505 2506 hds = append(c.xGoogHeaders, hds...) 2507 hds = append(hds, "Content-Type", "application/json") 2508 headers := gax.BuildHeaders(ctx, hds...) 2509 opts = append((*c.CallOptions).UpdateFeature[0:len((*c.CallOptions).UpdateFeature):len((*c.CallOptions).UpdateFeature)], opts...) 2510 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2511 resp := &aiplatformpb.Feature{} 2512 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2513 if settings.Path != "" { 2514 baseUrl.Path = settings.Path 2515 } 2516 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) 2517 if err != nil { 2518 return err 2519 } 2520 httpReq = httpReq.WithContext(ctx) 2521 httpReq.Header = headers 2522 2523 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateFeature") 2524 if err != nil { 2525 return err 2526 } 2527 2528 if err := unm.Unmarshal(buf, resp); err != nil { 2529 return err 2530 } 2531 2532 return nil 2533 }, opts...) 2534 if e != nil { 2535 return nil, e 2536 } 2537 return resp, nil 2538 } 2539 2540 // DeleteFeature deletes a single Feature. 2541 func (c *featurestoreRESTClient) DeleteFeature(ctx context.Context, req *aiplatformpb.DeleteFeatureRequest, opts ...gax.CallOption) (*DeleteFeatureOperation, error) { 2542 baseUrl, err := url.Parse(c.endpoint) 2543 if err != nil { 2544 return nil, err 2545 } 2546 baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetName()) 2547 2548 params := url.Values{} 2549 params.Add("$alt", "json;enum-encoding=int") 2550 2551 baseUrl.RawQuery = params.Encode() 2552 2553 // Build HTTP headers from client and context metadata. 2554 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 2555 2556 hds = append(c.xGoogHeaders, hds...) 2557 hds = append(hds, "Content-Type", "application/json") 2558 headers := gax.BuildHeaders(ctx, hds...) 2559 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2560 resp := &longrunningpb.Operation{} 2561 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2562 if settings.Path != "" { 2563 baseUrl.Path = settings.Path 2564 } 2565 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) 2566 if err != nil { 2567 return err 2568 } 2569 httpReq = httpReq.WithContext(ctx) 2570 httpReq.Header = headers 2571 2572 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteFeature") 2573 if err != nil { 2574 return err 2575 } 2576 if err := unm.Unmarshal(buf, resp); err != nil { 2577 return err 2578 } 2579 2580 return nil 2581 }, opts...) 2582 if e != nil { 2583 return nil, e 2584 } 2585 2586 override := fmt.Sprintf("/ui/%s", resp.GetName()) 2587 return &DeleteFeatureOperation{ 2588 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 2589 pollPath: override, 2590 }, nil 2591 } 2592 2593 // ImportFeatureValues imports Feature values into the Featurestore from a source storage. 2594 // 2595 // The progress of the import is tracked by the returned operation. The 2596 // imported features are guaranteed to be visible to subsequent read 2597 // operations after the operation is marked as successfully done. 2598 // 2599 // If an import operation fails, the Feature values returned from 2600 // reads and exports may be inconsistent. If consistency is 2601 // required, the caller must retry the same import request again and wait till 2602 // the new operation returned is marked as successfully done. 2603 // 2604 // There are also scenarios where the caller can cause inconsistency. 2605 // 2606 // Source data for import contains multiple distinct Feature values for 2607 // the same entity ID and timestamp. 2608 // 2609 // Source is modified during an import. This includes adding, updating, or 2610 // removing source data and/or metadata. Examples of updating metadata 2611 // include but are not limited to changing storage location, storage class, 2612 // or retention policy. 2613 // 2614 // Online serving cluster is under-provisioned. 2615 func (c *featurestoreRESTClient) ImportFeatureValues(ctx context.Context, req *aiplatformpb.ImportFeatureValuesRequest, opts ...gax.CallOption) (*ImportFeatureValuesOperation, error) { 2616 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 2617 jsonReq, err := m.Marshal(req) 2618 if err != nil { 2619 return nil, err 2620 } 2621 2622 baseUrl, err := url.Parse(c.endpoint) 2623 if err != nil { 2624 return nil, err 2625 } 2626 baseUrl.Path += fmt.Sprintf("/v1beta1/%v:importFeatureValues", req.GetEntityType()) 2627 2628 params := url.Values{} 2629 params.Add("$alt", "json;enum-encoding=int") 2630 2631 baseUrl.RawQuery = params.Encode() 2632 2633 // Build HTTP headers from client and context metadata. 2634 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type", url.QueryEscape(req.GetEntityType()))} 2635 2636 hds = append(c.xGoogHeaders, hds...) 2637 hds = append(hds, "Content-Type", "application/json") 2638 headers := gax.BuildHeaders(ctx, hds...) 2639 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2640 resp := &longrunningpb.Operation{} 2641 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2642 if settings.Path != "" { 2643 baseUrl.Path = settings.Path 2644 } 2645 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 2646 if err != nil { 2647 return err 2648 } 2649 httpReq = httpReq.WithContext(ctx) 2650 httpReq.Header = headers 2651 2652 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "ImportFeatureValues") 2653 if err != nil { 2654 return err 2655 } 2656 if err := unm.Unmarshal(buf, resp); err != nil { 2657 return err 2658 } 2659 2660 return nil 2661 }, opts...) 2662 if e != nil { 2663 return nil, e 2664 } 2665 2666 override := fmt.Sprintf("/ui/%s", resp.GetName()) 2667 return &ImportFeatureValuesOperation{ 2668 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 2669 pollPath: override, 2670 }, nil 2671 } 2672 2673 // BatchReadFeatureValues batch reads Feature values from a Featurestore. 2674 // 2675 // This API enables batch reading Feature values, where each read 2676 // instance in the batch may read Feature values of entities from one or 2677 // more EntityTypes. Point-in-time correctness is guaranteed for Feature 2678 // values of each read instance as of each instance’s read timestamp. 2679 func (c *featurestoreRESTClient) BatchReadFeatureValues(ctx context.Context, req *aiplatformpb.BatchReadFeatureValuesRequest, opts ...gax.CallOption) (*BatchReadFeatureValuesOperation, error) { 2680 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 2681 jsonReq, err := m.Marshal(req) 2682 if err != nil { 2683 return nil, err 2684 } 2685 2686 baseUrl, err := url.Parse(c.endpoint) 2687 if err != nil { 2688 return nil, err 2689 } 2690 baseUrl.Path += fmt.Sprintf("/v1beta1/%v:batchReadFeatureValues", req.GetFeaturestore()) 2691 2692 params := url.Values{} 2693 params.Add("$alt", "json;enum-encoding=int") 2694 2695 baseUrl.RawQuery = params.Encode() 2696 2697 // Build HTTP headers from client and context metadata. 2698 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "featurestore", url.QueryEscape(req.GetFeaturestore()))} 2699 2700 hds = append(c.xGoogHeaders, hds...) 2701 hds = append(hds, "Content-Type", "application/json") 2702 headers := gax.BuildHeaders(ctx, hds...) 2703 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2704 resp := &longrunningpb.Operation{} 2705 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2706 if settings.Path != "" { 2707 baseUrl.Path = settings.Path 2708 } 2709 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 2710 if err != nil { 2711 return err 2712 } 2713 httpReq = httpReq.WithContext(ctx) 2714 httpReq.Header = headers 2715 2716 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "BatchReadFeatureValues") 2717 if err != nil { 2718 return err 2719 } 2720 if err := unm.Unmarshal(buf, resp); err != nil { 2721 return err 2722 } 2723 2724 return nil 2725 }, opts...) 2726 if e != nil { 2727 return nil, e 2728 } 2729 2730 override := fmt.Sprintf("/ui/%s", resp.GetName()) 2731 return &BatchReadFeatureValuesOperation{ 2732 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 2733 pollPath: override, 2734 }, nil 2735 } 2736 2737 // ExportFeatureValues exports Feature values from all the entities of a target EntityType. 2738 func (c *featurestoreRESTClient) ExportFeatureValues(ctx context.Context, req *aiplatformpb.ExportFeatureValuesRequest, opts ...gax.CallOption) (*ExportFeatureValuesOperation, error) { 2739 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 2740 jsonReq, err := m.Marshal(req) 2741 if err != nil { 2742 return nil, err 2743 } 2744 2745 baseUrl, err := url.Parse(c.endpoint) 2746 if err != nil { 2747 return nil, err 2748 } 2749 baseUrl.Path += fmt.Sprintf("/v1beta1/%v:exportFeatureValues", req.GetEntityType()) 2750 2751 params := url.Values{} 2752 params.Add("$alt", "json;enum-encoding=int") 2753 2754 baseUrl.RawQuery = params.Encode() 2755 2756 // Build HTTP headers from client and context metadata. 2757 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type", url.QueryEscape(req.GetEntityType()))} 2758 2759 hds = append(c.xGoogHeaders, hds...) 2760 hds = append(hds, "Content-Type", "application/json") 2761 headers := gax.BuildHeaders(ctx, hds...) 2762 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2763 resp := &longrunningpb.Operation{} 2764 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2765 if settings.Path != "" { 2766 baseUrl.Path = settings.Path 2767 } 2768 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 2769 if err != nil { 2770 return err 2771 } 2772 httpReq = httpReq.WithContext(ctx) 2773 httpReq.Header = headers 2774 2775 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "ExportFeatureValues") 2776 if err != nil { 2777 return err 2778 } 2779 if err := unm.Unmarshal(buf, resp); err != nil { 2780 return err 2781 } 2782 2783 return nil 2784 }, opts...) 2785 if e != nil { 2786 return nil, e 2787 } 2788 2789 override := fmt.Sprintf("/ui/%s", resp.GetName()) 2790 return &ExportFeatureValuesOperation{ 2791 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 2792 pollPath: override, 2793 }, nil 2794 } 2795 2796 // DeleteFeatureValues delete Feature values from Featurestore. 2797 // 2798 // The progress of the deletion is tracked by the returned operation. The 2799 // deleted feature values are guaranteed to be invisible to subsequent read 2800 // operations after the operation is marked as successfully done. 2801 // 2802 // If a delete feature values operation fails, the feature values 2803 // returned from reads and exports may be inconsistent. If consistency is 2804 // required, the caller must retry the same delete request again and wait till 2805 // the new operation returned is marked as successfully done. 2806 func (c *featurestoreRESTClient) DeleteFeatureValues(ctx context.Context, req *aiplatformpb.DeleteFeatureValuesRequest, opts ...gax.CallOption) (*DeleteFeatureValuesOperation, error) { 2807 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 2808 jsonReq, err := m.Marshal(req) 2809 if err != nil { 2810 return nil, err 2811 } 2812 2813 baseUrl, err := url.Parse(c.endpoint) 2814 if err != nil { 2815 return nil, err 2816 } 2817 baseUrl.Path += fmt.Sprintf("/v1beta1/%v:deleteFeatureValues", req.GetEntityType()) 2818 2819 params := url.Values{} 2820 params.Add("$alt", "json;enum-encoding=int") 2821 2822 baseUrl.RawQuery = params.Encode() 2823 2824 // Build HTTP headers from client and context metadata. 2825 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type", url.QueryEscape(req.GetEntityType()))} 2826 2827 hds = append(c.xGoogHeaders, hds...) 2828 hds = append(hds, "Content-Type", "application/json") 2829 headers := gax.BuildHeaders(ctx, hds...) 2830 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2831 resp := &longrunningpb.Operation{} 2832 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2833 if settings.Path != "" { 2834 baseUrl.Path = settings.Path 2835 } 2836 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 2837 if err != nil { 2838 return err 2839 } 2840 httpReq = httpReq.WithContext(ctx) 2841 httpReq.Header = headers 2842 2843 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "DeleteFeatureValues") 2844 if err != nil { 2845 return err 2846 } 2847 if err := unm.Unmarshal(buf, resp); err != nil { 2848 return err 2849 } 2850 2851 return nil 2852 }, opts...) 2853 if e != nil { 2854 return nil, e 2855 } 2856 2857 override := fmt.Sprintf("/ui/%s", resp.GetName()) 2858 return &DeleteFeatureValuesOperation{ 2859 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 2860 pollPath: override, 2861 }, nil 2862 } 2863 2864 // SearchFeatures searches Features matching a query in a given project. 2865 func (c *featurestoreRESTClient) SearchFeatures(ctx context.Context, req *aiplatformpb.SearchFeaturesRequest, opts ...gax.CallOption) *FeatureIterator { 2866 it := &FeatureIterator{} 2867 req = proto.Clone(req).(*aiplatformpb.SearchFeaturesRequest) 2868 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2869 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.Feature, string, error) { 2870 resp := &aiplatformpb.SearchFeaturesResponse{} 2871 if pageToken != "" { 2872 req.PageToken = pageToken 2873 } 2874 if pageSize > math.MaxInt32 { 2875 req.PageSize = math.MaxInt32 2876 } else if pageSize != 0 { 2877 req.PageSize = int32(pageSize) 2878 } 2879 baseUrl, err := url.Parse(c.endpoint) 2880 if err != nil { 2881 return nil, "", err 2882 } 2883 baseUrl.Path += fmt.Sprintf("/v1beta1/%v/featurestores:searchFeatures", req.GetLocation()) 2884 2885 params := url.Values{} 2886 params.Add("$alt", "json;enum-encoding=int") 2887 if req.GetPageSize() != 0 { 2888 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) 2889 } 2890 if req.GetPageToken() != "" { 2891 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) 2892 } 2893 if req.GetQuery() != "" { 2894 params.Add("query", fmt.Sprintf("%v", req.GetQuery())) 2895 } 2896 2897 baseUrl.RawQuery = params.Encode() 2898 2899 // Build HTTP headers from client and context metadata. 2900 hds := append(c.xGoogHeaders, "Content-Type", "application/json") 2901 headers := gax.BuildHeaders(ctx, hds...) 2902 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2903 if settings.Path != "" { 2904 baseUrl.Path = settings.Path 2905 } 2906 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 2907 if err != nil { 2908 return err 2909 } 2910 httpReq.Header = headers 2911 2912 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "SearchFeatures") 2913 if err != nil { 2914 return err 2915 } 2916 if err := unm.Unmarshal(buf, resp); err != nil { 2917 return err 2918 } 2919 2920 return nil 2921 }, opts...) 2922 if e != nil { 2923 return nil, "", e 2924 } 2925 it.Response = resp 2926 return resp.GetFeatures(), resp.GetNextPageToken(), nil 2927 } 2928 2929 fetch := func(pageSize int, pageToken string) (string, error) { 2930 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 2931 if err != nil { 2932 return "", err 2933 } 2934 it.items = append(it.items, items...) 2935 return nextPageToken, nil 2936 } 2937 2938 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 2939 it.pageInfo.MaxSize = int(req.GetPageSize()) 2940 it.pageInfo.Token = req.GetPageToken() 2941 2942 return it 2943 } 2944 2945 // GetLocation gets information about a location. 2946 func (c *featurestoreRESTClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { 2947 baseUrl, err := url.Parse(c.endpoint) 2948 if err != nil { 2949 return nil, err 2950 } 2951 baseUrl.Path += fmt.Sprintf("/ui/%v", req.GetName()) 2952 2953 params := url.Values{} 2954 params.Add("$alt", "json;enum-encoding=int") 2955 2956 baseUrl.RawQuery = params.Encode() 2957 2958 // Build HTTP headers from client and context metadata. 2959 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 2960 2961 hds = append(c.xGoogHeaders, hds...) 2962 hds = append(hds, "Content-Type", "application/json") 2963 headers := gax.BuildHeaders(ctx, hds...) 2964 opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...) 2965 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2966 resp := &locationpb.Location{} 2967 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2968 if settings.Path != "" { 2969 baseUrl.Path = settings.Path 2970 } 2971 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 2972 if err != nil { 2973 return err 2974 } 2975 httpReq = httpReq.WithContext(ctx) 2976 httpReq.Header = headers 2977 2978 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetLocation") 2979 if err != nil { 2980 return err 2981 } 2982 2983 if err := unm.Unmarshal(buf, resp); err != nil { 2984 return err 2985 } 2986 2987 return nil 2988 }, opts...) 2989 if e != nil { 2990 return nil, e 2991 } 2992 return resp, nil 2993 } 2994 2995 // ListLocations lists information about the supported locations for this service. 2996 func (c *featurestoreRESTClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { 2997 it := &LocationIterator{} 2998 req = proto.Clone(req).(*locationpb.ListLocationsRequest) 2999 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 3000 it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) { 3001 resp := &locationpb.ListLocationsResponse{} 3002 if pageToken != "" { 3003 req.PageToken = pageToken 3004 } 3005 if pageSize > math.MaxInt32 { 3006 req.PageSize = math.MaxInt32 3007 } else if pageSize != 0 { 3008 req.PageSize = int32(pageSize) 3009 } 3010 baseUrl, err := url.Parse(c.endpoint) 3011 if err != nil { 3012 return nil, "", err 3013 } 3014 baseUrl.Path += fmt.Sprintf("/ui/%v/locations", req.GetName()) 3015 3016 params := url.Values{} 3017 params.Add("$alt", "json;enum-encoding=int") 3018 if req.GetFilter() != "" { 3019 params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) 3020 } 3021 if req.GetPageSize() != 0 { 3022 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) 3023 } 3024 if req.GetPageToken() != "" { 3025 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) 3026 } 3027 3028 baseUrl.RawQuery = params.Encode() 3029 3030 // Build HTTP headers from client and context metadata. 3031 hds := append(c.xGoogHeaders, "Content-Type", "application/json") 3032 headers := gax.BuildHeaders(ctx, hds...) 3033 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 3034 if settings.Path != "" { 3035 baseUrl.Path = settings.Path 3036 } 3037 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 3038 if err != nil { 3039 return err 3040 } 3041 httpReq.Header = headers 3042 3043 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListLocations") 3044 if err != nil { 3045 return err 3046 } 3047 if err := unm.Unmarshal(buf, resp); err != nil { 3048 return err 3049 } 3050 3051 return nil 3052 }, opts...) 3053 if e != nil { 3054 return nil, "", e 3055 } 3056 it.Response = resp 3057 return resp.GetLocations(), resp.GetNextPageToken(), nil 3058 } 3059 3060 fetch := func(pageSize int, pageToken string) (string, error) { 3061 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 3062 if err != nil { 3063 return "", err 3064 } 3065 it.items = append(it.items, items...) 3066 return nextPageToken, nil 3067 } 3068 3069 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 3070 it.pageInfo.MaxSize = int(req.GetPageSize()) 3071 it.pageInfo.Token = req.GetPageToken() 3072 3073 return it 3074 } 3075 3076 // GetIamPolicy gets the access control policy for a resource. Returns an empty policy 3077 // if the resource exists and does not have a policy set. 3078 func (c *featurestoreRESTClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 3079 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 3080 jsonReq, err := m.Marshal(req) 3081 if err != nil { 3082 return nil, err 3083 } 3084 3085 baseUrl, err := url.Parse(c.endpoint) 3086 if err != nil { 3087 return nil, err 3088 } 3089 baseUrl.Path += fmt.Sprintf("/v1beta1/%v:getIamPolicy", req.GetResource()) 3090 3091 params := url.Values{} 3092 params.Add("$alt", "json;enum-encoding=int") 3093 3094 baseUrl.RawQuery = params.Encode() 3095 3096 // Build HTTP headers from client and context metadata. 3097 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 3098 3099 hds = append(c.xGoogHeaders, hds...) 3100 hds = append(hds, "Content-Type", "application/json") 3101 headers := gax.BuildHeaders(ctx, hds...) 3102 opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...) 3103 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 3104 resp := &iampb.Policy{} 3105 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 3106 if settings.Path != "" { 3107 baseUrl.Path = settings.Path 3108 } 3109 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 3110 if err != nil { 3111 return err 3112 } 3113 httpReq = httpReq.WithContext(ctx) 3114 httpReq.Header = headers 3115 3116 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "GetIamPolicy") 3117 if err != nil { 3118 return err 3119 } 3120 3121 if err := unm.Unmarshal(buf, resp); err != nil { 3122 return err 3123 } 3124 3125 return nil 3126 }, opts...) 3127 if e != nil { 3128 return nil, e 3129 } 3130 return resp, nil 3131 } 3132 3133 // SetIamPolicy sets the access control policy on the specified resource. Replaces 3134 // any existing policy. 3135 // 3136 // Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED 3137 // errors. 3138 func (c *featurestoreRESTClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 3139 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 3140 jsonReq, err := m.Marshal(req) 3141 if err != nil { 3142 return nil, err 3143 } 3144 3145 baseUrl, err := url.Parse(c.endpoint) 3146 if err != nil { 3147 return nil, err 3148 } 3149 baseUrl.Path += fmt.Sprintf("/v1beta1/%v:setIamPolicy", req.GetResource()) 3150 3151 params := url.Values{} 3152 params.Add("$alt", "json;enum-encoding=int") 3153 3154 baseUrl.RawQuery = params.Encode() 3155 3156 // Build HTTP headers from client and context metadata. 3157 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 3158 3159 hds = append(c.xGoogHeaders, hds...) 3160 hds = append(hds, "Content-Type", "application/json") 3161 headers := gax.BuildHeaders(ctx, hds...) 3162 opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...) 3163 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 3164 resp := &iampb.Policy{} 3165 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 3166 if settings.Path != "" { 3167 baseUrl.Path = settings.Path 3168 } 3169 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 3170 if err != nil { 3171 return err 3172 } 3173 httpReq = httpReq.WithContext(ctx) 3174 httpReq.Header = headers 3175 3176 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "SetIamPolicy") 3177 if err != nil { 3178 return err 3179 } 3180 3181 if err := unm.Unmarshal(buf, resp); err != nil { 3182 return err 3183 } 3184 3185 return nil 3186 }, opts...) 3187 if e != nil { 3188 return nil, e 3189 } 3190 return resp, nil 3191 } 3192 3193 // TestIamPermissions returns permissions that a caller has on the specified resource. If the 3194 // resource does not exist, this will return an empty set of 3195 // permissions, not a NOT_FOUND error. 3196 // 3197 // Note: This operation is designed to be used for building 3198 // permission-aware UIs and command-line tools, not for authorization 3199 // checking. This operation may “fail open” without warning. 3200 func (c *featurestoreRESTClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { 3201 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 3202 jsonReq, err := m.Marshal(req) 3203 if err != nil { 3204 return nil, err 3205 } 3206 3207 baseUrl, err := url.Parse(c.endpoint) 3208 if err != nil { 3209 return nil, err 3210 } 3211 baseUrl.Path += fmt.Sprintf("/v1beta1/%v:testIamPermissions", req.GetResource()) 3212 3213 params := url.Values{} 3214 params.Add("$alt", "json;enum-encoding=int") 3215 3216 baseUrl.RawQuery = params.Encode() 3217 3218 // Build HTTP headers from client and context metadata. 3219 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 3220 3221 hds = append(c.xGoogHeaders, hds...) 3222 hds = append(hds, "Content-Type", "application/json") 3223 headers := gax.BuildHeaders(ctx, hds...) 3224 opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...) 3225 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 3226 resp := &iampb.TestIamPermissionsResponse{} 3227 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 3228 if settings.Path != "" { 3229 baseUrl.Path = settings.Path 3230 } 3231 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 3232 if err != nil { 3233 return err 3234 } 3235 httpReq = httpReq.WithContext(ctx) 3236 httpReq.Header = headers 3237 3238 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "TestIamPermissions") 3239 if err != nil { 3240 return err 3241 } 3242 3243 if err := unm.Unmarshal(buf, resp); err != nil { 3244 return err 3245 } 3246 3247 return nil 3248 }, opts...) 3249 if e != nil { 3250 return nil, e 3251 } 3252 return resp, nil 3253 } 3254 3255 // CancelOperation is a utility method from google.longrunning.Operations. 3256 func (c *featurestoreRESTClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { 3257 baseUrl, err := url.Parse(c.endpoint) 3258 if err != nil { 3259 return err 3260 } 3261 baseUrl.Path += fmt.Sprintf("/ui/%v:cancel", req.GetName()) 3262 3263 params := url.Values{} 3264 params.Add("$alt", "json;enum-encoding=int") 3265 3266 baseUrl.RawQuery = params.Encode() 3267 3268 // Build HTTP headers from client and context metadata. 3269 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 3270 3271 hds = append(c.xGoogHeaders, hds...) 3272 hds = append(hds, "Content-Type", "application/json") 3273 headers := gax.BuildHeaders(ctx, hds...) 3274 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 3275 if settings.Path != "" { 3276 baseUrl.Path = settings.Path 3277 } 3278 httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) 3279 if err != nil { 3280 return err 3281 } 3282 httpReq = httpReq.WithContext(ctx) 3283 httpReq.Header = headers 3284 3285 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "CancelOperation") 3286 return err 3287 }, opts...) 3288 } 3289 3290 // DeleteOperation is a utility method from google.longrunning.Operations. 3291 func (c *featurestoreRESTClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { 3292 baseUrl, err := url.Parse(c.endpoint) 3293 if err != nil { 3294 return err 3295 } 3296 baseUrl.Path += fmt.Sprintf("/ui/%v", req.GetName()) 3297 3298 params := url.Values{} 3299 params.Add("$alt", "json;enum-encoding=int") 3300 3301 baseUrl.RawQuery = params.Encode() 3302 3303 // Build HTTP headers from client and context metadata. 3304 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 3305 3306 hds = append(c.xGoogHeaders, hds...) 3307 hds = append(hds, "Content-Type", "application/json") 3308 headers := gax.BuildHeaders(ctx, hds...) 3309 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 3310 if settings.Path != "" { 3311 baseUrl.Path = settings.Path 3312 } 3313 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) 3314 if err != nil { 3315 return err 3316 } 3317 httpReq = httpReq.WithContext(ctx) 3318 httpReq.Header = headers 3319 3320 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteOperation") 3321 return err 3322 }, opts...) 3323 } 3324 3325 // GetOperation is a utility method from google.longrunning.Operations. 3326 func (c *featurestoreRESTClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 3327 baseUrl, err := url.Parse(c.endpoint) 3328 if err != nil { 3329 return nil, err 3330 } 3331 baseUrl.Path += fmt.Sprintf("/ui/%v", req.GetName()) 3332 3333 params := url.Values{} 3334 params.Add("$alt", "json;enum-encoding=int") 3335 3336 baseUrl.RawQuery = params.Encode() 3337 3338 // Build HTTP headers from client and context metadata. 3339 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 3340 3341 hds = append(c.xGoogHeaders, hds...) 3342 hds = append(hds, "Content-Type", "application/json") 3343 headers := gax.BuildHeaders(ctx, hds...) 3344 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...) 3345 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 3346 resp := &longrunningpb.Operation{} 3347 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 3348 if settings.Path != "" { 3349 baseUrl.Path = settings.Path 3350 } 3351 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 3352 if err != nil { 3353 return err 3354 } 3355 httpReq = httpReq.WithContext(ctx) 3356 httpReq.Header = headers 3357 3358 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetOperation") 3359 if err != nil { 3360 return err 3361 } 3362 3363 if err := unm.Unmarshal(buf, resp); err != nil { 3364 return err 3365 } 3366 3367 return nil 3368 }, opts...) 3369 if e != nil { 3370 return nil, e 3371 } 3372 return resp, nil 3373 } 3374 3375 // ListOperations is a utility method from google.longrunning.Operations. 3376 func (c *featurestoreRESTClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { 3377 it := &OperationIterator{} 3378 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest) 3379 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 3380 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) { 3381 resp := &longrunningpb.ListOperationsResponse{} 3382 if pageToken != "" { 3383 req.PageToken = pageToken 3384 } 3385 if pageSize > math.MaxInt32 { 3386 req.PageSize = math.MaxInt32 3387 } else if pageSize != 0 { 3388 req.PageSize = int32(pageSize) 3389 } 3390 baseUrl, err := url.Parse(c.endpoint) 3391 if err != nil { 3392 return nil, "", err 3393 } 3394 baseUrl.Path += fmt.Sprintf("/ui/%v/operations", req.GetName()) 3395 3396 params := url.Values{} 3397 params.Add("$alt", "json;enum-encoding=int") 3398 if req.GetFilter() != "" { 3399 params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) 3400 } 3401 if req.GetPageSize() != 0 { 3402 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) 3403 } 3404 if req.GetPageToken() != "" { 3405 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) 3406 } 3407 3408 baseUrl.RawQuery = params.Encode() 3409 3410 // Build HTTP headers from client and context metadata. 3411 hds := append(c.xGoogHeaders, "Content-Type", "application/json") 3412 headers := gax.BuildHeaders(ctx, hds...) 3413 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 3414 if settings.Path != "" { 3415 baseUrl.Path = settings.Path 3416 } 3417 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 3418 if err != nil { 3419 return err 3420 } 3421 httpReq.Header = headers 3422 3423 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListOperations") 3424 if err != nil { 3425 return err 3426 } 3427 if err := unm.Unmarshal(buf, resp); err != nil { 3428 return err 3429 } 3430 3431 return nil 3432 }, opts...) 3433 if e != nil { 3434 return nil, "", e 3435 } 3436 it.Response = resp 3437 return resp.GetOperations(), resp.GetNextPageToken(), nil 3438 } 3439 3440 fetch := func(pageSize int, pageToken string) (string, error) { 3441 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 3442 if err != nil { 3443 return "", err 3444 } 3445 it.items = append(it.items, items...) 3446 return nextPageToken, nil 3447 } 3448 3449 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 3450 it.pageInfo.MaxSize = int(req.GetPageSize()) 3451 it.pageInfo.Token = req.GetPageToken() 3452 3453 return it 3454 } 3455 3456 // WaitOperation is a utility method from google.longrunning.Operations. 3457 func (c *featurestoreRESTClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 3458 baseUrl, err := url.Parse(c.endpoint) 3459 if err != nil { 3460 return nil, err 3461 } 3462 baseUrl.Path += fmt.Sprintf("/ui/%v:wait", req.GetName()) 3463 3464 params := url.Values{} 3465 params.Add("$alt", "json;enum-encoding=int") 3466 if req.GetTimeout() != nil { 3467 field, err := protojson.Marshal(req.GetTimeout()) 3468 if err != nil { 3469 return nil, err 3470 } 3471 params.Add("timeout", string(field[1:len(field)-1])) 3472 } 3473 3474 baseUrl.RawQuery = params.Encode() 3475 3476 // Build HTTP headers from client and context metadata. 3477 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 3478 3479 hds = append(c.xGoogHeaders, hds...) 3480 hds = append(hds, "Content-Type", "application/json") 3481 headers := gax.BuildHeaders(ctx, hds...) 3482 opts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...) 3483 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 3484 resp := &longrunningpb.Operation{} 3485 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 3486 if settings.Path != "" { 3487 baseUrl.Path = settings.Path 3488 } 3489 httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) 3490 if err != nil { 3491 return err 3492 } 3493 httpReq = httpReq.WithContext(ctx) 3494 httpReq.Header = headers 3495 3496 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "WaitOperation") 3497 if err != nil { 3498 return err 3499 } 3500 3501 if err := unm.Unmarshal(buf, resp); err != nil { 3502 return err 3503 } 3504 3505 return nil 3506 }, opts...) 3507 if e != nil { 3508 return nil, e 3509 } 3510 return resp, nil 3511 } 3512 3513 // BatchCreateFeaturesOperation returns a new BatchCreateFeaturesOperation from a given name. 3514 // The name must be that of a previously created BatchCreateFeaturesOperation, possibly from a different process. 3515 func (c *featurestoreGRPCClient) BatchCreateFeaturesOperation(name string) *BatchCreateFeaturesOperation { 3516 return &BatchCreateFeaturesOperation{ 3517 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3518 } 3519 } 3520 3521 // BatchCreateFeaturesOperation returns a new BatchCreateFeaturesOperation from a given name. 3522 // The name must be that of a previously created BatchCreateFeaturesOperation, possibly from a different process. 3523 func (c *featurestoreRESTClient) BatchCreateFeaturesOperation(name string) *BatchCreateFeaturesOperation { 3524 override := fmt.Sprintf("/ui/%s", name) 3525 return &BatchCreateFeaturesOperation{ 3526 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3527 pollPath: override, 3528 } 3529 } 3530 3531 // BatchReadFeatureValuesOperation returns a new BatchReadFeatureValuesOperation from a given name. 3532 // The name must be that of a previously created BatchReadFeatureValuesOperation, possibly from a different process. 3533 func (c *featurestoreGRPCClient) BatchReadFeatureValuesOperation(name string) *BatchReadFeatureValuesOperation { 3534 return &BatchReadFeatureValuesOperation{ 3535 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3536 } 3537 } 3538 3539 // BatchReadFeatureValuesOperation returns a new BatchReadFeatureValuesOperation from a given name. 3540 // The name must be that of a previously created BatchReadFeatureValuesOperation, possibly from a different process. 3541 func (c *featurestoreRESTClient) BatchReadFeatureValuesOperation(name string) *BatchReadFeatureValuesOperation { 3542 override := fmt.Sprintf("/ui/%s", name) 3543 return &BatchReadFeatureValuesOperation{ 3544 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3545 pollPath: override, 3546 } 3547 } 3548 3549 // CreateEntityTypeOperation returns a new CreateEntityTypeOperation from a given name. 3550 // The name must be that of a previously created CreateEntityTypeOperation, possibly from a different process. 3551 func (c *featurestoreGRPCClient) CreateEntityTypeOperation(name string) *CreateEntityTypeOperation { 3552 return &CreateEntityTypeOperation{ 3553 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3554 } 3555 } 3556 3557 // CreateEntityTypeOperation returns a new CreateEntityTypeOperation from a given name. 3558 // The name must be that of a previously created CreateEntityTypeOperation, possibly from a different process. 3559 func (c *featurestoreRESTClient) CreateEntityTypeOperation(name string) *CreateEntityTypeOperation { 3560 override := fmt.Sprintf("/ui/%s", name) 3561 return &CreateEntityTypeOperation{ 3562 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3563 pollPath: override, 3564 } 3565 } 3566 3567 // CreateFeatureOperation returns a new CreateFeatureOperation from a given name. 3568 // The name must be that of a previously created CreateFeatureOperation, possibly from a different process. 3569 func (c *featurestoreGRPCClient) CreateFeatureOperation(name string) *CreateFeatureOperation { 3570 return &CreateFeatureOperation{ 3571 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3572 } 3573 } 3574 3575 // CreateFeatureOperation returns a new CreateFeatureOperation from a given name. 3576 // The name must be that of a previously created CreateFeatureOperation, possibly from a different process. 3577 func (c *featurestoreRESTClient) CreateFeatureOperation(name string) *CreateFeatureOperation { 3578 override := fmt.Sprintf("/ui/%s", name) 3579 return &CreateFeatureOperation{ 3580 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3581 pollPath: override, 3582 } 3583 } 3584 3585 // CreateFeaturestoreOperation returns a new CreateFeaturestoreOperation from a given name. 3586 // The name must be that of a previously created CreateFeaturestoreOperation, possibly from a different process. 3587 func (c *featurestoreGRPCClient) CreateFeaturestoreOperation(name string) *CreateFeaturestoreOperation { 3588 return &CreateFeaturestoreOperation{ 3589 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3590 } 3591 } 3592 3593 // CreateFeaturestoreOperation returns a new CreateFeaturestoreOperation from a given name. 3594 // The name must be that of a previously created CreateFeaturestoreOperation, possibly from a different process. 3595 func (c *featurestoreRESTClient) CreateFeaturestoreOperation(name string) *CreateFeaturestoreOperation { 3596 override := fmt.Sprintf("/ui/%s", name) 3597 return &CreateFeaturestoreOperation{ 3598 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3599 pollPath: override, 3600 } 3601 } 3602 3603 // DeleteEntityTypeOperation returns a new DeleteEntityTypeOperation from a given name. 3604 // The name must be that of a previously created DeleteEntityTypeOperation, possibly from a different process. 3605 func (c *featurestoreGRPCClient) DeleteEntityTypeOperation(name string) *DeleteEntityTypeOperation { 3606 return &DeleteEntityTypeOperation{ 3607 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3608 } 3609 } 3610 3611 // DeleteEntityTypeOperation returns a new DeleteEntityTypeOperation from a given name. 3612 // The name must be that of a previously created DeleteEntityTypeOperation, possibly from a different process. 3613 func (c *featurestoreRESTClient) DeleteEntityTypeOperation(name string) *DeleteEntityTypeOperation { 3614 override := fmt.Sprintf("/ui/%s", name) 3615 return &DeleteEntityTypeOperation{ 3616 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3617 pollPath: override, 3618 } 3619 } 3620 3621 // DeleteFeatureOperation returns a new DeleteFeatureOperation from a given name. 3622 // The name must be that of a previously created DeleteFeatureOperation, possibly from a different process. 3623 func (c *featurestoreGRPCClient) DeleteFeatureOperation(name string) *DeleteFeatureOperation { 3624 return &DeleteFeatureOperation{ 3625 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3626 } 3627 } 3628 3629 // DeleteFeatureOperation returns a new DeleteFeatureOperation from a given name. 3630 // The name must be that of a previously created DeleteFeatureOperation, possibly from a different process. 3631 func (c *featurestoreRESTClient) DeleteFeatureOperation(name string) *DeleteFeatureOperation { 3632 override := fmt.Sprintf("/ui/%s", name) 3633 return &DeleteFeatureOperation{ 3634 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3635 pollPath: override, 3636 } 3637 } 3638 3639 // DeleteFeatureValuesOperation returns a new DeleteFeatureValuesOperation from a given name. 3640 // The name must be that of a previously created DeleteFeatureValuesOperation, possibly from a different process. 3641 func (c *featurestoreGRPCClient) DeleteFeatureValuesOperation(name string) *DeleteFeatureValuesOperation { 3642 return &DeleteFeatureValuesOperation{ 3643 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3644 } 3645 } 3646 3647 // DeleteFeatureValuesOperation returns a new DeleteFeatureValuesOperation from a given name. 3648 // The name must be that of a previously created DeleteFeatureValuesOperation, possibly from a different process. 3649 func (c *featurestoreRESTClient) DeleteFeatureValuesOperation(name string) *DeleteFeatureValuesOperation { 3650 override := fmt.Sprintf("/ui/%s", name) 3651 return &DeleteFeatureValuesOperation{ 3652 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3653 pollPath: override, 3654 } 3655 } 3656 3657 // DeleteFeaturestoreOperation returns a new DeleteFeaturestoreOperation from a given name. 3658 // The name must be that of a previously created DeleteFeaturestoreOperation, possibly from a different process. 3659 func (c *featurestoreGRPCClient) DeleteFeaturestoreOperation(name string) *DeleteFeaturestoreOperation { 3660 return &DeleteFeaturestoreOperation{ 3661 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3662 } 3663 } 3664 3665 // DeleteFeaturestoreOperation returns a new DeleteFeaturestoreOperation from a given name. 3666 // The name must be that of a previously created DeleteFeaturestoreOperation, possibly from a different process. 3667 func (c *featurestoreRESTClient) DeleteFeaturestoreOperation(name string) *DeleteFeaturestoreOperation { 3668 override := fmt.Sprintf("/ui/%s", name) 3669 return &DeleteFeaturestoreOperation{ 3670 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3671 pollPath: override, 3672 } 3673 } 3674 3675 // ExportFeatureValuesOperation returns a new ExportFeatureValuesOperation from a given name. 3676 // The name must be that of a previously created ExportFeatureValuesOperation, possibly from a different process. 3677 func (c *featurestoreGRPCClient) ExportFeatureValuesOperation(name string) *ExportFeatureValuesOperation { 3678 return &ExportFeatureValuesOperation{ 3679 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3680 } 3681 } 3682 3683 // ExportFeatureValuesOperation returns a new ExportFeatureValuesOperation from a given name. 3684 // The name must be that of a previously created ExportFeatureValuesOperation, possibly from a different process. 3685 func (c *featurestoreRESTClient) ExportFeatureValuesOperation(name string) *ExportFeatureValuesOperation { 3686 override := fmt.Sprintf("/ui/%s", name) 3687 return &ExportFeatureValuesOperation{ 3688 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3689 pollPath: override, 3690 } 3691 } 3692 3693 // ImportFeatureValuesOperation returns a new ImportFeatureValuesOperation from a given name. 3694 // The name must be that of a previously created ImportFeatureValuesOperation, possibly from a different process. 3695 func (c *featurestoreGRPCClient) ImportFeatureValuesOperation(name string) *ImportFeatureValuesOperation { 3696 return &ImportFeatureValuesOperation{ 3697 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3698 } 3699 } 3700 3701 // ImportFeatureValuesOperation returns a new ImportFeatureValuesOperation from a given name. 3702 // The name must be that of a previously created ImportFeatureValuesOperation, possibly from a different process. 3703 func (c *featurestoreRESTClient) ImportFeatureValuesOperation(name string) *ImportFeatureValuesOperation { 3704 override := fmt.Sprintf("/ui/%s", name) 3705 return &ImportFeatureValuesOperation{ 3706 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3707 pollPath: override, 3708 } 3709 } 3710 3711 // UpdateFeaturestoreOperation returns a new UpdateFeaturestoreOperation from a given name. 3712 // The name must be that of a previously created UpdateFeaturestoreOperation, possibly from a different process. 3713 func (c *featurestoreGRPCClient) UpdateFeaturestoreOperation(name string) *UpdateFeaturestoreOperation { 3714 return &UpdateFeaturestoreOperation{ 3715 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3716 } 3717 } 3718 3719 // UpdateFeaturestoreOperation returns a new UpdateFeaturestoreOperation from a given name. 3720 // The name must be that of a previously created UpdateFeaturestoreOperation, possibly from a different process. 3721 func (c *featurestoreRESTClient) UpdateFeaturestoreOperation(name string) *UpdateFeaturestoreOperation { 3722 override := fmt.Sprintf("/ui/%s", name) 3723 return &UpdateFeaturestoreOperation{ 3724 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 3725 pollPath: override, 3726 } 3727 }