cloud.google.com/go/aiplatform@v1.106.0/apiv1beta1/feature_online_store_admin_client.go (about) 1 // Copyright 2025 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Code generated by protoc-gen-go_gapic. DO NOT EDIT. 16 17 package aiplatform 18 19 import ( 20 "bytes" 21 "context" 22 "fmt" 23 "log/slog" 24 "math" 25 "net/http" 26 "net/url" 27 "time" 28 29 aiplatformpb "cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb" 30 iampb "cloud.google.com/go/iam/apiv1/iampb" 31 "cloud.google.com/go/longrunning" 32 lroauto "cloud.google.com/go/longrunning/autogen" 33 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" 34 gax "github.com/googleapis/gax-go/v2" 35 "google.golang.org/api/iterator" 36 "google.golang.org/api/option" 37 "google.golang.org/api/option/internaloption" 38 gtransport "google.golang.org/api/transport/grpc" 39 httptransport "google.golang.org/api/transport/http" 40 locationpb "google.golang.org/genproto/googleapis/cloud/location" 41 "google.golang.org/grpc" 42 "google.golang.org/protobuf/encoding/protojson" 43 "google.golang.org/protobuf/proto" 44 ) 45 46 var newFeatureOnlineStoreAdminClientHook clientHook 47 48 // FeatureOnlineStoreAdminCallOptions contains the retry settings for each method of FeatureOnlineStoreAdminClient. 49 type FeatureOnlineStoreAdminCallOptions struct { 50 CreateFeatureOnlineStore []gax.CallOption 51 GetFeatureOnlineStore []gax.CallOption 52 ListFeatureOnlineStores []gax.CallOption 53 UpdateFeatureOnlineStore []gax.CallOption 54 DeleteFeatureOnlineStore []gax.CallOption 55 CreateFeatureView []gax.CallOption 56 GetFeatureView []gax.CallOption 57 ListFeatureViews []gax.CallOption 58 UpdateFeatureView []gax.CallOption 59 DeleteFeatureView []gax.CallOption 60 SyncFeatureView []gax.CallOption 61 GetFeatureViewSync []gax.CallOption 62 ListFeatureViewSyncs []gax.CallOption 63 GetLocation []gax.CallOption 64 ListLocations []gax.CallOption 65 GetIamPolicy []gax.CallOption 66 SetIamPolicy []gax.CallOption 67 TestIamPermissions []gax.CallOption 68 CancelOperation []gax.CallOption 69 DeleteOperation []gax.CallOption 70 GetOperation []gax.CallOption 71 ListOperations []gax.CallOption 72 WaitOperation []gax.CallOption 73 } 74 75 func defaultFeatureOnlineStoreAdminGRPCClientOptions() []option.ClientOption { 76 return []option.ClientOption{ 77 internaloption.WithDefaultEndpoint("aiplatform.googleapis.com:443"), 78 internaloption.WithDefaultEndpointTemplate("aiplatform.UNIVERSE_DOMAIN:443"), 79 internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"), 80 internaloption.WithDefaultUniverseDomain("googleapis.com"), 81 internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), 82 internaloption.WithDefaultScopes(DefaultAuthScopes()...), 83 internaloption.EnableJwtWithScope(), 84 internaloption.EnableNewAuthLibrary(), 85 option.WithGRPCDialOption(grpc.WithDefaultCallOptions( 86 grpc.MaxCallRecvMsgSize(math.MaxInt32))), 87 } 88 } 89 90 func defaultFeatureOnlineStoreAdminCallOptions() *FeatureOnlineStoreAdminCallOptions { 91 return &FeatureOnlineStoreAdminCallOptions{ 92 CreateFeatureOnlineStore: []gax.CallOption{ 93 gax.WithTimeout(5000 * time.Millisecond), 94 }, 95 GetFeatureOnlineStore: []gax.CallOption{ 96 gax.WithTimeout(5000 * time.Millisecond), 97 }, 98 ListFeatureOnlineStores: []gax.CallOption{ 99 gax.WithTimeout(5000 * time.Millisecond), 100 }, 101 UpdateFeatureOnlineStore: []gax.CallOption{ 102 gax.WithTimeout(5000 * time.Millisecond), 103 }, 104 DeleteFeatureOnlineStore: []gax.CallOption{ 105 gax.WithTimeout(5000 * time.Millisecond), 106 }, 107 CreateFeatureView: []gax.CallOption{ 108 gax.WithTimeout(5000 * time.Millisecond), 109 }, 110 GetFeatureView: []gax.CallOption{ 111 gax.WithTimeout(5000 * time.Millisecond), 112 }, 113 ListFeatureViews: []gax.CallOption{ 114 gax.WithTimeout(5000 * time.Millisecond), 115 }, 116 UpdateFeatureView: []gax.CallOption{ 117 gax.WithTimeout(5000 * time.Millisecond), 118 }, 119 DeleteFeatureView: []gax.CallOption{ 120 gax.WithTimeout(5000 * time.Millisecond), 121 }, 122 SyncFeatureView: []gax.CallOption{}, 123 GetFeatureViewSync: []gax.CallOption{}, 124 ListFeatureViewSyncs: []gax.CallOption{}, 125 GetLocation: []gax.CallOption{}, 126 ListLocations: []gax.CallOption{}, 127 GetIamPolicy: []gax.CallOption{}, 128 SetIamPolicy: []gax.CallOption{}, 129 TestIamPermissions: []gax.CallOption{}, 130 CancelOperation: []gax.CallOption{}, 131 DeleteOperation: []gax.CallOption{}, 132 GetOperation: []gax.CallOption{}, 133 ListOperations: []gax.CallOption{}, 134 WaitOperation: []gax.CallOption{}, 135 } 136 } 137 138 func defaultFeatureOnlineStoreAdminRESTCallOptions() *FeatureOnlineStoreAdminCallOptions { 139 return &FeatureOnlineStoreAdminCallOptions{ 140 CreateFeatureOnlineStore: []gax.CallOption{ 141 gax.WithTimeout(5000 * time.Millisecond), 142 }, 143 GetFeatureOnlineStore: []gax.CallOption{ 144 gax.WithTimeout(5000 * time.Millisecond), 145 }, 146 ListFeatureOnlineStores: []gax.CallOption{ 147 gax.WithTimeout(5000 * time.Millisecond), 148 }, 149 UpdateFeatureOnlineStore: []gax.CallOption{ 150 gax.WithTimeout(5000 * time.Millisecond), 151 }, 152 DeleteFeatureOnlineStore: []gax.CallOption{ 153 gax.WithTimeout(5000 * time.Millisecond), 154 }, 155 CreateFeatureView: []gax.CallOption{ 156 gax.WithTimeout(5000 * time.Millisecond), 157 }, 158 GetFeatureView: []gax.CallOption{ 159 gax.WithTimeout(5000 * time.Millisecond), 160 }, 161 ListFeatureViews: []gax.CallOption{ 162 gax.WithTimeout(5000 * time.Millisecond), 163 }, 164 UpdateFeatureView: []gax.CallOption{ 165 gax.WithTimeout(5000 * time.Millisecond), 166 }, 167 DeleteFeatureView: []gax.CallOption{ 168 gax.WithTimeout(5000 * time.Millisecond), 169 }, 170 SyncFeatureView: []gax.CallOption{}, 171 GetFeatureViewSync: []gax.CallOption{}, 172 ListFeatureViewSyncs: []gax.CallOption{}, 173 GetLocation: []gax.CallOption{}, 174 ListLocations: []gax.CallOption{}, 175 GetIamPolicy: []gax.CallOption{}, 176 SetIamPolicy: []gax.CallOption{}, 177 TestIamPermissions: []gax.CallOption{}, 178 CancelOperation: []gax.CallOption{}, 179 DeleteOperation: []gax.CallOption{}, 180 GetOperation: []gax.CallOption{}, 181 ListOperations: []gax.CallOption{}, 182 WaitOperation: []gax.CallOption{}, 183 } 184 } 185 186 // internalFeatureOnlineStoreAdminClient is an interface that defines the methods available from Vertex AI API. 187 type internalFeatureOnlineStoreAdminClient interface { 188 Close() error 189 setGoogleClientInfo(...string) 190 Connection() *grpc.ClientConn 191 CreateFeatureOnlineStore(context.Context, *aiplatformpb.CreateFeatureOnlineStoreRequest, ...gax.CallOption) (*CreateFeatureOnlineStoreOperation, error) 192 CreateFeatureOnlineStoreOperation(name string) *CreateFeatureOnlineStoreOperation 193 GetFeatureOnlineStore(context.Context, *aiplatformpb.GetFeatureOnlineStoreRequest, ...gax.CallOption) (*aiplatformpb.FeatureOnlineStore, error) 194 ListFeatureOnlineStores(context.Context, *aiplatformpb.ListFeatureOnlineStoresRequest, ...gax.CallOption) *FeatureOnlineStoreIterator 195 UpdateFeatureOnlineStore(context.Context, *aiplatformpb.UpdateFeatureOnlineStoreRequest, ...gax.CallOption) (*UpdateFeatureOnlineStoreOperation, error) 196 UpdateFeatureOnlineStoreOperation(name string) *UpdateFeatureOnlineStoreOperation 197 DeleteFeatureOnlineStore(context.Context, *aiplatformpb.DeleteFeatureOnlineStoreRequest, ...gax.CallOption) (*DeleteFeatureOnlineStoreOperation, error) 198 DeleteFeatureOnlineStoreOperation(name string) *DeleteFeatureOnlineStoreOperation 199 CreateFeatureView(context.Context, *aiplatformpb.CreateFeatureViewRequest, ...gax.CallOption) (*CreateFeatureViewOperation, error) 200 CreateFeatureViewOperation(name string) *CreateFeatureViewOperation 201 GetFeatureView(context.Context, *aiplatformpb.GetFeatureViewRequest, ...gax.CallOption) (*aiplatformpb.FeatureView, error) 202 ListFeatureViews(context.Context, *aiplatformpb.ListFeatureViewsRequest, ...gax.CallOption) *FeatureViewIterator 203 UpdateFeatureView(context.Context, *aiplatformpb.UpdateFeatureViewRequest, ...gax.CallOption) (*UpdateFeatureViewOperation, error) 204 UpdateFeatureViewOperation(name string) *UpdateFeatureViewOperation 205 DeleteFeatureView(context.Context, *aiplatformpb.DeleteFeatureViewRequest, ...gax.CallOption) (*DeleteFeatureViewOperation, error) 206 DeleteFeatureViewOperation(name string) *DeleteFeatureViewOperation 207 SyncFeatureView(context.Context, *aiplatformpb.SyncFeatureViewRequest, ...gax.CallOption) (*aiplatformpb.SyncFeatureViewResponse, error) 208 GetFeatureViewSync(context.Context, *aiplatformpb.GetFeatureViewSyncRequest, ...gax.CallOption) (*aiplatformpb.FeatureViewSync, error) 209 ListFeatureViewSyncs(context.Context, *aiplatformpb.ListFeatureViewSyncsRequest, ...gax.CallOption) *FeatureViewSyncIterator 210 GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error) 211 ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator 212 GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) 213 SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) 214 TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) 215 CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error 216 DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error 217 GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error) 218 ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator 219 WaitOperation(context.Context, *longrunningpb.WaitOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error) 220 } 221 222 // FeatureOnlineStoreAdminClient is a client for interacting with Vertex AI API. 223 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. 224 // 225 // The service that handles CRUD and List for resources for 226 // FeatureOnlineStore. 227 type FeatureOnlineStoreAdminClient struct { 228 // The internal transport-dependent client. 229 internalClient internalFeatureOnlineStoreAdminClient 230 231 // The call options for this service. 232 CallOptions *FeatureOnlineStoreAdminCallOptions 233 234 // LROClient is used internally to handle long-running operations. 235 // It is exposed so that its CallOptions can be modified if required. 236 // Users should not Close this client. 237 LROClient *lroauto.OperationsClient 238 } 239 240 // Wrapper methods routed to the internal client. 241 242 // Close closes the connection to the API service. The user should invoke this when 243 // the client is no longer required. 244 func (c *FeatureOnlineStoreAdminClient) Close() error { 245 return c.internalClient.Close() 246 } 247 248 // setGoogleClientInfo sets the name and version of the application in 249 // the `x-goog-api-client` header passed on each request. Intended for 250 // use by Google-written clients. 251 func (c *FeatureOnlineStoreAdminClient) setGoogleClientInfo(keyval ...string) { 252 c.internalClient.setGoogleClientInfo(keyval...) 253 } 254 255 // Connection returns a connection to the API service. 256 // 257 // Deprecated: Connections are now pooled so this method does not always 258 // return the same resource. 259 func (c *FeatureOnlineStoreAdminClient) Connection() *grpc.ClientConn { 260 return c.internalClient.Connection() 261 } 262 263 // CreateFeatureOnlineStore creates a new FeatureOnlineStore in a given project and location. 264 func (c *FeatureOnlineStoreAdminClient) CreateFeatureOnlineStore(ctx context.Context, req *aiplatformpb.CreateFeatureOnlineStoreRequest, opts ...gax.CallOption) (*CreateFeatureOnlineStoreOperation, error) { 265 return c.internalClient.CreateFeatureOnlineStore(ctx, req, opts...) 266 } 267 268 // CreateFeatureOnlineStoreOperation returns a new CreateFeatureOnlineStoreOperation from a given name. 269 // The name must be that of a previously created CreateFeatureOnlineStoreOperation, possibly from a different process. 270 func (c *FeatureOnlineStoreAdminClient) CreateFeatureOnlineStoreOperation(name string) *CreateFeatureOnlineStoreOperation { 271 return c.internalClient.CreateFeatureOnlineStoreOperation(name) 272 } 273 274 // GetFeatureOnlineStore gets details of a single FeatureOnlineStore. 275 func (c *FeatureOnlineStoreAdminClient) GetFeatureOnlineStore(ctx context.Context, req *aiplatformpb.GetFeatureOnlineStoreRequest, opts ...gax.CallOption) (*aiplatformpb.FeatureOnlineStore, error) { 276 return c.internalClient.GetFeatureOnlineStore(ctx, req, opts...) 277 } 278 279 // ListFeatureOnlineStores lists FeatureOnlineStores in a given project and location. 280 func (c *FeatureOnlineStoreAdminClient) ListFeatureOnlineStores(ctx context.Context, req *aiplatformpb.ListFeatureOnlineStoresRequest, opts ...gax.CallOption) *FeatureOnlineStoreIterator { 281 return c.internalClient.ListFeatureOnlineStores(ctx, req, opts...) 282 } 283 284 // UpdateFeatureOnlineStore updates the parameters of a single FeatureOnlineStore. 285 func (c *FeatureOnlineStoreAdminClient) UpdateFeatureOnlineStore(ctx context.Context, req *aiplatformpb.UpdateFeatureOnlineStoreRequest, opts ...gax.CallOption) (*UpdateFeatureOnlineStoreOperation, error) { 286 return c.internalClient.UpdateFeatureOnlineStore(ctx, req, opts...) 287 } 288 289 // UpdateFeatureOnlineStoreOperation returns a new UpdateFeatureOnlineStoreOperation from a given name. 290 // The name must be that of a previously created UpdateFeatureOnlineStoreOperation, possibly from a different process. 291 func (c *FeatureOnlineStoreAdminClient) UpdateFeatureOnlineStoreOperation(name string) *UpdateFeatureOnlineStoreOperation { 292 return c.internalClient.UpdateFeatureOnlineStoreOperation(name) 293 } 294 295 // DeleteFeatureOnlineStore deletes a single FeatureOnlineStore. The FeatureOnlineStore must not 296 // contain any FeatureViews. 297 func (c *FeatureOnlineStoreAdminClient) DeleteFeatureOnlineStore(ctx context.Context, req *aiplatformpb.DeleteFeatureOnlineStoreRequest, opts ...gax.CallOption) (*DeleteFeatureOnlineStoreOperation, error) { 298 return c.internalClient.DeleteFeatureOnlineStore(ctx, req, opts...) 299 } 300 301 // DeleteFeatureOnlineStoreOperation returns a new DeleteFeatureOnlineStoreOperation from a given name. 302 // The name must be that of a previously created DeleteFeatureOnlineStoreOperation, possibly from a different process. 303 func (c *FeatureOnlineStoreAdminClient) DeleteFeatureOnlineStoreOperation(name string) *DeleteFeatureOnlineStoreOperation { 304 return c.internalClient.DeleteFeatureOnlineStoreOperation(name) 305 } 306 307 // CreateFeatureView creates a new FeatureView in a given FeatureOnlineStore. 308 func (c *FeatureOnlineStoreAdminClient) CreateFeatureView(ctx context.Context, req *aiplatformpb.CreateFeatureViewRequest, opts ...gax.CallOption) (*CreateFeatureViewOperation, error) { 309 return c.internalClient.CreateFeatureView(ctx, req, opts...) 310 } 311 312 // CreateFeatureViewOperation returns a new CreateFeatureViewOperation from a given name. 313 // The name must be that of a previously created CreateFeatureViewOperation, possibly from a different process. 314 func (c *FeatureOnlineStoreAdminClient) CreateFeatureViewOperation(name string) *CreateFeatureViewOperation { 315 return c.internalClient.CreateFeatureViewOperation(name) 316 } 317 318 // GetFeatureView gets details of a single FeatureView. 319 func (c *FeatureOnlineStoreAdminClient) GetFeatureView(ctx context.Context, req *aiplatformpb.GetFeatureViewRequest, opts ...gax.CallOption) (*aiplatformpb.FeatureView, error) { 320 return c.internalClient.GetFeatureView(ctx, req, opts...) 321 } 322 323 // ListFeatureViews lists FeatureViews in a given FeatureOnlineStore. 324 func (c *FeatureOnlineStoreAdminClient) ListFeatureViews(ctx context.Context, req *aiplatformpb.ListFeatureViewsRequest, opts ...gax.CallOption) *FeatureViewIterator { 325 return c.internalClient.ListFeatureViews(ctx, req, opts...) 326 } 327 328 // UpdateFeatureView updates the parameters of a single FeatureView. 329 func (c *FeatureOnlineStoreAdminClient) UpdateFeatureView(ctx context.Context, req *aiplatformpb.UpdateFeatureViewRequest, opts ...gax.CallOption) (*UpdateFeatureViewOperation, error) { 330 return c.internalClient.UpdateFeatureView(ctx, req, opts...) 331 } 332 333 // UpdateFeatureViewOperation returns a new UpdateFeatureViewOperation from a given name. 334 // The name must be that of a previously created UpdateFeatureViewOperation, possibly from a different process. 335 func (c *FeatureOnlineStoreAdminClient) UpdateFeatureViewOperation(name string) *UpdateFeatureViewOperation { 336 return c.internalClient.UpdateFeatureViewOperation(name) 337 } 338 339 // DeleteFeatureView deletes a single FeatureView. 340 func (c *FeatureOnlineStoreAdminClient) DeleteFeatureView(ctx context.Context, req *aiplatformpb.DeleteFeatureViewRequest, opts ...gax.CallOption) (*DeleteFeatureViewOperation, error) { 341 return c.internalClient.DeleteFeatureView(ctx, req, opts...) 342 } 343 344 // DeleteFeatureViewOperation returns a new DeleteFeatureViewOperation from a given name. 345 // The name must be that of a previously created DeleteFeatureViewOperation, possibly from a different process. 346 func (c *FeatureOnlineStoreAdminClient) DeleteFeatureViewOperation(name string) *DeleteFeatureViewOperation { 347 return c.internalClient.DeleteFeatureViewOperation(name) 348 } 349 350 // SyncFeatureView triggers on-demand sync for the FeatureView. 351 func (c *FeatureOnlineStoreAdminClient) SyncFeatureView(ctx context.Context, req *aiplatformpb.SyncFeatureViewRequest, opts ...gax.CallOption) (*aiplatformpb.SyncFeatureViewResponse, error) { 352 return c.internalClient.SyncFeatureView(ctx, req, opts...) 353 } 354 355 // GetFeatureViewSync gets details of a single FeatureViewSync. 356 func (c *FeatureOnlineStoreAdminClient) GetFeatureViewSync(ctx context.Context, req *aiplatformpb.GetFeatureViewSyncRequest, opts ...gax.CallOption) (*aiplatformpb.FeatureViewSync, error) { 357 return c.internalClient.GetFeatureViewSync(ctx, req, opts...) 358 } 359 360 // ListFeatureViewSyncs lists FeatureViewSyncs in a given FeatureView. 361 func (c *FeatureOnlineStoreAdminClient) ListFeatureViewSyncs(ctx context.Context, req *aiplatformpb.ListFeatureViewSyncsRequest, opts ...gax.CallOption) *FeatureViewSyncIterator { 362 return c.internalClient.ListFeatureViewSyncs(ctx, req, opts...) 363 } 364 365 // GetLocation gets information about a location. 366 func (c *FeatureOnlineStoreAdminClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { 367 return c.internalClient.GetLocation(ctx, req, opts...) 368 } 369 370 // ListLocations lists information about the supported locations for this service. 371 func (c *FeatureOnlineStoreAdminClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { 372 return c.internalClient.ListLocations(ctx, req, opts...) 373 } 374 375 // GetIamPolicy gets the access control policy for a resource. Returns an empty policy 376 // if the resource exists and does not have a policy set. 377 func (c *FeatureOnlineStoreAdminClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 378 return c.internalClient.GetIamPolicy(ctx, req, opts...) 379 } 380 381 // SetIamPolicy sets the access control policy on the specified resource. Replaces 382 // any existing policy. 383 // 384 // Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED 385 // errors. 386 func (c *FeatureOnlineStoreAdminClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 387 return c.internalClient.SetIamPolicy(ctx, req, opts...) 388 } 389 390 // TestIamPermissions returns permissions that a caller has on the specified resource. If the 391 // resource does not exist, this will return an empty set of 392 // permissions, not a NOT_FOUND error. 393 // 394 // Note: This operation is designed to be used for building 395 // permission-aware UIs and command-line tools, not for authorization 396 // checking. This operation may “fail open” without warning. 397 func (c *FeatureOnlineStoreAdminClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { 398 return c.internalClient.TestIamPermissions(ctx, req, opts...) 399 } 400 401 // CancelOperation is a utility method from google.longrunning.Operations. 402 func (c *FeatureOnlineStoreAdminClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { 403 return c.internalClient.CancelOperation(ctx, req, opts...) 404 } 405 406 // DeleteOperation is a utility method from google.longrunning.Operations. 407 func (c *FeatureOnlineStoreAdminClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { 408 return c.internalClient.DeleteOperation(ctx, req, opts...) 409 } 410 411 // GetOperation is a utility method from google.longrunning.Operations. 412 func (c *FeatureOnlineStoreAdminClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 413 return c.internalClient.GetOperation(ctx, req, opts...) 414 } 415 416 // ListOperations is a utility method from google.longrunning.Operations. 417 func (c *FeatureOnlineStoreAdminClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { 418 return c.internalClient.ListOperations(ctx, req, opts...) 419 } 420 421 // WaitOperation is a utility method from google.longrunning.Operations. 422 func (c *FeatureOnlineStoreAdminClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 423 return c.internalClient.WaitOperation(ctx, req, opts...) 424 } 425 426 // featureOnlineStoreAdminGRPCClient is a client for interacting with Vertex AI API over gRPC transport. 427 // 428 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. 429 type featureOnlineStoreAdminGRPCClient struct { 430 // Connection pool of gRPC connections to the service. 431 connPool gtransport.ConnPool 432 433 // Points back to the CallOptions field of the containing FeatureOnlineStoreAdminClient 434 CallOptions **FeatureOnlineStoreAdminCallOptions 435 436 // The gRPC API client. 437 featureOnlineStoreAdminClient aiplatformpb.FeatureOnlineStoreAdminServiceClient 438 439 // LROClient is used internally to handle long-running operations. 440 // It is exposed so that its CallOptions can be modified if required. 441 // Users should not Close this client. 442 LROClient **lroauto.OperationsClient 443 444 operationsClient longrunningpb.OperationsClient 445 446 iamPolicyClient iampb.IAMPolicyClient 447 448 locationsClient locationpb.LocationsClient 449 450 // The x-goog-* metadata to be sent with each request. 451 xGoogHeaders []string 452 453 logger *slog.Logger 454 } 455 456 // NewFeatureOnlineStoreAdminClient creates a new feature online store admin service client based on gRPC. 457 // The returned client must be Closed when it is done being used to clean up its underlying connections. 458 // 459 // The service that handles CRUD and List for resources for 460 // FeatureOnlineStore. 461 func NewFeatureOnlineStoreAdminClient(ctx context.Context, opts ...option.ClientOption) (*FeatureOnlineStoreAdminClient, error) { 462 clientOpts := defaultFeatureOnlineStoreAdminGRPCClientOptions() 463 if newFeatureOnlineStoreAdminClientHook != nil { 464 hookOpts, err := newFeatureOnlineStoreAdminClientHook(ctx, clientHookParams{}) 465 if err != nil { 466 return nil, err 467 } 468 clientOpts = append(clientOpts, hookOpts...) 469 } 470 471 connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) 472 if err != nil { 473 return nil, err 474 } 475 client := FeatureOnlineStoreAdminClient{CallOptions: defaultFeatureOnlineStoreAdminCallOptions()} 476 477 c := &featureOnlineStoreAdminGRPCClient{ 478 connPool: connPool, 479 featureOnlineStoreAdminClient: aiplatformpb.NewFeatureOnlineStoreAdminServiceClient(connPool), 480 CallOptions: &client.CallOptions, 481 logger: internaloption.GetLogger(opts), 482 operationsClient: longrunningpb.NewOperationsClient(connPool), 483 iamPolicyClient: iampb.NewIAMPolicyClient(connPool), 484 locationsClient: locationpb.NewLocationsClient(connPool), 485 } 486 c.setGoogleClientInfo() 487 488 client.internalClient = c 489 490 client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool)) 491 if err != nil { 492 // This error "should not happen", since we are just reusing old connection pool 493 // and never actually need to dial. 494 // If this does happen, we could leak connp. However, we cannot close conn: 495 // If the user invoked the constructor with option.WithGRPCConn, 496 // we would close a connection that's still in use. 497 // TODO: investigate error conditions. 498 return nil, err 499 } 500 c.LROClient = &client.LROClient 501 return &client, nil 502 } 503 504 // Connection returns a connection to the API service. 505 // 506 // Deprecated: Connections are now pooled so this method does not always 507 // return the same resource. 508 func (c *featureOnlineStoreAdminGRPCClient) Connection() *grpc.ClientConn { 509 return c.connPool.Conn() 510 } 511 512 // setGoogleClientInfo sets the name and version of the application in 513 // the `x-goog-api-client` header passed on each request. Intended for 514 // use by Google-written clients. 515 func (c *featureOnlineStoreAdminGRPCClient) setGoogleClientInfo(keyval ...string) { 516 kv := append([]string{"gl-go", gax.GoVersion}, keyval...) 517 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion) 518 c.xGoogHeaders = []string{ 519 "x-goog-api-client", gax.XGoogHeader(kv...), 520 } 521 } 522 523 // Close closes the connection to the API service. The user should invoke this when 524 // the client is no longer required. 525 func (c *featureOnlineStoreAdminGRPCClient) Close() error { 526 return c.connPool.Close() 527 } 528 529 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. 530 type featureOnlineStoreAdminRESTClient struct { 531 // The http endpoint to connect to. 532 endpoint string 533 534 // The http client. 535 httpClient *http.Client 536 537 // LROClient is used internally to handle long-running operations. 538 // It is exposed so that its CallOptions can be modified if required. 539 // Users should not Close this client. 540 LROClient **lroauto.OperationsClient 541 542 // The x-goog-* headers to be sent with each request. 543 xGoogHeaders []string 544 545 // Points back to the CallOptions field of the containing FeatureOnlineStoreAdminClient 546 CallOptions **FeatureOnlineStoreAdminCallOptions 547 548 logger *slog.Logger 549 } 550 551 // NewFeatureOnlineStoreAdminRESTClient creates a new feature online store admin service rest client. 552 // 553 // The service that handles CRUD and List for resources for 554 // FeatureOnlineStore. 555 func NewFeatureOnlineStoreAdminRESTClient(ctx context.Context, opts ...option.ClientOption) (*FeatureOnlineStoreAdminClient, error) { 556 clientOpts := append(defaultFeatureOnlineStoreAdminRESTClientOptions(), opts...) 557 httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) 558 if err != nil { 559 return nil, err 560 } 561 562 callOpts := defaultFeatureOnlineStoreAdminRESTCallOptions() 563 c := &featureOnlineStoreAdminRESTClient{ 564 endpoint: endpoint, 565 httpClient: httpClient, 566 CallOptions: &callOpts, 567 logger: internaloption.GetLogger(opts), 568 } 569 c.setGoogleClientInfo() 570 571 lroOpts := []option.ClientOption{ 572 option.WithHTTPClient(httpClient), 573 option.WithEndpoint(endpoint), 574 } 575 opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...) 576 if err != nil { 577 return nil, err 578 } 579 c.LROClient = &opClient 580 581 return &FeatureOnlineStoreAdminClient{internalClient: c, CallOptions: callOpts}, nil 582 } 583 584 func defaultFeatureOnlineStoreAdminRESTClientOptions() []option.ClientOption { 585 return []option.ClientOption{ 586 internaloption.WithDefaultEndpoint("https://aiplatform.googleapis.com"), 587 internaloption.WithDefaultEndpointTemplate("https://aiplatform.UNIVERSE_DOMAIN"), 588 internaloption.WithDefaultMTLSEndpoint("https://aiplatform.mtls.googleapis.com"), 589 internaloption.WithDefaultUniverseDomain("googleapis.com"), 590 internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), 591 internaloption.WithDefaultScopes(DefaultAuthScopes()...), 592 internaloption.EnableNewAuthLibrary(), 593 } 594 } 595 596 // setGoogleClientInfo sets the name and version of the application in 597 // the `x-goog-api-client` header passed on each request. Intended for 598 // use by Google-written clients. 599 func (c *featureOnlineStoreAdminRESTClient) setGoogleClientInfo(keyval ...string) { 600 kv := append([]string{"gl-go", gax.GoVersion}, keyval...) 601 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN", "pb", protoVersion) 602 c.xGoogHeaders = []string{ 603 "x-goog-api-client", gax.XGoogHeader(kv...), 604 } 605 } 606 607 // Close closes the connection to the API service. The user should invoke this when 608 // the client is no longer required. 609 func (c *featureOnlineStoreAdminRESTClient) Close() error { 610 // Replace httpClient with nil to force cleanup. 611 c.httpClient = nil 612 return nil 613 } 614 615 // Connection returns a connection to the API service. 616 // 617 // Deprecated: This method always returns nil. 618 func (c *featureOnlineStoreAdminRESTClient) Connection() *grpc.ClientConn { 619 return nil 620 } 621 func (c *featureOnlineStoreAdminGRPCClient) CreateFeatureOnlineStore(ctx context.Context, req *aiplatformpb.CreateFeatureOnlineStoreRequest, opts ...gax.CallOption) (*CreateFeatureOnlineStoreOperation, error) { 622 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 623 624 hds = append(c.xGoogHeaders, hds...) 625 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 626 opts = append((*c.CallOptions).CreateFeatureOnlineStore[0:len((*c.CallOptions).CreateFeatureOnlineStore):len((*c.CallOptions).CreateFeatureOnlineStore)], opts...) 627 var resp *longrunningpb.Operation 628 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 629 var err error 630 resp, err = executeRPC(ctx, c.featureOnlineStoreAdminClient.CreateFeatureOnlineStore, req, settings.GRPC, c.logger, "CreateFeatureOnlineStore") 631 return err 632 }, opts...) 633 if err != nil { 634 return nil, err 635 } 636 return &CreateFeatureOnlineStoreOperation{ 637 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 638 }, nil 639 } 640 641 func (c *featureOnlineStoreAdminGRPCClient) GetFeatureOnlineStore(ctx context.Context, req *aiplatformpb.GetFeatureOnlineStoreRequest, opts ...gax.CallOption) (*aiplatformpb.FeatureOnlineStore, error) { 642 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 643 644 hds = append(c.xGoogHeaders, hds...) 645 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 646 opts = append((*c.CallOptions).GetFeatureOnlineStore[0:len((*c.CallOptions).GetFeatureOnlineStore):len((*c.CallOptions).GetFeatureOnlineStore)], opts...) 647 var resp *aiplatformpb.FeatureOnlineStore 648 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 649 var err error 650 resp, err = executeRPC(ctx, c.featureOnlineStoreAdminClient.GetFeatureOnlineStore, req, settings.GRPC, c.logger, "GetFeatureOnlineStore") 651 return err 652 }, opts...) 653 if err != nil { 654 return nil, err 655 } 656 return resp, nil 657 } 658 659 func (c *featureOnlineStoreAdminGRPCClient) ListFeatureOnlineStores(ctx context.Context, req *aiplatformpb.ListFeatureOnlineStoresRequest, opts ...gax.CallOption) *FeatureOnlineStoreIterator { 660 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 661 662 hds = append(c.xGoogHeaders, hds...) 663 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 664 opts = append((*c.CallOptions).ListFeatureOnlineStores[0:len((*c.CallOptions).ListFeatureOnlineStores):len((*c.CallOptions).ListFeatureOnlineStores)], opts...) 665 it := &FeatureOnlineStoreIterator{} 666 req = proto.Clone(req).(*aiplatformpb.ListFeatureOnlineStoresRequest) 667 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.FeatureOnlineStore, string, error) { 668 resp := &aiplatformpb.ListFeatureOnlineStoresResponse{} 669 if pageToken != "" { 670 req.PageToken = pageToken 671 } 672 if pageSize > math.MaxInt32 { 673 req.PageSize = math.MaxInt32 674 } else if pageSize != 0 { 675 req.PageSize = int32(pageSize) 676 } 677 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 678 var err error 679 resp, err = executeRPC(ctx, c.featureOnlineStoreAdminClient.ListFeatureOnlineStores, req, settings.GRPC, c.logger, "ListFeatureOnlineStores") 680 return err 681 }, opts...) 682 if err != nil { 683 return nil, "", err 684 } 685 686 it.Response = resp 687 return resp.GetFeatureOnlineStores(), resp.GetNextPageToken(), nil 688 } 689 fetch := func(pageSize int, pageToken string) (string, error) { 690 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 691 if err != nil { 692 return "", err 693 } 694 it.items = append(it.items, items...) 695 return nextPageToken, nil 696 } 697 698 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 699 it.pageInfo.MaxSize = int(req.GetPageSize()) 700 it.pageInfo.Token = req.GetPageToken() 701 702 return it 703 } 704 705 func (c *featureOnlineStoreAdminGRPCClient) UpdateFeatureOnlineStore(ctx context.Context, req *aiplatformpb.UpdateFeatureOnlineStoreRequest, opts ...gax.CallOption) (*UpdateFeatureOnlineStoreOperation, error) { 706 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "feature_online_store.name", url.QueryEscape(req.GetFeatureOnlineStore().GetName()))} 707 708 hds = append(c.xGoogHeaders, hds...) 709 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 710 opts = append((*c.CallOptions).UpdateFeatureOnlineStore[0:len((*c.CallOptions).UpdateFeatureOnlineStore):len((*c.CallOptions).UpdateFeatureOnlineStore)], opts...) 711 var resp *longrunningpb.Operation 712 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 713 var err error 714 resp, err = executeRPC(ctx, c.featureOnlineStoreAdminClient.UpdateFeatureOnlineStore, req, settings.GRPC, c.logger, "UpdateFeatureOnlineStore") 715 return err 716 }, opts...) 717 if err != nil { 718 return nil, err 719 } 720 return &UpdateFeatureOnlineStoreOperation{ 721 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 722 }, nil 723 } 724 725 func (c *featureOnlineStoreAdminGRPCClient) DeleteFeatureOnlineStore(ctx context.Context, req *aiplatformpb.DeleteFeatureOnlineStoreRequest, opts ...gax.CallOption) (*DeleteFeatureOnlineStoreOperation, error) { 726 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 727 728 hds = append(c.xGoogHeaders, hds...) 729 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 730 opts = append((*c.CallOptions).DeleteFeatureOnlineStore[0:len((*c.CallOptions).DeleteFeatureOnlineStore):len((*c.CallOptions).DeleteFeatureOnlineStore)], opts...) 731 var resp *longrunningpb.Operation 732 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 733 var err error 734 resp, err = executeRPC(ctx, c.featureOnlineStoreAdminClient.DeleteFeatureOnlineStore, req, settings.GRPC, c.logger, "DeleteFeatureOnlineStore") 735 return err 736 }, opts...) 737 if err != nil { 738 return nil, err 739 } 740 return &DeleteFeatureOnlineStoreOperation{ 741 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 742 }, nil 743 } 744 745 func (c *featureOnlineStoreAdminGRPCClient) CreateFeatureView(ctx context.Context, req *aiplatformpb.CreateFeatureViewRequest, opts ...gax.CallOption) (*CreateFeatureViewOperation, error) { 746 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 747 748 hds = append(c.xGoogHeaders, hds...) 749 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 750 opts = append((*c.CallOptions).CreateFeatureView[0:len((*c.CallOptions).CreateFeatureView):len((*c.CallOptions).CreateFeatureView)], opts...) 751 var resp *longrunningpb.Operation 752 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 753 var err error 754 resp, err = executeRPC(ctx, c.featureOnlineStoreAdminClient.CreateFeatureView, req, settings.GRPC, c.logger, "CreateFeatureView") 755 return err 756 }, opts...) 757 if err != nil { 758 return nil, err 759 } 760 return &CreateFeatureViewOperation{ 761 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 762 }, nil 763 } 764 765 func (c *featureOnlineStoreAdminGRPCClient) GetFeatureView(ctx context.Context, req *aiplatformpb.GetFeatureViewRequest, opts ...gax.CallOption) (*aiplatformpb.FeatureView, error) { 766 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 767 768 hds = append(c.xGoogHeaders, hds...) 769 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 770 opts = append((*c.CallOptions).GetFeatureView[0:len((*c.CallOptions).GetFeatureView):len((*c.CallOptions).GetFeatureView)], opts...) 771 var resp *aiplatformpb.FeatureView 772 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 773 var err error 774 resp, err = executeRPC(ctx, c.featureOnlineStoreAdminClient.GetFeatureView, req, settings.GRPC, c.logger, "GetFeatureView") 775 return err 776 }, opts...) 777 if err != nil { 778 return nil, err 779 } 780 return resp, nil 781 } 782 783 func (c *featureOnlineStoreAdminGRPCClient) ListFeatureViews(ctx context.Context, req *aiplatformpb.ListFeatureViewsRequest, opts ...gax.CallOption) *FeatureViewIterator { 784 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 785 786 hds = append(c.xGoogHeaders, hds...) 787 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 788 opts = append((*c.CallOptions).ListFeatureViews[0:len((*c.CallOptions).ListFeatureViews):len((*c.CallOptions).ListFeatureViews)], opts...) 789 it := &FeatureViewIterator{} 790 req = proto.Clone(req).(*aiplatformpb.ListFeatureViewsRequest) 791 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.FeatureView, string, error) { 792 resp := &aiplatformpb.ListFeatureViewsResponse{} 793 if pageToken != "" { 794 req.PageToken = pageToken 795 } 796 if pageSize > math.MaxInt32 { 797 req.PageSize = math.MaxInt32 798 } else if pageSize != 0 { 799 req.PageSize = int32(pageSize) 800 } 801 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 802 var err error 803 resp, err = executeRPC(ctx, c.featureOnlineStoreAdminClient.ListFeatureViews, req, settings.GRPC, c.logger, "ListFeatureViews") 804 return err 805 }, opts...) 806 if err != nil { 807 return nil, "", err 808 } 809 810 it.Response = resp 811 return resp.GetFeatureViews(), resp.GetNextPageToken(), nil 812 } 813 fetch := func(pageSize int, pageToken string) (string, error) { 814 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 815 if err != nil { 816 return "", err 817 } 818 it.items = append(it.items, items...) 819 return nextPageToken, nil 820 } 821 822 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 823 it.pageInfo.MaxSize = int(req.GetPageSize()) 824 it.pageInfo.Token = req.GetPageToken() 825 826 return it 827 } 828 829 func (c *featureOnlineStoreAdminGRPCClient) UpdateFeatureView(ctx context.Context, req *aiplatformpb.UpdateFeatureViewRequest, opts ...gax.CallOption) (*UpdateFeatureViewOperation, error) { 830 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "feature_view.name", url.QueryEscape(req.GetFeatureView().GetName()))} 831 832 hds = append(c.xGoogHeaders, hds...) 833 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 834 opts = append((*c.CallOptions).UpdateFeatureView[0:len((*c.CallOptions).UpdateFeatureView):len((*c.CallOptions).UpdateFeatureView)], opts...) 835 var resp *longrunningpb.Operation 836 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 837 var err error 838 resp, err = executeRPC(ctx, c.featureOnlineStoreAdminClient.UpdateFeatureView, req, settings.GRPC, c.logger, "UpdateFeatureView") 839 return err 840 }, opts...) 841 if err != nil { 842 return nil, err 843 } 844 return &UpdateFeatureViewOperation{ 845 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 846 }, nil 847 } 848 849 func (c *featureOnlineStoreAdminGRPCClient) DeleteFeatureView(ctx context.Context, req *aiplatformpb.DeleteFeatureViewRequest, opts ...gax.CallOption) (*DeleteFeatureViewOperation, error) { 850 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 851 852 hds = append(c.xGoogHeaders, hds...) 853 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 854 opts = append((*c.CallOptions).DeleteFeatureView[0:len((*c.CallOptions).DeleteFeatureView):len((*c.CallOptions).DeleteFeatureView)], opts...) 855 var resp *longrunningpb.Operation 856 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 857 var err error 858 resp, err = executeRPC(ctx, c.featureOnlineStoreAdminClient.DeleteFeatureView, req, settings.GRPC, c.logger, "DeleteFeatureView") 859 return err 860 }, opts...) 861 if err != nil { 862 return nil, err 863 } 864 return &DeleteFeatureViewOperation{ 865 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 866 }, nil 867 } 868 869 func (c *featureOnlineStoreAdminGRPCClient) SyncFeatureView(ctx context.Context, req *aiplatformpb.SyncFeatureViewRequest, opts ...gax.CallOption) (*aiplatformpb.SyncFeatureViewResponse, error) { 870 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "feature_view", url.QueryEscape(req.GetFeatureView()))} 871 872 hds = append(c.xGoogHeaders, hds...) 873 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 874 opts = append((*c.CallOptions).SyncFeatureView[0:len((*c.CallOptions).SyncFeatureView):len((*c.CallOptions).SyncFeatureView)], opts...) 875 var resp *aiplatformpb.SyncFeatureViewResponse 876 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 877 var err error 878 resp, err = executeRPC(ctx, c.featureOnlineStoreAdminClient.SyncFeatureView, req, settings.GRPC, c.logger, "SyncFeatureView") 879 return err 880 }, opts...) 881 if err != nil { 882 return nil, err 883 } 884 return resp, nil 885 } 886 887 func (c *featureOnlineStoreAdminGRPCClient) GetFeatureViewSync(ctx context.Context, req *aiplatformpb.GetFeatureViewSyncRequest, opts ...gax.CallOption) (*aiplatformpb.FeatureViewSync, error) { 888 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 889 890 hds = append(c.xGoogHeaders, hds...) 891 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 892 opts = append((*c.CallOptions).GetFeatureViewSync[0:len((*c.CallOptions).GetFeatureViewSync):len((*c.CallOptions).GetFeatureViewSync)], opts...) 893 var resp *aiplatformpb.FeatureViewSync 894 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 895 var err error 896 resp, err = executeRPC(ctx, c.featureOnlineStoreAdminClient.GetFeatureViewSync, req, settings.GRPC, c.logger, "GetFeatureViewSync") 897 return err 898 }, opts...) 899 if err != nil { 900 return nil, err 901 } 902 return resp, nil 903 } 904 905 func (c *featureOnlineStoreAdminGRPCClient) ListFeatureViewSyncs(ctx context.Context, req *aiplatformpb.ListFeatureViewSyncsRequest, opts ...gax.CallOption) *FeatureViewSyncIterator { 906 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 907 908 hds = append(c.xGoogHeaders, hds...) 909 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 910 opts = append((*c.CallOptions).ListFeatureViewSyncs[0:len((*c.CallOptions).ListFeatureViewSyncs):len((*c.CallOptions).ListFeatureViewSyncs)], opts...) 911 it := &FeatureViewSyncIterator{} 912 req = proto.Clone(req).(*aiplatformpb.ListFeatureViewSyncsRequest) 913 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.FeatureViewSync, string, error) { 914 resp := &aiplatformpb.ListFeatureViewSyncsResponse{} 915 if pageToken != "" { 916 req.PageToken = pageToken 917 } 918 if pageSize > math.MaxInt32 { 919 req.PageSize = math.MaxInt32 920 } else if pageSize != 0 { 921 req.PageSize = int32(pageSize) 922 } 923 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 924 var err error 925 resp, err = executeRPC(ctx, c.featureOnlineStoreAdminClient.ListFeatureViewSyncs, req, settings.GRPC, c.logger, "ListFeatureViewSyncs") 926 return err 927 }, opts...) 928 if err != nil { 929 return nil, "", err 930 } 931 932 it.Response = resp 933 return resp.GetFeatureViewSyncs(), resp.GetNextPageToken(), nil 934 } 935 fetch := func(pageSize int, pageToken string) (string, error) { 936 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 937 if err != nil { 938 return "", err 939 } 940 it.items = append(it.items, items...) 941 return nextPageToken, nil 942 } 943 944 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 945 it.pageInfo.MaxSize = int(req.GetPageSize()) 946 it.pageInfo.Token = req.GetPageToken() 947 948 return it 949 } 950 951 func (c *featureOnlineStoreAdminGRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { 952 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 953 954 hds = append(c.xGoogHeaders, hds...) 955 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 956 opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...) 957 var resp *locationpb.Location 958 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 959 var err error 960 resp, err = executeRPC(ctx, c.locationsClient.GetLocation, req, settings.GRPC, c.logger, "GetLocation") 961 return err 962 }, opts...) 963 if err != nil { 964 return nil, err 965 } 966 return resp, nil 967 } 968 969 func (c *featureOnlineStoreAdminGRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { 970 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 971 972 hds = append(c.xGoogHeaders, hds...) 973 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 974 opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...) 975 it := &LocationIterator{} 976 req = proto.Clone(req).(*locationpb.ListLocationsRequest) 977 it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) { 978 resp := &locationpb.ListLocationsResponse{} 979 if pageToken != "" { 980 req.PageToken = pageToken 981 } 982 if pageSize > math.MaxInt32 { 983 req.PageSize = math.MaxInt32 984 } else if pageSize != 0 { 985 req.PageSize = int32(pageSize) 986 } 987 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 988 var err error 989 resp, err = executeRPC(ctx, c.locationsClient.ListLocations, req, settings.GRPC, c.logger, "ListLocations") 990 return err 991 }, opts...) 992 if err != nil { 993 return nil, "", err 994 } 995 996 it.Response = resp 997 return resp.GetLocations(), resp.GetNextPageToken(), nil 998 } 999 fetch := func(pageSize int, pageToken string) (string, error) { 1000 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 1001 if err != nil { 1002 return "", err 1003 } 1004 it.items = append(it.items, items...) 1005 return nextPageToken, nil 1006 } 1007 1008 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 1009 it.pageInfo.MaxSize = int(req.GetPageSize()) 1010 it.pageInfo.Token = req.GetPageToken() 1011 1012 return it 1013 } 1014 1015 func (c *featureOnlineStoreAdminGRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 1016 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 1017 1018 hds = append(c.xGoogHeaders, hds...) 1019 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1020 opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...) 1021 var resp *iampb.Policy 1022 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1023 var err error 1024 resp, err = executeRPC(ctx, c.iamPolicyClient.GetIamPolicy, req, settings.GRPC, c.logger, "GetIamPolicy") 1025 return err 1026 }, opts...) 1027 if err != nil { 1028 return nil, err 1029 } 1030 return resp, nil 1031 } 1032 1033 func (c *featureOnlineStoreAdminGRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 1034 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 1035 1036 hds = append(c.xGoogHeaders, hds...) 1037 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1038 opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...) 1039 var resp *iampb.Policy 1040 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1041 var err error 1042 resp, err = executeRPC(ctx, c.iamPolicyClient.SetIamPolicy, req, settings.GRPC, c.logger, "SetIamPolicy") 1043 return err 1044 }, opts...) 1045 if err != nil { 1046 return nil, err 1047 } 1048 return resp, nil 1049 } 1050 1051 func (c *featureOnlineStoreAdminGRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { 1052 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 1053 1054 hds = append(c.xGoogHeaders, hds...) 1055 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1056 opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...) 1057 var resp *iampb.TestIamPermissionsResponse 1058 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1059 var err error 1060 resp, err = executeRPC(ctx, c.iamPolicyClient.TestIamPermissions, req, settings.GRPC, c.logger, "TestIamPermissions") 1061 return err 1062 }, opts...) 1063 if err != nil { 1064 return nil, err 1065 } 1066 return resp, nil 1067 } 1068 1069 func (c *featureOnlineStoreAdminGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { 1070 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1071 1072 hds = append(c.xGoogHeaders, hds...) 1073 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1074 opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...) 1075 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1076 var err error 1077 _, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation") 1078 return err 1079 }, opts...) 1080 return err 1081 } 1082 1083 func (c *featureOnlineStoreAdminGRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { 1084 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1085 1086 hds = append(c.xGoogHeaders, hds...) 1087 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1088 opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...) 1089 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1090 var err error 1091 _, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation") 1092 return err 1093 }, opts...) 1094 return err 1095 } 1096 1097 func (c *featureOnlineStoreAdminGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 1098 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1099 1100 hds = append(c.xGoogHeaders, hds...) 1101 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1102 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...) 1103 var resp *longrunningpb.Operation 1104 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1105 var err error 1106 resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation") 1107 return err 1108 }, opts...) 1109 if err != nil { 1110 return nil, err 1111 } 1112 return resp, nil 1113 } 1114 1115 func (c *featureOnlineStoreAdminGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { 1116 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1117 1118 hds = append(c.xGoogHeaders, hds...) 1119 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1120 opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...) 1121 it := &OperationIterator{} 1122 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest) 1123 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) { 1124 resp := &longrunningpb.ListOperationsResponse{} 1125 if pageToken != "" { 1126 req.PageToken = pageToken 1127 } 1128 if pageSize > math.MaxInt32 { 1129 req.PageSize = math.MaxInt32 1130 } else if pageSize != 0 { 1131 req.PageSize = int32(pageSize) 1132 } 1133 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1134 var err error 1135 resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations") 1136 return err 1137 }, opts...) 1138 if err != nil { 1139 return nil, "", err 1140 } 1141 1142 it.Response = resp 1143 return resp.GetOperations(), resp.GetNextPageToken(), nil 1144 } 1145 fetch := func(pageSize int, pageToken string) (string, error) { 1146 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 1147 if err != nil { 1148 return "", err 1149 } 1150 it.items = append(it.items, items...) 1151 return nextPageToken, nil 1152 } 1153 1154 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 1155 it.pageInfo.MaxSize = int(req.GetPageSize()) 1156 it.pageInfo.Token = req.GetPageToken() 1157 1158 return it 1159 } 1160 1161 func (c *featureOnlineStoreAdminGRPCClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 1162 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1163 1164 hds = append(c.xGoogHeaders, hds...) 1165 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 1166 opts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...) 1167 var resp *longrunningpb.Operation 1168 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1169 var err error 1170 resp, err = executeRPC(ctx, c.operationsClient.WaitOperation, req, settings.GRPC, c.logger, "WaitOperation") 1171 return err 1172 }, opts...) 1173 if err != nil { 1174 return nil, err 1175 } 1176 return resp, nil 1177 } 1178 1179 // CreateFeatureOnlineStore creates a new FeatureOnlineStore in a given project and location. 1180 func (c *featureOnlineStoreAdminRESTClient) CreateFeatureOnlineStore(ctx context.Context, req *aiplatformpb.CreateFeatureOnlineStoreRequest, opts ...gax.CallOption) (*CreateFeatureOnlineStoreOperation, error) { 1181 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 1182 body := req.GetFeatureOnlineStore() 1183 jsonReq, err := m.Marshal(body) 1184 if err != nil { 1185 return nil, err 1186 } 1187 1188 baseUrl, err := url.Parse(c.endpoint) 1189 if err != nil { 1190 return nil, err 1191 } 1192 baseUrl.Path += fmt.Sprintf("/v1beta1/%v/featureOnlineStores", req.GetParent()) 1193 1194 params := url.Values{} 1195 params.Add("$alt", "json;enum-encoding=int") 1196 params.Add("featureOnlineStoreId", fmt.Sprintf("%v", req.GetFeatureOnlineStoreId())) 1197 1198 baseUrl.RawQuery = params.Encode() 1199 1200 // Build HTTP headers from client and context metadata. 1201 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 1202 1203 hds = append(c.xGoogHeaders, hds...) 1204 hds = append(hds, "Content-Type", "application/json") 1205 headers := gax.BuildHeaders(ctx, hds...) 1206 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1207 resp := &longrunningpb.Operation{} 1208 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1209 if settings.Path != "" { 1210 baseUrl.Path = settings.Path 1211 } 1212 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 1213 if err != nil { 1214 return err 1215 } 1216 httpReq = httpReq.WithContext(ctx) 1217 httpReq.Header = headers 1218 1219 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateFeatureOnlineStore") 1220 if err != nil { 1221 return err 1222 } 1223 if err := unm.Unmarshal(buf, resp); err != nil { 1224 return err 1225 } 1226 1227 return nil 1228 }, opts...) 1229 if e != nil { 1230 return nil, e 1231 } 1232 1233 override := fmt.Sprintf("/ui/%s", resp.GetName()) 1234 return &CreateFeatureOnlineStoreOperation{ 1235 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1236 pollPath: override, 1237 }, nil 1238 } 1239 1240 // GetFeatureOnlineStore gets details of a single FeatureOnlineStore. 1241 func (c *featureOnlineStoreAdminRESTClient) GetFeatureOnlineStore(ctx context.Context, req *aiplatformpb.GetFeatureOnlineStoreRequest, opts ...gax.CallOption) (*aiplatformpb.FeatureOnlineStore, error) { 1242 baseUrl, err := url.Parse(c.endpoint) 1243 if err != nil { 1244 return nil, err 1245 } 1246 baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetName()) 1247 1248 params := url.Values{} 1249 params.Add("$alt", "json;enum-encoding=int") 1250 1251 baseUrl.RawQuery = params.Encode() 1252 1253 // Build HTTP headers from client and context metadata. 1254 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1255 1256 hds = append(c.xGoogHeaders, hds...) 1257 hds = append(hds, "Content-Type", "application/json") 1258 headers := gax.BuildHeaders(ctx, hds...) 1259 opts = append((*c.CallOptions).GetFeatureOnlineStore[0:len((*c.CallOptions).GetFeatureOnlineStore):len((*c.CallOptions).GetFeatureOnlineStore)], opts...) 1260 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1261 resp := &aiplatformpb.FeatureOnlineStore{} 1262 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1263 if settings.Path != "" { 1264 baseUrl.Path = settings.Path 1265 } 1266 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 1267 if err != nil { 1268 return err 1269 } 1270 httpReq = httpReq.WithContext(ctx) 1271 httpReq.Header = headers 1272 1273 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetFeatureOnlineStore") 1274 if err != nil { 1275 return err 1276 } 1277 1278 if err := unm.Unmarshal(buf, resp); err != nil { 1279 return err 1280 } 1281 1282 return nil 1283 }, opts...) 1284 if e != nil { 1285 return nil, e 1286 } 1287 return resp, nil 1288 } 1289 1290 // ListFeatureOnlineStores lists FeatureOnlineStores in a given project and location. 1291 func (c *featureOnlineStoreAdminRESTClient) ListFeatureOnlineStores(ctx context.Context, req *aiplatformpb.ListFeatureOnlineStoresRequest, opts ...gax.CallOption) *FeatureOnlineStoreIterator { 1292 it := &FeatureOnlineStoreIterator{} 1293 req = proto.Clone(req).(*aiplatformpb.ListFeatureOnlineStoresRequest) 1294 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1295 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.FeatureOnlineStore, string, error) { 1296 resp := &aiplatformpb.ListFeatureOnlineStoresResponse{} 1297 if pageToken != "" { 1298 req.PageToken = pageToken 1299 } 1300 if pageSize > math.MaxInt32 { 1301 req.PageSize = math.MaxInt32 1302 } else if pageSize != 0 { 1303 req.PageSize = int32(pageSize) 1304 } 1305 baseUrl, err := url.Parse(c.endpoint) 1306 if err != nil { 1307 return nil, "", err 1308 } 1309 baseUrl.Path += fmt.Sprintf("/v1beta1/%v/featureOnlineStores", req.GetParent()) 1310 1311 params := url.Values{} 1312 params.Add("$alt", "json;enum-encoding=int") 1313 if req.GetFilter() != "" { 1314 params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) 1315 } 1316 if req.GetOrderBy() != "" { 1317 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) 1318 } 1319 if req.GetPageSize() != 0 { 1320 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) 1321 } 1322 if req.GetPageToken() != "" { 1323 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) 1324 } 1325 1326 baseUrl.RawQuery = params.Encode() 1327 1328 // Build HTTP headers from client and context metadata. 1329 hds := append(c.xGoogHeaders, "Content-Type", "application/json") 1330 headers := gax.BuildHeaders(ctx, hds...) 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.Header = headers 1340 1341 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListFeatureOnlineStores") 1342 if err != nil { 1343 return err 1344 } 1345 if err := unm.Unmarshal(buf, resp); err != nil { 1346 return err 1347 } 1348 1349 return nil 1350 }, opts...) 1351 if e != nil { 1352 return nil, "", e 1353 } 1354 it.Response = resp 1355 return resp.GetFeatureOnlineStores(), resp.GetNextPageToken(), nil 1356 } 1357 1358 fetch := func(pageSize int, pageToken string) (string, error) { 1359 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 1360 if err != nil { 1361 return "", err 1362 } 1363 it.items = append(it.items, items...) 1364 return nextPageToken, nil 1365 } 1366 1367 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 1368 it.pageInfo.MaxSize = int(req.GetPageSize()) 1369 it.pageInfo.Token = req.GetPageToken() 1370 1371 return it 1372 } 1373 1374 // UpdateFeatureOnlineStore updates the parameters of a single FeatureOnlineStore. 1375 func (c *featureOnlineStoreAdminRESTClient) UpdateFeatureOnlineStore(ctx context.Context, req *aiplatformpb.UpdateFeatureOnlineStoreRequest, opts ...gax.CallOption) (*UpdateFeatureOnlineStoreOperation, error) { 1376 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 1377 body := req.GetFeatureOnlineStore() 1378 jsonReq, err := m.Marshal(body) 1379 if err != nil { 1380 return nil, err 1381 } 1382 1383 baseUrl, err := url.Parse(c.endpoint) 1384 if err != nil { 1385 return nil, err 1386 } 1387 baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetFeatureOnlineStore().GetName()) 1388 1389 params := url.Values{} 1390 params.Add("$alt", "json;enum-encoding=int") 1391 if req.GetUpdateMask() != nil { 1392 field, err := protojson.Marshal(req.GetUpdateMask()) 1393 if err != nil { 1394 return nil, err 1395 } 1396 params.Add("updateMask", string(field[1:len(field)-1])) 1397 } 1398 1399 baseUrl.RawQuery = params.Encode() 1400 1401 // Build HTTP headers from client and context metadata. 1402 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "feature_online_store.name", url.QueryEscape(req.GetFeatureOnlineStore().GetName()))} 1403 1404 hds = append(c.xGoogHeaders, hds...) 1405 hds = append(hds, "Content-Type", "application/json") 1406 headers := gax.BuildHeaders(ctx, hds...) 1407 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1408 resp := &longrunningpb.Operation{} 1409 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1410 if settings.Path != "" { 1411 baseUrl.Path = settings.Path 1412 } 1413 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) 1414 if err != nil { 1415 return err 1416 } 1417 httpReq = httpReq.WithContext(ctx) 1418 httpReq.Header = headers 1419 1420 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateFeatureOnlineStore") 1421 if err != nil { 1422 return err 1423 } 1424 if err := unm.Unmarshal(buf, resp); err != nil { 1425 return err 1426 } 1427 1428 return nil 1429 }, opts...) 1430 if e != nil { 1431 return nil, e 1432 } 1433 1434 override := fmt.Sprintf("/ui/%s", resp.GetName()) 1435 return &UpdateFeatureOnlineStoreOperation{ 1436 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1437 pollPath: override, 1438 }, nil 1439 } 1440 1441 // DeleteFeatureOnlineStore deletes a single FeatureOnlineStore. The FeatureOnlineStore must not 1442 // contain any FeatureViews. 1443 func (c *featureOnlineStoreAdminRESTClient) DeleteFeatureOnlineStore(ctx context.Context, req *aiplatformpb.DeleteFeatureOnlineStoreRequest, opts ...gax.CallOption) (*DeleteFeatureOnlineStoreOperation, error) { 1444 baseUrl, err := url.Parse(c.endpoint) 1445 if err != nil { 1446 return nil, err 1447 } 1448 baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetName()) 1449 1450 params := url.Values{} 1451 params.Add("$alt", "json;enum-encoding=int") 1452 if req.GetForce() { 1453 params.Add("force", fmt.Sprintf("%v", req.GetForce())) 1454 } 1455 1456 baseUrl.RawQuery = params.Encode() 1457 1458 // Build HTTP headers from client and context metadata. 1459 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1460 1461 hds = append(c.xGoogHeaders, hds...) 1462 hds = append(hds, "Content-Type", "application/json") 1463 headers := gax.BuildHeaders(ctx, hds...) 1464 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1465 resp := &longrunningpb.Operation{} 1466 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1467 if settings.Path != "" { 1468 baseUrl.Path = settings.Path 1469 } 1470 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) 1471 if err != nil { 1472 return err 1473 } 1474 httpReq = httpReq.WithContext(ctx) 1475 httpReq.Header = headers 1476 1477 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteFeatureOnlineStore") 1478 if err != nil { 1479 return err 1480 } 1481 if err := unm.Unmarshal(buf, resp); err != nil { 1482 return err 1483 } 1484 1485 return nil 1486 }, opts...) 1487 if e != nil { 1488 return nil, e 1489 } 1490 1491 override := fmt.Sprintf("/ui/%s", resp.GetName()) 1492 return &DeleteFeatureOnlineStoreOperation{ 1493 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1494 pollPath: override, 1495 }, nil 1496 } 1497 1498 // CreateFeatureView creates a new FeatureView in a given FeatureOnlineStore. 1499 func (c *featureOnlineStoreAdminRESTClient) CreateFeatureView(ctx context.Context, req *aiplatformpb.CreateFeatureViewRequest, opts ...gax.CallOption) (*CreateFeatureViewOperation, error) { 1500 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 1501 body := req.GetFeatureView() 1502 jsonReq, err := m.Marshal(body) 1503 if err != nil { 1504 return nil, err 1505 } 1506 1507 baseUrl, err := url.Parse(c.endpoint) 1508 if err != nil { 1509 return nil, err 1510 } 1511 baseUrl.Path += fmt.Sprintf("/v1beta1/%v/featureViews", req.GetParent()) 1512 1513 params := url.Values{} 1514 params.Add("$alt", "json;enum-encoding=int") 1515 params.Add("featureViewId", fmt.Sprintf("%v", req.GetFeatureViewId())) 1516 if req.GetRunSyncImmediately() { 1517 params.Add("runSyncImmediately", fmt.Sprintf("%v", req.GetRunSyncImmediately())) 1518 } 1519 1520 baseUrl.RawQuery = params.Encode() 1521 1522 // Build HTTP headers from client and context metadata. 1523 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 1524 1525 hds = append(c.xGoogHeaders, hds...) 1526 hds = append(hds, "Content-Type", "application/json") 1527 headers := gax.BuildHeaders(ctx, hds...) 1528 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1529 resp := &longrunningpb.Operation{} 1530 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1531 if settings.Path != "" { 1532 baseUrl.Path = settings.Path 1533 } 1534 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 1535 if err != nil { 1536 return err 1537 } 1538 httpReq = httpReq.WithContext(ctx) 1539 httpReq.Header = headers 1540 1541 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateFeatureView") 1542 if err != nil { 1543 return err 1544 } 1545 if err := unm.Unmarshal(buf, resp); err != nil { 1546 return err 1547 } 1548 1549 return nil 1550 }, opts...) 1551 if e != nil { 1552 return nil, e 1553 } 1554 1555 override := fmt.Sprintf("/ui/%s", resp.GetName()) 1556 return &CreateFeatureViewOperation{ 1557 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1558 pollPath: override, 1559 }, nil 1560 } 1561 1562 // GetFeatureView gets details of a single FeatureView. 1563 func (c *featureOnlineStoreAdminRESTClient) GetFeatureView(ctx context.Context, req *aiplatformpb.GetFeatureViewRequest, opts ...gax.CallOption) (*aiplatformpb.FeatureView, error) { 1564 baseUrl, err := url.Parse(c.endpoint) 1565 if err != nil { 1566 return nil, err 1567 } 1568 baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetName()) 1569 1570 params := url.Values{} 1571 params.Add("$alt", "json;enum-encoding=int") 1572 1573 baseUrl.RawQuery = params.Encode() 1574 1575 // Build HTTP headers from client and context metadata. 1576 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1577 1578 hds = append(c.xGoogHeaders, hds...) 1579 hds = append(hds, "Content-Type", "application/json") 1580 headers := gax.BuildHeaders(ctx, hds...) 1581 opts = append((*c.CallOptions).GetFeatureView[0:len((*c.CallOptions).GetFeatureView):len((*c.CallOptions).GetFeatureView)], opts...) 1582 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1583 resp := &aiplatformpb.FeatureView{} 1584 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1585 if settings.Path != "" { 1586 baseUrl.Path = settings.Path 1587 } 1588 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 1589 if err != nil { 1590 return err 1591 } 1592 httpReq = httpReq.WithContext(ctx) 1593 httpReq.Header = headers 1594 1595 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetFeatureView") 1596 if err != nil { 1597 return err 1598 } 1599 1600 if err := unm.Unmarshal(buf, resp); err != nil { 1601 return err 1602 } 1603 1604 return nil 1605 }, opts...) 1606 if e != nil { 1607 return nil, e 1608 } 1609 return resp, nil 1610 } 1611 1612 // ListFeatureViews lists FeatureViews in a given FeatureOnlineStore. 1613 func (c *featureOnlineStoreAdminRESTClient) ListFeatureViews(ctx context.Context, req *aiplatformpb.ListFeatureViewsRequest, opts ...gax.CallOption) *FeatureViewIterator { 1614 it := &FeatureViewIterator{} 1615 req = proto.Clone(req).(*aiplatformpb.ListFeatureViewsRequest) 1616 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1617 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.FeatureView, string, error) { 1618 resp := &aiplatformpb.ListFeatureViewsResponse{} 1619 if pageToken != "" { 1620 req.PageToken = pageToken 1621 } 1622 if pageSize > math.MaxInt32 { 1623 req.PageSize = math.MaxInt32 1624 } else if pageSize != 0 { 1625 req.PageSize = int32(pageSize) 1626 } 1627 baseUrl, err := url.Parse(c.endpoint) 1628 if err != nil { 1629 return nil, "", err 1630 } 1631 baseUrl.Path += fmt.Sprintf("/v1beta1/%v/featureViews", req.GetParent()) 1632 1633 params := url.Values{} 1634 params.Add("$alt", "json;enum-encoding=int") 1635 if req.GetFilter() != "" { 1636 params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) 1637 } 1638 if req.GetOrderBy() != "" { 1639 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) 1640 } 1641 if req.GetPageSize() != 0 { 1642 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) 1643 } 1644 if req.GetPageToken() != "" { 1645 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) 1646 } 1647 1648 baseUrl.RawQuery = params.Encode() 1649 1650 // Build HTTP headers from client and context metadata. 1651 hds := append(c.xGoogHeaders, "Content-Type", "application/json") 1652 headers := gax.BuildHeaders(ctx, hds...) 1653 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1654 if settings.Path != "" { 1655 baseUrl.Path = settings.Path 1656 } 1657 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 1658 if err != nil { 1659 return err 1660 } 1661 httpReq.Header = headers 1662 1663 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListFeatureViews") 1664 if err != nil { 1665 return err 1666 } 1667 if err := unm.Unmarshal(buf, resp); err != nil { 1668 return err 1669 } 1670 1671 return nil 1672 }, opts...) 1673 if e != nil { 1674 return nil, "", e 1675 } 1676 it.Response = resp 1677 return resp.GetFeatureViews(), resp.GetNextPageToken(), nil 1678 } 1679 1680 fetch := func(pageSize int, pageToken string) (string, error) { 1681 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 1682 if err != nil { 1683 return "", err 1684 } 1685 it.items = append(it.items, items...) 1686 return nextPageToken, nil 1687 } 1688 1689 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 1690 it.pageInfo.MaxSize = int(req.GetPageSize()) 1691 it.pageInfo.Token = req.GetPageToken() 1692 1693 return it 1694 } 1695 1696 // UpdateFeatureView updates the parameters of a single FeatureView. 1697 func (c *featureOnlineStoreAdminRESTClient) UpdateFeatureView(ctx context.Context, req *aiplatformpb.UpdateFeatureViewRequest, opts ...gax.CallOption) (*UpdateFeatureViewOperation, error) { 1698 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 1699 body := req.GetFeatureView() 1700 jsonReq, err := m.Marshal(body) 1701 if err != nil { 1702 return nil, err 1703 } 1704 1705 baseUrl, err := url.Parse(c.endpoint) 1706 if err != nil { 1707 return nil, err 1708 } 1709 baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetFeatureView().GetName()) 1710 1711 params := url.Values{} 1712 params.Add("$alt", "json;enum-encoding=int") 1713 if req.GetUpdateMask() != nil { 1714 field, err := protojson.Marshal(req.GetUpdateMask()) 1715 if err != nil { 1716 return nil, err 1717 } 1718 params.Add("updateMask", string(field[1:len(field)-1])) 1719 } 1720 1721 baseUrl.RawQuery = params.Encode() 1722 1723 // Build HTTP headers from client and context metadata. 1724 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "feature_view.name", url.QueryEscape(req.GetFeatureView().GetName()))} 1725 1726 hds = append(c.xGoogHeaders, hds...) 1727 hds = append(hds, "Content-Type", "application/json") 1728 headers := gax.BuildHeaders(ctx, hds...) 1729 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1730 resp := &longrunningpb.Operation{} 1731 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1732 if settings.Path != "" { 1733 baseUrl.Path = settings.Path 1734 } 1735 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) 1736 if err != nil { 1737 return err 1738 } 1739 httpReq = httpReq.WithContext(ctx) 1740 httpReq.Header = headers 1741 1742 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateFeatureView") 1743 if err != nil { 1744 return err 1745 } 1746 if err := unm.Unmarshal(buf, resp); err != nil { 1747 return err 1748 } 1749 1750 return nil 1751 }, opts...) 1752 if e != nil { 1753 return nil, e 1754 } 1755 1756 override := fmt.Sprintf("/ui/%s", resp.GetName()) 1757 return &UpdateFeatureViewOperation{ 1758 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1759 pollPath: override, 1760 }, nil 1761 } 1762 1763 // DeleteFeatureView deletes a single FeatureView. 1764 func (c *featureOnlineStoreAdminRESTClient) DeleteFeatureView(ctx context.Context, req *aiplatformpb.DeleteFeatureViewRequest, opts ...gax.CallOption) (*DeleteFeatureViewOperation, error) { 1765 baseUrl, err := url.Parse(c.endpoint) 1766 if err != nil { 1767 return nil, err 1768 } 1769 baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetName()) 1770 1771 params := url.Values{} 1772 params.Add("$alt", "json;enum-encoding=int") 1773 1774 baseUrl.RawQuery = params.Encode() 1775 1776 // Build HTTP headers from client and context metadata. 1777 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1778 1779 hds = append(c.xGoogHeaders, hds...) 1780 hds = append(hds, "Content-Type", "application/json") 1781 headers := gax.BuildHeaders(ctx, hds...) 1782 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1783 resp := &longrunningpb.Operation{} 1784 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1785 if settings.Path != "" { 1786 baseUrl.Path = settings.Path 1787 } 1788 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) 1789 if err != nil { 1790 return err 1791 } 1792 httpReq = httpReq.WithContext(ctx) 1793 httpReq.Header = headers 1794 1795 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteFeatureView") 1796 if err != nil { 1797 return err 1798 } 1799 if err := unm.Unmarshal(buf, resp); err != nil { 1800 return err 1801 } 1802 1803 return nil 1804 }, opts...) 1805 if e != nil { 1806 return nil, e 1807 } 1808 1809 override := fmt.Sprintf("/ui/%s", resp.GetName()) 1810 return &DeleteFeatureViewOperation{ 1811 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 1812 pollPath: override, 1813 }, nil 1814 } 1815 1816 // SyncFeatureView triggers on-demand sync for the FeatureView. 1817 func (c *featureOnlineStoreAdminRESTClient) SyncFeatureView(ctx context.Context, req *aiplatformpb.SyncFeatureViewRequest, opts ...gax.CallOption) (*aiplatformpb.SyncFeatureViewResponse, error) { 1818 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 1819 jsonReq, err := m.Marshal(req) 1820 if err != nil { 1821 return nil, err 1822 } 1823 1824 baseUrl, err := url.Parse(c.endpoint) 1825 if err != nil { 1826 return nil, err 1827 } 1828 baseUrl.Path += fmt.Sprintf("/v1beta1/%v:sync", req.GetFeatureView()) 1829 1830 params := url.Values{} 1831 params.Add("$alt", "json;enum-encoding=int") 1832 1833 baseUrl.RawQuery = params.Encode() 1834 1835 // Build HTTP headers from client and context metadata. 1836 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "feature_view", url.QueryEscape(req.GetFeatureView()))} 1837 1838 hds = append(c.xGoogHeaders, hds...) 1839 hds = append(hds, "Content-Type", "application/json") 1840 headers := gax.BuildHeaders(ctx, hds...) 1841 opts = append((*c.CallOptions).SyncFeatureView[0:len((*c.CallOptions).SyncFeatureView):len((*c.CallOptions).SyncFeatureView)], opts...) 1842 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1843 resp := &aiplatformpb.SyncFeatureViewResponse{} 1844 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1845 if settings.Path != "" { 1846 baseUrl.Path = settings.Path 1847 } 1848 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 1849 if err != nil { 1850 return err 1851 } 1852 httpReq = httpReq.WithContext(ctx) 1853 httpReq.Header = headers 1854 1855 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "SyncFeatureView") 1856 if err != nil { 1857 return err 1858 } 1859 1860 if err := unm.Unmarshal(buf, resp); err != nil { 1861 return err 1862 } 1863 1864 return nil 1865 }, opts...) 1866 if e != nil { 1867 return nil, e 1868 } 1869 return resp, nil 1870 } 1871 1872 // GetFeatureViewSync gets details of a single FeatureViewSync. 1873 func (c *featureOnlineStoreAdminRESTClient) GetFeatureViewSync(ctx context.Context, req *aiplatformpb.GetFeatureViewSyncRequest, opts ...gax.CallOption) (*aiplatformpb.FeatureViewSync, error) { 1874 baseUrl, err := url.Parse(c.endpoint) 1875 if err != nil { 1876 return nil, err 1877 } 1878 baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetName()) 1879 1880 params := url.Values{} 1881 params.Add("$alt", "json;enum-encoding=int") 1882 1883 baseUrl.RawQuery = params.Encode() 1884 1885 // Build HTTP headers from client and context metadata. 1886 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 1887 1888 hds = append(c.xGoogHeaders, hds...) 1889 hds = append(hds, "Content-Type", "application/json") 1890 headers := gax.BuildHeaders(ctx, hds...) 1891 opts = append((*c.CallOptions).GetFeatureViewSync[0:len((*c.CallOptions).GetFeatureViewSync):len((*c.CallOptions).GetFeatureViewSync)], opts...) 1892 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1893 resp := &aiplatformpb.FeatureViewSync{} 1894 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1895 if settings.Path != "" { 1896 baseUrl.Path = settings.Path 1897 } 1898 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 1899 if err != nil { 1900 return err 1901 } 1902 httpReq = httpReq.WithContext(ctx) 1903 httpReq.Header = headers 1904 1905 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetFeatureViewSync") 1906 if err != nil { 1907 return err 1908 } 1909 1910 if err := unm.Unmarshal(buf, resp); err != nil { 1911 return err 1912 } 1913 1914 return nil 1915 }, opts...) 1916 if e != nil { 1917 return nil, e 1918 } 1919 return resp, nil 1920 } 1921 1922 // ListFeatureViewSyncs lists FeatureViewSyncs in a given FeatureView. 1923 func (c *featureOnlineStoreAdminRESTClient) ListFeatureViewSyncs(ctx context.Context, req *aiplatformpb.ListFeatureViewSyncsRequest, opts ...gax.CallOption) *FeatureViewSyncIterator { 1924 it := &FeatureViewSyncIterator{} 1925 req = proto.Clone(req).(*aiplatformpb.ListFeatureViewSyncsRequest) 1926 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 1927 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.FeatureViewSync, string, error) { 1928 resp := &aiplatformpb.ListFeatureViewSyncsResponse{} 1929 if pageToken != "" { 1930 req.PageToken = pageToken 1931 } 1932 if pageSize > math.MaxInt32 { 1933 req.PageSize = math.MaxInt32 1934 } else if pageSize != 0 { 1935 req.PageSize = int32(pageSize) 1936 } 1937 baseUrl, err := url.Parse(c.endpoint) 1938 if err != nil { 1939 return nil, "", err 1940 } 1941 baseUrl.Path += fmt.Sprintf("/v1beta1/%v/featureViewSyncs", req.GetParent()) 1942 1943 params := url.Values{} 1944 params.Add("$alt", "json;enum-encoding=int") 1945 if req.GetFilter() != "" { 1946 params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) 1947 } 1948 if req.GetOrderBy() != "" { 1949 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) 1950 } 1951 if req.GetPageSize() != 0 { 1952 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) 1953 } 1954 if req.GetPageToken() != "" { 1955 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) 1956 } 1957 1958 baseUrl.RawQuery = params.Encode() 1959 1960 // Build HTTP headers from client and context metadata. 1961 hds := append(c.xGoogHeaders, "Content-Type", "application/json") 1962 headers := gax.BuildHeaders(ctx, hds...) 1963 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 1964 if settings.Path != "" { 1965 baseUrl.Path = settings.Path 1966 } 1967 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 1968 if err != nil { 1969 return err 1970 } 1971 httpReq.Header = headers 1972 1973 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListFeatureViewSyncs") 1974 if err != nil { 1975 return err 1976 } 1977 if err := unm.Unmarshal(buf, resp); err != nil { 1978 return err 1979 } 1980 1981 return nil 1982 }, opts...) 1983 if e != nil { 1984 return nil, "", e 1985 } 1986 it.Response = resp 1987 return resp.GetFeatureViewSyncs(), resp.GetNextPageToken(), nil 1988 } 1989 1990 fetch := func(pageSize int, pageToken string) (string, error) { 1991 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 1992 if err != nil { 1993 return "", err 1994 } 1995 it.items = append(it.items, items...) 1996 return nextPageToken, nil 1997 } 1998 1999 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 2000 it.pageInfo.MaxSize = int(req.GetPageSize()) 2001 it.pageInfo.Token = req.GetPageToken() 2002 2003 return it 2004 } 2005 2006 // GetLocation gets information about a location. 2007 func (c *featureOnlineStoreAdminRESTClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { 2008 baseUrl, err := url.Parse(c.endpoint) 2009 if err != nil { 2010 return nil, err 2011 } 2012 baseUrl.Path += fmt.Sprintf("/ui/%v", req.GetName()) 2013 2014 params := url.Values{} 2015 params.Add("$alt", "json;enum-encoding=int") 2016 2017 baseUrl.RawQuery = params.Encode() 2018 2019 // Build HTTP headers from client and context metadata. 2020 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 2021 2022 hds = append(c.xGoogHeaders, hds...) 2023 hds = append(hds, "Content-Type", "application/json") 2024 headers := gax.BuildHeaders(ctx, hds...) 2025 opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...) 2026 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2027 resp := &locationpb.Location{} 2028 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2029 if settings.Path != "" { 2030 baseUrl.Path = settings.Path 2031 } 2032 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 2033 if err != nil { 2034 return err 2035 } 2036 httpReq = httpReq.WithContext(ctx) 2037 httpReq.Header = headers 2038 2039 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetLocation") 2040 if err != nil { 2041 return err 2042 } 2043 2044 if err := unm.Unmarshal(buf, resp); err != nil { 2045 return err 2046 } 2047 2048 return nil 2049 }, opts...) 2050 if e != nil { 2051 return nil, e 2052 } 2053 return resp, nil 2054 } 2055 2056 // ListLocations lists information about the supported locations for this service. 2057 func (c *featureOnlineStoreAdminRESTClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { 2058 it := &LocationIterator{} 2059 req = proto.Clone(req).(*locationpb.ListLocationsRequest) 2060 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2061 it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) { 2062 resp := &locationpb.ListLocationsResponse{} 2063 if pageToken != "" { 2064 req.PageToken = pageToken 2065 } 2066 if pageSize > math.MaxInt32 { 2067 req.PageSize = math.MaxInt32 2068 } else if pageSize != 0 { 2069 req.PageSize = int32(pageSize) 2070 } 2071 baseUrl, err := url.Parse(c.endpoint) 2072 if err != nil { 2073 return nil, "", err 2074 } 2075 baseUrl.Path += fmt.Sprintf("/ui/%v/locations", req.GetName()) 2076 2077 params := url.Values{} 2078 params.Add("$alt", "json;enum-encoding=int") 2079 if req.GetFilter() != "" { 2080 params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) 2081 } 2082 if req.GetPageSize() != 0 { 2083 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) 2084 } 2085 if req.GetPageToken() != "" { 2086 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) 2087 } 2088 2089 baseUrl.RawQuery = params.Encode() 2090 2091 // Build HTTP headers from client and context metadata. 2092 hds := append(c.xGoogHeaders, "Content-Type", "application/json") 2093 headers := gax.BuildHeaders(ctx, hds...) 2094 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2095 if settings.Path != "" { 2096 baseUrl.Path = settings.Path 2097 } 2098 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 2099 if err != nil { 2100 return err 2101 } 2102 httpReq.Header = headers 2103 2104 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListLocations") 2105 if err != nil { 2106 return err 2107 } 2108 if err := unm.Unmarshal(buf, resp); err != nil { 2109 return err 2110 } 2111 2112 return nil 2113 }, opts...) 2114 if e != nil { 2115 return nil, "", e 2116 } 2117 it.Response = resp 2118 return resp.GetLocations(), resp.GetNextPageToken(), nil 2119 } 2120 2121 fetch := func(pageSize int, pageToken string) (string, error) { 2122 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 2123 if err != nil { 2124 return "", err 2125 } 2126 it.items = append(it.items, items...) 2127 return nextPageToken, nil 2128 } 2129 2130 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 2131 it.pageInfo.MaxSize = int(req.GetPageSize()) 2132 it.pageInfo.Token = req.GetPageToken() 2133 2134 return it 2135 } 2136 2137 // GetIamPolicy gets the access control policy for a resource. Returns an empty policy 2138 // if the resource exists and does not have a policy set. 2139 func (c *featureOnlineStoreAdminRESTClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 2140 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 2141 jsonReq, err := m.Marshal(req) 2142 if err != nil { 2143 return nil, err 2144 } 2145 2146 baseUrl, err := url.Parse(c.endpoint) 2147 if err != nil { 2148 return nil, err 2149 } 2150 baseUrl.Path += fmt.Sprintf("/v1beta1/%v:getIamPolicy", req.GetResource()) 2151 2152 params := url.Values{} 2153 params.Add("$alt", "json;enum-encoding=int") 2154 2155 baseUrl.RawQuery = params.Encode() 2156 2157 // Build HTTP headers from client and context metadata. 2158 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 2159 2160 hds = append(c.xGoogHeaders, hds...) 2161 hds = append(hds, "Content-Type", "application/json") 2162 headers := gax.BuildHeaders(ctx, hds...) 2163 opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...) 2164 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2165 resp := &iampb.Policy{} 2166 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2167 if settings.Path != "" { 2168 baseUrl.Path = settings.Path 2169 } 2170 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 2171 if err != nil { 2172 return err 2173 } 2174 httpReq = httpReq.WithContext(ctx) 2175 httpReq.Header = headers 2176 2177 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "GetIamPolicy") 2178 if err != nil { 2179 return err 2180 } 2181 2182 if err := unm.Unmarshal(buf, resp); err != nil { 2183 return err 2184 } 2185 2186 return nil 2187 }, opts...) 2188 if e != nil { 2189 return nil, e 2190 } 2191 return resp, nil 2192 } 2193 2194 // SetIamPolicy sets the access control policy on the specified resource. Replaces 2195 // any existing policy. 2196 // 2197 // Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED 2198 // errors. 2199 func (c *featureOnlineStoreAdminRESTClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 2200 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 2201 jsonReq, err := m.Marshal(req) 2202 if err != nil { 2203 return nil, err 2204 } 2205 2206 baseUrl, err := url.Parse(c.endpoint) 2207 if err != nil { 2208 return nil, err 2209 } 2210 baseUrl.Path += fmt.Sprintf("/v1beta1/%v:setIamPolicy", req.GetResource()) 2211 2212 params := url.Values{} 2213 params.Add("$alt", "json;enum-encoding=int") 2214 2215 baseUrl.RawQuery = params.Encode() 2216 2217 // Build HTTP headers from client and context metadata. 2218 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 2219 2220 hds = append(c.xGoogHeaders, hds...) 2221 hds = append(hds, "Content-Type", "application/json") 2222 headers := gax.BuildHeaders(ctx, hds...) 2223 opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...) 2224 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2225 resp := &iampb.Policy{} 2226 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2227 if settings.Path != "" { 2228 baseUrl.Path = settings.Path 2229 } 2230 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 2231 if err != nil { 2232 return err 2233 } 2234 httpReq = httpReq.WithContext(ctx) 2235 httpReq.Header = headers 2236 2237 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "SetIamPolicy") 2238 if err != nil { 2239 return err 2240 } 2241 2242 if err := unm.Unmarshal(buf, resp); err != nil { 2243 return err 2244 } 2245 2246 return nil 2247 }, opts...) 2248 if e != nil { 2249 return nil, e 2250 } 2251 return resp, nil 2252 } 2253 2254 // TestIamPermissions returns permissions that a caller has on the specified resource. If the 2255 // resource does not exist, this will return an empty set of 2256 // permissions, not a NOT_FOUND error. 2257 // 2258 // Note: This operation is designed to be used for building 2259 // permission-aware UIs and command-line tools, not for authorization 2260 // checking. This operation may “fail open” without warning. 2261 func (c *featureOnlineStoreAdminRESTClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { 2262 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} 2263 jsonReq, err := m.Marshal(req) 2264 if err != nil { 2265 return nil, err 2266 } 2267 2268 baseUrl, err := url.Parse(c.endpoint) 2269 if err != nil { 2270 return nil, err 2271 } 2272 baseUrl.Path += fmt.Sprintf("/v1beta1/%v:testIamPermissions", req.GetResource()) 2273 2274 params := url.Values{} 2275 params.Add("$alt", "json;enum-encoding=int") 2276 2277 baseUrl.RawQuery = params.Encode() 2278 2279 // Build HTTP headers from client and context metadata. 2280 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 2281 2282 hds = append(c.xGoogHeaders, hds...) 2283 hds = append(hds, "Content-Type", "application/json") 2284 headers := gax.BuildHeaders(ctx, hds...) 2285 opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...) 2286 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2287 resp := &iampb.TestIamPermissionsResponse{} 2288 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2289 if settings.Path != "" { 2290 baseUrl.Path = settings.Path 2291 } 2292 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) 2293 if err != nil { 2294 return err 2295 } 2296 httpReq = httpReq.WithContext(ctx) 2297 httpReq.Header = headers 2298 2299 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "TestIamPermissions") 2300 if err != nil { 2301 return err 2302 } 2303 2304 if err := unm.Unmarshal(buf, resp); err != nil { 2305 return err 2306 } 2307 2308 return nil 2309 }, opts...) 2310 if e != nil { 2311 return nil, e 2312 } 2313 return resp, nil 2314 } 2315 2316 // CancelOperation is a utility method from google.longrunning.Operations. 2317 func (c *featureOnlineStoreAdminRESTClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { 2318 baseUrl, err := url.Parse(c.endpoint) 2319 if err != nil { 2320 return err 2321 } 2322 baseUrl.Path += fmt.Sprintf("/ui/%v:cancel", req.GetName()) 2323 2324 params := url.Values{} 2325 params.Add("$alt", "json;enum-encoding=int") 2326 2327 baseUrl.RawQuery = params.Encode() 2328 2329 // Build HTTP headers from client and context metadata. 2330 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 2331 2332 hds = append(c.xGoogHeaders, hds...) 2333 hds = append(hds, "Content-Type", "application/json") 2334 headers := gax.BuildHeaders(ctx, hds...) 2335 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2336 if settings.Path != "" { 2337 baseUrl.Path = settings.Path 2338 } 2339 httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) 2340 if err != nil { 2341 return err 2342 } 2343 httpReq = httpReq.WithContext(ctx) 2344 httpReq.Header = headers 2345 2346 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "CancelOperation") 2347 return err 2348 }, opts...) 2349 } 2350 2351 // DeleteOperation is a utility method from google.longrunning.Operations. 2352 func (c *featureOnlineStoreAdminRESTClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { 2353 baseUrl, err := url.Parse(c.endpoint) 2354 if err != nil { 2355 return err 2356 } 2357 baseUrl.Path += fmt.Sprintf("/ui/%v", req.GetName()) 2358 2359 params := url.Values{} 2360 params.Add("$alt", "json;enum-encoding=int") 2361 2362 baseUrl.RawQuery = params.Encode() 2363 2364 // Build HTTP headers from client and context metadata. 2365 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 2366 2367 hds = append(c.xGoogHeaders, hds...) 2368 hds = append(hds, "Content-Type", "application/json") 2369 headers := gax.BuildHeaders(ctx, hds...) 2370 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2371 if settings.Path != "" { 2372 baseUrl.Path = settings.Path 2373 } 2374 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) 2375 if err != nil { 2376 return err 2377 } 2378 httpReq = httpReq.WithContext(ctx) 2379 httpReq.Header = headers 2380 2381 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteOperation") 2382 return err 2383 }, opts...) 2384 } 2385 2386 // GetOperation is a utility method from google.longrunning.Operations. 2387 func (c *featureOnlineStoreAdminRESTClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 2388 baseUrl, err := url.Parse(c.endpoint) 2389 if err != nil { 2390 return nil, err 2391 } 2392 baseUrl.Path += fmt.Sprintf("/ui/%v", req.GetName()) 2393 2394 params := url.Values{} 2395 params.Add("$alt", "json;enum-encoding=int") 2396 2397 baseUrl.RawQuery = params.Encode() 2398 2399 // Build HTTP headers from client and context metadata. 2400 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 2401 2402 hds = append(c.xGoogHeaders, hds...) 2403 hds = append(hds, "Content-Type", "application/json") 2404 headers := gax.BuildHeaders(ctx, hds...) 2405 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...) 2406 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2407 resp := &longrunningpb.Operation{} 2408 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2409 if settings.Path != "" { 2410 baseUrl.Path = settings.Path 2411 } 2412 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 2413 if err != nil { 2414 return err 2415 } 2416 httpReq = httpReq.WithContext(ctx) 2417 httpReq.Header = headers 2418 2419 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetOperation") 2420 if err != nil { 2421 return err 2422 } 2423 2424 if err := unm.Unmarshal(buf, resp); err != nil { 2425 return err 2426 } 2427 2428 return nil 2429 }, opts...) 2430 if e != nil { 2431 return nil, e 2432 } 2433 return resp, nil 2434 } 2435 2436 // ListOperations is a utility method from google.longrunning.Operations. 2437 func (c *featureOnlineStoreAdminRESTClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { 2438 it := &OperationIterator{} 2439 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest) 2440 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2441 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) { 2442 resp := &longrunningpb.ListOperationsResponse{} 2443 if pageToken != "" { 2444 req.PageToken = pageToken 2445 } 2446 if pageSize > math.MaxInt32 { 2447 req.PageSize = math.MaxInt32 2448 } else if pageSize != 0 { 2449 req.PageSize = int32(pageSize) 2450 } 2451 baseUrl, err := url.Parse(c.endpoint) 2452 if err != nil { 2453 return nil, "", err 2454 } 2455 baseUrl.Path += fmt.Sprintf("/ui/%v/operations", req.GetName()) 2456 2457 params := url.Values{} 2458 params.Add("$alt", "json;enum-encoding=int") 2459 if req.GetFilter() != "" { 2460 params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) 2461 } 2462 if req.GetPageSize() != 0 { 2463 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) 2464 } 2465 if req.GetPageToken() != "" { 2466 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) 2467 } 2468 2469 baseUrl.RawQuery = params.Encode() 2470 2471 // Build HTTP headers from client and context metadata. 2472 hds := append(c.xGoogHeaders, "Content-Type", "application/json") 2473 headers := gax.BuildHeaders(ctx, hds...) 2474 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2475 if settings.Path != "" { 2476 baseUrl.Path = settings.Path 2477 } 2478 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) 2479 if err != nil { 2480 return err 2481 } 2482 httpReq.Header = headers 2483 2484 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListOperations") 2485 if err != nil { 2486 return err 2487 } 2488 if err := unm.Unmarshal(buf, resp); err != nil { 2489 return err 2490 } 2491 2492 return nil 2493 }, opts...) 2494 if e != nil { 2495 return nil, "", e 2496 } 2497 it.Response = resp 2498 return resp.GetOperations(), resp.GetNextPageToken(), nil 2499 } 2500 2501 fetch := func(pageSize int, pageToken string) (string, error) { 2502 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 2503 if err != nil { 2504 return "", err 2505 } 2506 it.items = append(it.items, items...) 2507 return nextPageToken, nil 2508 } 2509 2510 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 2511 it.pageInfo.MaxSize = int(req.GetPageSize()) 2512 it.pageInfo.Token = req.GetPageToken() 2513 2514 return it 2515 } 2516 2517 // WaitOperation is a utility method from google.longrunning.Operations. 2518 func (c *featureOnlineStoreAdminRESTClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 2519 baseUrl, err := url.Parse(c.endpoint) 2520 if err != nil { 2521 return nil, err 2522 } 2523 baseUrl.Path += fmt.Sprintf("/ui/%v:wait", req.GetName()) 2524 2525 params := url.Values{} 2526 params.Add("$alt", "json;enum-encoding=int") 2527 if req.GetTimeout() != nil { 2528 field, err := protojson.Marshal(req.GetTimeout()) 2529 if err != nil { 2530 return nil, err 2531 } 2532 params.Add("timeout", string(field[1:len(field)-1])) 2533 } 2534 2535 baseUrl.RawQuery = params.Encode() 2536 2537 // Build HTTP headers from client and context metadata. 2538 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 2539 2540 hds = append(c.xGoogHeaders, hds...) 2541 hds = append(hds, "Content-Type", "application/json") 2542 headers := gax.BuildHeaders(ctx, hds...) 2543 opts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...) 2544 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} 2545 resp := &longrunningpb.Operation{} 2546 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 2547 if settings.Path != "" { 2548 baseUrl.Path = settings.Path 2549 } 2550 httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) 2551 if err != nil { 2552 return err 2553 } 2554 httpReq = httpReq.WithContext(ctx) 2555 httpReq.Header = headers 2556 2557 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "WaitOperation") 2558 if err != nil { 2559 return err 2560 } 2561 2562 if err := unm.Unmarshal(buf, resp); err != nil { 2563 return err 2564 } 2565 2566 return nil 2567 }, opts...) 2568 if e != nil { 2569 return nil, e 2570 } 2571 return resp, nil 2572 } 2573 2574 // CreateFeatureOnlineStoreOperation returns a new CreateFeatureOnlineStoreOperation from a given name. 2575 // The name must be that of a previously created CreateFeatureOnlineStoreOperation, possibly from a different process. 2576 func (c *featureOnlineStoreAdminGRPCClient) CreateFeatureOnlineStoreOperation(name string) *CreateFeatureOnlineStoreOperation { 2577 return &CreateFeatureOnlineStoreOperation{ 2578 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 2579 } 2580 } 2581 2582 // CreateFeatureOnlineStoreOperation returns a new CreateFeatureOnlineStoreOperation from a given name. 2583 // The name must be that of a previously created CreateFeatureOnlineStoreOperation, possibly from a different process. 2584 func (c *featureOnlineStoreAdminRESTClient) CreateFeatureOnlineStoreOperation(name string) *CreateFeatureOnlineStoreOperation { 2585 override := fmt.Sprintf("/ui/%s", name) 2586 return &CreateFeatureOnlineStoreOperation{ 2587 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 2588 pollPath: override, 2589 } 2590 } 2591 2592 // CreateFeatureViewOperation returns a new CreateFeatureViewOperation from a given name. 2593 // The name must be that of a previously created CreateFeatureViewOperation, possibly from a different process. 2594 func (c *featureOnlineStoreAdminGRPCClient) CreateFeatureViewOperation(name string) *CreateFeatureViewOperation { 2595 return &CreateFeatureViewOperation{ 2596 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 2597 } 2598 } 2599 2600 // CreateFeatureViewOperation returns a new CreateFeatureViewOperation from a given name. 2601 // The name must be that of a previously created CreateFeatureViewOperation, possibly from a different process. 2602 func (c *featureOnlineStoreAdminRESTClient) CreateFeatureViewOperation(name string) *CreateFeatureViewOperation { 2603 override := fmt.Sprintf("/ui/%s", name) 2604 return &CreateFeatureViewOperation{ 2605 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 2606 pollPath: override, 2607 } 2608 } 2609 2610 // DeleteFeatureOnlineStoreOperation returns a new DeleteFeatureOnlineStoreOperation from a given name. 2611 // The name must be that of a previously created DeleteFeatureOnlineStoreOperation, possibly from a different process. 2612 func (c *featureOnlineStoreAdminGRPCClient) DeleteFeatureOnlineStoreOperation(name string) *DeleteFeatureOnlineStoreOperation { 2613 return &DeleteFeatureOnlineStoreOperation{ 2614 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 2615 } 2616 } 2617 2618 // DeleteFeatureOnlineStoreOperation returns a new DeleteFeatureOnlineStoreOperation from a given name. 2619 // The name must be that of a previously created DeleteFeatureOnlineStoreOperation, possibly from a different process. 2620 func (c *featureOnlineStoreAdminRESTClient) DeleteFeatureOnlineStoreOperation(name string) *DeleteFeatureOnlineStoreOperation { 2621 override := fmt.Sprintf("/ui/%s", name) 2622 return &DeleteFeatureOnlineStoreOperation{ 2623 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 2624 pollPath: override, 2625 } 2626 } 2627 2628 // DeleteFeatureViewOperation returns a new DeleteFeatureViewOperation from a given name. 2629 // The name must be that of a previously created DeleteFeatureViewOperation, possibly from a different process. 2630 func (c *featureOnlineStoreAdminGRPCClient) DeleteFeatureViewOperation(name string) *DeleteFeatureViewOperation { 2631 return &DeleteFeatureViewOperation{ 2632 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 2633 } 2634 } 2635 2636 // DeleteFeatureViewOperation returns a new DeleteFeatureViewOperation from a given name. 2637 // The name must be that of a previously created DeleteFeatureViewOperation, possibly from a different process. 2638 func (c *featureOnlineStoreAdminRESTClient) DeleteFeatureViewOperation(name string) *DeleteFeatureViewOperation { 2639 override := fmt.Sprintf("/ui/%s", name) 2640 return &DeleteFeatureViewOperation{ 2641 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 2642 pollPath: override, 2643 } 2644 } 2645 2646 // UpdateFeatureOnlineStoreOperation returns a new UpdateFeatureOnlineStoreOperation from a given name. 2647 // The name must be that of a previously created UpdateFeatureOnlineStoreOperation, possibly from a different process. 2648 func (c *featureOnlineStoreAdminGRPCClient) UpdateFeatureOnlineStoreOperation(name string) *UpdateFeatureOnlineStoreOperation { 2649 return &UpdateFeatureOnlineStoreOperation{ 2650 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 2651 } 2652 } 2653 2654 // UpdateFeatureOnlineStoreOperation returns a new UpdateFeatureOnlineStoreOperation from a given name. 2655 // The name must be that of a previously created UpdateFeatureOnlineStoreOperation, possibly from a different process. 2656 func (c *featureOnlineStoreAdminRESTClient) UpdateFeatureOnlineStoreOperation(name string) *UpdateFeatureOnlineStoreOperation { 2657 override := fmt.Sprintf("/ui/%s", name) 2658 return &UpdateFeatureOnlineStoreOperation{ 2659 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 2660 pollPath: override, 2661 } 2662 } 2663 2664 // UpdateFeatureViewOperation returns a new UpdateFeatureViewOperation from a given name. 2665 // The name must be that of a previously created UpdateFeatureViewOperation, possibly from a different process. 2666 func (c *featureOnlineStoreAdminGRPCClient) UpdateFeatureViewOperation(name string) *UpdateFeatureViewOperation { 2667 return &UpdateFeatureViewOperation{ 2668 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 2669 } 2670 } 2671 2672 // UpdateFeatureViewOperation returns a new UpdateFeatureViewOperation from a given name. 2673 // The name must be that of a previously created UpdateFeatureViewOperation, possibly from a different process. 2674 func (c *featureOnlineStoreAdminRESTClient) UpdateFeatureViewOperation(name string) *UpdateFeatureViewOperation { 2675 override := fmt.Sprintf("/ui/%s", name) 2676 return &UpdateFeatureViewOperation{ 2677 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 2678 pollPath: override, 2679 } 2680 }