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