cloud.google.com/go/aiplatform@v1.106.0/apiv1/featurestore_online_serving_client.go (about) 1 // Copyright 2025 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Code generated by protoc-gen-go_gapic. DO NOT EDIT. 16 17 package aiplatform 18 19 import ( 20 "context" 21 "fmt" 22 "log/slog" 23 "math" 24 "net/url" 25 26 aiplatformpb "cloud.google.com/go/aiplatform/apiv1/aiplatformpb" 27 iampb "cloud.google.com/go/iam/apiv1/iampb" 28 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" 29 gax "github.com/googleapis/gax-go/v2" 30 "google.golang.org/api/iterator" 31 "google.golang.org/api/option" 32 "google.golang.org/api/option/internaloption" 33 gtransport "google.golang.org/api/transport/grpc" 34 locationpb "google.golang.org/genproto/googleapis/cloud/location" 35 "google.golang.org/grpc" 36 "google.golang.org/protobuf/proto" 37 ) 38 39 var newFeaturestoreOnlineServingClientHook clientHook 40 41 // FeaturestoreOnlineServingCallOptions contains the retry settings for each method of FeaturestoreOnlineServingClient. 42 type FeaturestoreOnlineServingCallOptions struct { 43 ReadFeatureValues []gax.CallOption 44 StreamingReadFeatureValues []gax.CallOption 45 WriteFeatureValues []gax.CallOption 46 GetLocation []gax.CallOption 47 ListLocations []gax.CallOption 48 GetIamPolicy []gax.CallOption 49 SetIamPolicy []gax.CallOption 50 TestIamPermissions []gax.CallOption 51 CancelOperation []gax.CallOption 52 DeleteOperation []gax.CallOption 53 GetOperation []gax.CallOption 54 ListOperations []gax.CallOption 55 WaitOperation []gax.CallOption 56 } 57 58 func defaultFeaturestoreOnlineServingGRPCClientOptions() []option.ClientOption { 59 return []option.ClientOption{ 60 internaloption.WithDefaultEndpoint("aiplatform.googleapis.com:443"), 61 internaloption.WithDefaultEndpointTemplate("aiplatform.UNIVERSE_DOMAIN:443"), 62 internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"), 63 internaloption.WithDefaultUniverseDomain("googleapis.com"), 64 internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), 65 internaloption.WithDefaultScopes(DefaultAuthScopes()...), 66 internaloption.EnableJwtWithScope(), 67 internaloption.EnableNewAuthLibrary(), 68 option.WithGRPCDialOption(grpc.WithDefaultCallOptions( 69 grpc.MaxCallRecvMsgSize(math.MaxInt32))), 70 } 71 } 72 73 func defaultFeaturestoreOnlineServingCallOptions() *FeaturestoreOnlineServingCallOptions { 74 return &FeaturestoreOnlineServingCallOptions{ 75 ReadFeatureValues: []gax.CallOption{}, 76 StreamingReadFeatureValues: []gax.CallOption{}, 77 WriteFeatureValues: []gax.CallOption{}, 78 GetLocation: []gax.CallOption{}, 79 ListLocations: []gax.CallOption{}, 80 GetIamPolicy: []gax.CallOption{}, 81 SetIamPolicy: []gax.CallOption{}, 82 TestIamPermissions: []gax.CallOption{}, 83 CancelOperation: []gax.CallOption{}, 84 DeleteOperation: []gax.CallOption{}, 85 GetOperation: []gax.CallOption{}, 86 ListOperations: []gax.CallOption{}, 87 WaitOperation: []gax.CallOption{}, 88 } 89 } 90 91 // internalFeaturestoreOnlineServingClient is an interface that defines the methods available from Vertex AI API. 92 type internalFeaturestoreOnlineServingClient interface { 93 Close() error 94 setGoogleClientInfo(...string) 95 Connection() *grpc.ClientConn 96 ReadFeatureValues(context.Context, *aiplatformpb.ReadFeatureValuesRequest, ...gax.CallOption) (*aiplatformpb.ReadFeatureValuesResponse, error) 97 StreamingReadFeatureValues(context.Context, *aiplatformpb.StreamingReadFeatureValuesRequest, ...gax.CallOption) (aiplatformpb.FeaturestoreOnlineServingService_StreamingReadFeatureValuesClient, error) 98 WriteFeatureValues(context.Context, *aiplatformpb.WriteFeatureValuesRequest, ...gax.CallOption) (*aiplatformpb.WriteFeatureValuesResponse, error) 99 GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error) 100 ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator 101 GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) 102 SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) 103 TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) 104 CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error 105 DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error 106 GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error) 107 ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator 108 WaitOperation(context.Context, *longrunningpb.WaitOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error) 109 } 110 111 // FeaturestoreOnlineServingClient is a client for interacting with Vertex AI API. 112 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. 113 // 114 // A service for serving online feature values. 115 type FeaturestoreOnlineServingClient struct { 116 // The internal transport-dependent client. 117 internalClient internalFeaturestoreOnlineServingClient 118 119 // The call options for this service. 120 CallOptions *FeaturestoreOnlineServingCallOptions 121 } 122 123 // Wrapper methods routed to the internal client. 124 125 // Close closes the connection to the API service. The user should invoke this when 126 // the client is no longer required. 127 func (c *FeaturestoreOnlineServingClient) Close() error { 128 return c.internalClient.Close() 129 } 130 131 // setGoogleClientInfo sets the name and version of the application in 132 // the `x-goog-api-client` header passed on each request. Intended for 133 // use by Google-written clients. 134 func (c *FeaturestoreOnlineServingClient) setGoogleClientInfo(keyval ...string) { 135 c.internalClient.setGoogleClientInfo(keyval...) 136 } 137 138 // Connection returns a connection to the API service. 139 // 140 // Deprecated: Connections are now pooled so this method does not always 141 // return the same resource. 142 func (c *FeaturestoreOnlineServingClient) Connection() *grpc.ClientConn { 143 return c.internalClient.Connection() 144 } 145 146 // ReadFeatureValues reads Feature values of a specific entity of an EntityType. For reading 147 // feature values of multiple entities of an EntityType, please use 148 // StreamingReadFeatureValues. 149 func (c *FeaturestoreOnlineServingClient) ReadFeatureValues(ctx context.Context, req *aiplatformpb.ReadFeatureValuesRequest, opts ...gax.CallOption) (*aiplatformpb.ReadFeatureValuesResponse, error) { 150 return c.internalClient.ReadFeatureValues(ctx, req, opts...) 151 } 152 153 // StreamingReadFeatureValues reads Feature values for multiple entities. Depending on their size, data 154 // for different entities may be broken 155 // up across multiple responses. 156 func (c *FeaturestoreOnlineServingClient) StreamingReadFeatureValues(ctx context.Context, req *aiplatformpb.StreamingReadFeatureValuesRequest, opts ...gax.CallOption) (aiplatformpb.FeaturestoreOnlineServingService_StreamingReadFeatureValuesClient, error) { 157 return c.internalClient.StreamingReadFeatureValues(ctx, req, opts...) 158 } 159 160 // WriteFeatureValues writes Feature values of one or more entities of an EntityType. 161 // 162 // The Feature values are merged into existing entities if any. The Feature 163 // values to be written must have timestamp within the online storage 164 // retention. 165 func (c *FeaturestoreOnlineServingClient) WriteFeatureValues(ctx context.Context, req *aiplatformpb.WriteFeatureValuesRequest, opts ...gax.CallOption) (*aiplatformpb.WriteFeatureValuesResponse, error) { 166 return c.internalClient.WriteFeatureValues(ctx, req, opts...) 167 } 168 169 // GetLocation gets information about a location. 170 func (c *FeaturestoreOnlineServingClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { 171 return c.internalClient.GetLocation(ctx, req, opts...) 172 } 173 174 // ListLocations lists information about the supported locations for this service. 175 func (c *FeaturestoreOnlineServingClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { 176 return c.internalClient.ListLocations(ctx, req, opts...) 177 } 178 179 // GetIamPolicy gets the access control policy for a resource. Returns an empty policy 180 // if the resource exists and does not have a policy set. 181 func (c *FeaturestoreOnlineServingClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 182 return c.internalClient.GetIamPolicy(ctx, req, opts...) 183 } 184 185 // SetIamPolicy sets the access control policy on the specified resource. Replaces 186 // any existing policy. 187 // 188 // Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED 189 // errors. 190 func (c *FeaturestoreOnlineServingClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 191 return c.internalClient.SetIamPolicy(ctx, req, opts...) 192 } 193 194 // TestIamPermissions returns permissions that a caller has on the specified resource. If the 195 // resource does not exist, this will return an empty set of 196 // permissions, not a NOT_FOUND error. 197 // 198 // Note: This operation is designed to be used for building 199 // permission-aware UIs and command-line tools, not for authorization 200 // checking. This operation may “fail open” without warning. 201 func (c *FeaturestoreOnlineServingClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { 202 return c.internalClient.TestIamPermissions(ctx, req, opts...) 203 } 204 205 // CancelOperation is a utility method from google.longrunning.Operations. 206 func (c *FeaturestoreOnlineServingClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { 207 return c.internalClient.CancelOperation(ctx, req, opts...) 208 } 209 210 // DeleteOperation is a utility method from google.longrunning.Operations. 211 func (c *FeaturestoreOnlineServingClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { 212 return c.internalClient.DeleteOperation(ctx, req, opts...) 213 } 214 215 // GetOperation is a utility method from google.longrunning.Operations. 216 func (c *FeaturestoreOnlineServingClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 217 return c.internalClient.GetOperation(ctx, req, opts...) 218 } 219 220 // ListOperations is a utility method from google.longrunning.Operations. 221 func (c *FeaturestoreOnlineServingClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { 222 return c.internalClient.ListOperations(ctx, req, opts...) 223 } 224 225 // WaitOperation is a utility method from google.longrunning.Operations. 226 func (c *FeaturestoreOnlineServingClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 227 return c.internalClient.WaitOperation(ctx, req, opts...) 228 } 229 230 // featurestoreOnlineServingGRPCClient is a client for interacting with Vertex AI API over gRPC transport. 231 // 232 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. 233 type featurestoreOnlineServingGRPCClient struct { 234 // Connection pool of gRPC connections to the service. 235 connPool gtransport.ConnPool 236 237 // Points back to the CallOptions field of the containing FeaturestoreOnlineServingClient 238 CallOptions **FeaturestoreOnlineServingCallOptions 239 240 // The gRPC API client. 241 featurestoreOnlineServingClient aiplatformpb.FeaturestoreOnlineServingServiceClient 242 243 operationsClient longrunningpb.OperationsClient 244 245 iamPolicyClient iampb.IAMPolicyClient 246 247 locationsClient locationpb.LocationsClient 248 249 // The x-goog-* metadata to be sent with each request. 250 xGoogHeaders []string 251 252 logger *slog.Logger 253 } 254 255 // NewFeaturestoreOnlineServingClient creates a new featurestore online serving service client based on gRPC. 256 // The returned client must be Closed when it is done being used to clean up its underlying connections. 257 // 258 // A service for serving online feature values. 259 func NewFeaturestoreOnlineServingClient(ctx context.Context, opts ...option.ClientOption) (*FeaturestoreOnlineServingClient, error) { 260 clientOpts := defaultFeaturestoreOnlineServingGRPCClientOptions() 261 if newFeaturestoreOnlineServingClientHook != nil { 262 hookOpts, err := newFeaturestoreOnlineServingClientHook(ctx, clientHookParams{}) 263 if err != nil { 264 return nil, err 265 } 266 clientOpts = append(clientOpts, hookOpts...) 267 } 268 269 connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) 270 if err != nil { 271 return nil, err 272 } 273 client := FeaturestoreOnlineServingClient{CallOptions: defaultFeaturestoreOnlineServingCallOptions()} 274 275 c := &featurestoreOnlineServingGRPCClient{ 276 connPool: connPool, 277 featurestoreOnlineServingClient: aiplatformpb.NewFeaturestoreOnlineServingServiceClient(connPool), 278 CallOptions: &client.CallOptions, 279 logger: internaloption.GetLogger(opts), 280 operationsClient: longrunningpb.NewOperationsClient(connPool), 281 iamPolicyClient: iampb.NewIAMPolicyClient(connPool), 282 locationsClient: locationpb.NewLocationsClient(connPool), 283 } 284 c.setGoogleClientInfo() 285 286 client.internalClient = c 287 288 return &client, nil 289 } 290 291 // Connection returns a connection to the API service. 292 // 293 // Deprecated: Connections are now pooled so this method does not always 294 // return the same resource. 295 func (c *featurestoreOnlineServingGRPCClient) Connection() *grpc.ClientConn { 296 return c.connPool.Conn() 297 } 298 299 // setGoogleClientInfo sets the name and version of the application in 300 // the `x-goog-api-client` header passed on each request. Intended for 301 // use by Google-written clients. 302 func (c *featurestoreOnlineServingGRPCClient) setGoogleClientInfo(keyval ...string) { 303 kv := append([]string{"gl-go", gax.GoVersion}, keyval...) 304 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion) 305 c.xGoogHeaders = []string{ 306 "x-goog-api-client", gax.XGoogHeader(kv...), 307 } 308 } 309 310 // Close closes the connection to the API service. The user should invoke this when 311 // the client is no longer required. 312 func (c *featurestoreOnlineServingGRPCClient) Close() error { 313 return c.connPool.Close() 314 } 315 316 func (c *featurestoreOnlineServingGRPCClient) ReadFeatureValues(ctx context.Context, req *aiplatformpb.ReadFeatureValuesRequest, opts ...gax.CallOption) (*aiplatformpb.ReadFeatureValuesResponse, error) { 317 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type", url.QueryEscape(req.GetEntityType()))} 318 319 hds = append(c.xGoogHeaders, hds...) 320 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 321 opts = append((*c.CallOptions).ReadFeatureValues[0:len((*c.CallOptions).ReadFeatureValues):len((*c.CallOptions).ReadFeatureValues)], opts...) 322 var resp *aiplatformpb.ReadFeatureValuesResponse 323 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 324 var err error 325 resp, err = executeRPC(ctx, c.featurestoreOnlineServingClient.ReadFeatureValues, req, settings.GRPC, c.logger, "ReadFeatureValues") 326 return err 327 }, opts...) 328 if err != nil { 329 return nil, err 330 } 331 return resp, nil 332 } 333 334 func (c *featurestoreOnlineServingGRPCClient) StreamingReadFeatureValues(ctx context.Context, req *aiplatformpb.StreamingReadFeatureValuesRequest, opts ...gax.CallOption) (aiplatformpb.FeaturestoreOnlineServingService_StreamingReadFeatureValuesClient, error) { 335 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type", url.QueryEscape(req.GetEntityType()))} 336 337 hds = append(c.xGoogHeaders, hds...) 338 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 339 opts = append((*c.CallOptions).StreamingReadFeatureValues[0:len((*c.CallOptions).StreamingReadFeatureValues):len((*c.CallOptions).StreamingReadFeatureValues)], opts...) 340 var resp aiplatformpb.FeaturestoreOnlineServingService_StreamingReadFeatureValuesClient 341 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 342 var err error 343 c.logger.DebugContext(ctx, "api streaming client request", "serviceName", serviceName, "rpcName", "StreamingReadFeatureValues") 344 resp, err = c.featurestoreOnlineServingClient.StreamingReadFeatureValues(ctx, req, settings.GRPC...) 345 c.logger.DebugContext(ctx, "api streaming client response", "serviceName", serviceName, "rpcName", "StreamingReadFeatureValues") 346 return err 347 }, opts...) 348 if err != nil { 349 return nil, err 350 } 351 return resp, nil 352 } 353 354 func (c *featurestoreOnlineServingGRPCClient) WriteFeatureValues(ctx context.Context, req *aiplatformpb.WriteFeatureValuesRequest, opts ...gax.CallOption) (*aiplatformpb.WriteFeatureValuesResponse, error) { 355 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type", url.QueryEscape(req.GetEntityType()))} 356 357 hds = append(c.xGoogHeaders, hds...) 358 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 359 opts = append((*c.CallOptions).WriteFeatureValues[0:len((*c.CallOptions).WriteFeatureValues):len((*c.CallOptions).WriteFeatureValues)], opts...) 360 var resp *aiplatformpb.WriteFeatureValuesResponse 361 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 362 var err error 363 resp, err = executeRPC(ctx, c.featurestoreOnlineServingClient.WriteFeatureValues, req, settings.GRPC, c.logger, "WriteFeatureValues") 364 return err 365 }, opts...) 366 if err != nil { 367 return nil, err 368 } 369 return resp, nil 370 } 371 372 func (c *featurestoreOnlineServingGRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { 373 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 374 375 hds = append(c.xGoogHeaders, hds...) 376 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 377 opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...) 378 var resp *locationpb.Location 379 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 380 var err error 381 resp, err = executeRPC(ctx, c.locationsClient.GetLocation, req, settings.GRPC, c.logger, "GetLocation") 382 return err 383 }, opts...) 384 if err != nil { 385 return nil, err 386 } 387 return resp, nil 388 } 389 390 func (c *featurestoreOnlineServingGRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { 391 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 392 393 hds = append(c.xGoogHeaders, hds...) 394 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 395 opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...) 396 it := &LocationIterator{} 397 req = proto.Clone(req).(*locationpb.ListLocationsRequest) 398 it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) { 399 resp := &locationpb.ListLocationsResponse{} 400 if pageToken != "" { 401 req.PageToken = pageToken 402 } 403 if pageSize > math.MaxInt32 { 404 req.PageSize = math.MaxInt32 405 } else if pageSize != 0 { 406 req.PageSize = int32(pageSize) 407 } 408 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 409 var err error 410 resp, err = executeRPC(ctx, c.locationsClient.ListLocations, req, settings.GRPC, c.logger, "ListLocations") 411 return err 412 }, opts...) 413 if err != nil { 414 return nil, "", err 415 } 416 417 it.Response = resp 418 return resp.GetLocations(), resp.GetNextPageToken(), nil 419 } 420 fetch := func(pageSize int, pageToken string) (string, error) { 421 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 422 if err != nil { 423 return "", err 424 } 425 it.items = append(it.items, items...) 426 return nextPageToken, nil 427 } 428 429 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 430 it.pageInfo.MaxSize = int(req.GetPageSize()) 431 it.pageInfo.Token = req.GetPageToken() 432 433 return it 434 } 435 436 func (c *featurestoreOnlineServingGRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 437 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 438 439 hds = append(c.xGoogHeaders, hds...) 440 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 441 opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...) 442 var resp *iampb.Policy 443 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 444 var err error 445 resp, err = executeRPC(ctx, c.iamPolicyClient.GetIamPolicy, req, settings.GRPC, c.logger, "GetIamPolicy") 446 return err 447 }, opts...) 448 if err != nil { 449 return nil, err 450 } 451 return resp, nil 452 } 453 454 func (c *featurestoreOnlineServingGRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 455 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 456 457 hds = append(c.xGoogHeaders, hds...) 458 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 459 opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...) 460 var resp *iampb.Policy 461 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 462 var err error 463 resp, err = executeRPC(ctx, c.iamPolicyClient.SetIamPolicy, req, settings.GRPC, c.logger, "SetIamPolicy") 464 return err 465 }, opts...) 466 if err != nil { 467 return nil, err 468 } 469 return resp, nil 470 } 471 472 func (c *featurestoreOnlineServingGRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { 473 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 474 475 hds = append(c.xGoogHeaders, hds...) 476 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 477 opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...) 478 var resp *iampb.TestIamPermissionsResponse 479 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 480 var err error 481 resp, err = executeRPC(ctx, c.iamPolicyClient.TestIamPermissions, req, settings.GRPC, c.logger, "TestIamPermissions") 482 return err 483 }, opts...) 484 if err != nil { 485 return nil, err 486 } 487 return resp, nil 488 } 489 490 func (c *featurestoreOnlineServingGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { 491 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 492 493 hds = append(c.xGoogHeaders, hds...) 494 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 495 opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...) 496 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 497 var err error 498 _, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation") 499 return err 500 }, opts...) 501 return err 502 } 503 504 func (c *featurestoreOnlineServingGRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { 505 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 506 507 hds = append(c.xGoogHeaders, hds...) 508 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 509 opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...) 510 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 511 var err error 512 _, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation") 513 return err 514 }, opts...) 515 return err 516 } 517 518 func (c *featurestoreOnlineServingGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 519 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 520 521 hds = append(c.xGoogHeaders, hds...) 522 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 523 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...) 524 var resp *longrunningpb.Operation 525 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 526 var err error 527 resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation") 528 return err 529 }, opts...) 530 if err != nil { 531 return nil, err 532 } 533 return resp, nil 534 } 535 536 func (c *featurestoreOnlineServingGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { 537 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 538 539 hds = append(c.xGoogHeaders, hds...) 540 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 541 opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...) 542 it := &OperationIterator{} 543 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest) 544 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) { 545 resp := &longrunningpb.ListOperationsResponse{} 546 if pageToken != "" { 547 req.PageToken = pageToken 548 } 549 if pageSize > math.MaxInt32 { 550 req.PageSize = math.MaxInt32 551 } else if pageSize != 0 { 552 req.PageSize = int32(pageSize) 553 } 554 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 555 var err error 556 resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations") 557 return err 558 }, opts...) 559 if err != nil { 560 return nil, "", err 561 } 562 563 it.Response = resp 564 return resp.GetOperations(), resp.GetNextPageToken(), nil 565 } 566 fetch := func(pageSize int, pageToken string) (string, error) { 567 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 568 if err != nil { 569 return "", err 570 } 571 it.items = append(it.items, items...) 572 return nextPageToken, nil 573 } 574 575 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 576 it.pageInfo.MaxSize = int(req.GetPageSize()) 577 it.pageInfo.Token = req.GetPageToken() 578 579 return it 580 } 581 582 func (c *featurestoreOnlineServingGRPCClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 583 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 584 585 hds = append(c.xGoogHeaders, hds...) 586 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 587 opts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...) 588 var resp *longrunningpb.Operation 589 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 590 var err error 591 resp, err = executeRPC(ctx, c.operationsClient.WaitOperation, req, settings.GRPC, c.logger, "WaitOperation") 592 return err 593 }, opts...) 594 if err != nil { 595 return nil, err 596 } 597 return resp, nil 598 }