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