cloud.google.com/go/aiplatform@v1.106.0/apiv1/feature_registry_client.go (about) 1 // Copyright 2025 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Code generated by protoc-gen-go_gapic. DO NOT EDIT. 16 17 package aiplatform 18 19 import ( 20 "context" 21 "fmt" 22 "log/slog" 23 "math" 24 "net/url" 25 26 aiplatformpb "cloud.google.com/go/aiplatform/apiv1/aiplatformpb" 27 iampb "cloud.google.com/go/iam/apiv1/iampb" 28 "cloud.google.com/go/longrunning" 29 lroauto "cloud.google.com/go/longrunning/autogen" 30 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" 31 gax "github.com/googleapis/gax-go/v2" 32 "google.golang.org/api/iterator" 33 "google.golang.org/api/option" 34 "google.golang.org/api/option/internaloption" 35 gtransport "google.golang.org/api/transport/grpc" 36 locationpb "google.golang.org/genproto/googleapis/cloud/location" 37 "google.golang.org/grpc" 38 "google.golang.org/protobuf/proto" 39 ) 40 41 var newFeatureRegistryClientHook clientHook 42 43 // FeatureRegistryCallOptions contains the retry settings for each method of FeatureRegistryClient. 44 type FeatureRegistryCallOptions struct { 45 CreateFeatureGroup []gax.CallOption 46 GetFeatureGroup []gax.CallOption 47 ListFeatureGroups []gax.CallOption 48 UpdateFeatureGroup []gax.CallOption 49 DeleteFeatureGroup []gax.CallOption 50 CreateFeature []gax.CallOption 51 BatchCreateFeatures []gax.CallOption 52 GetFeature []gax.CallOption 53 ListFeatures []gax.CallOption 54 UpdateFeature []gax.CallOption 55 DeleteFeature []gax.CallOption 56 GetLocation []gax.CallOption 57 ListLocations []gax.CallOption 58 GetIamPolicy []gax.CallOption 59 SetIamPolicy []gax.CallOption 60 TestIamPermissions []gax.CallOption 61 CancelOperation []gax.CallOption 62 DeleteOperation []gax.CallOption 63 GetOperation []gax.CallOption 64 ListOperations []gax.CallOption 65 WaitOperation []gax.CallOption 66 } 67 68 func defaultFeatureRegistryGRPCClientOptions() []option.ClientOption { 69 return []option.ClientOption{ 70 internaloption.WithDefaultEndpoint("aiplatform.googleapis.com:443"), 71 internaloption.WithDefaultEndpointTemplate("aiplatform.UNIVERSE_DOMAIN:443"), 72 internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"), 73 internaloption.WithDefaultUniverseDomain("googleapis.com"), 74 internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), 75 internaloption.WithDefaultScopes(DefaultAuthScopes()...), 76 internaloption.EnableJwtWithScope(), 77 internaloption.EnableNewAuthLibrary(), 78 option.WithGRPCDialOption(grpc.WithDefaultCallOptions( 79 grpc.MaxCallRecvMsgSize(math.MaxInt32))), 80 } 81 } 82 83 func defaultFeatureRegistryCallOptions() *FeatureRegistryCallOptions { 84 return &FeatureRegistryCallOptions{ 85 CreateFeatureGroup: []gax.CallOption{}, 86 GetFeatureGroup: []gax.CallOption{}, 87 ListFeatureGroups: []gax.CallOption{}, 88 UpdateFeatureGroup: []gax.CallOption{}, 89 DeleteFeatureGroup: []gax.CallOption{}, 90 CreateFeature: []gax.CallOption{}, 91 BatchCreateFeatures: []gax.CallOption{}, 92 GetFeature: []gax.CallOption{}, 93 ListFeatures: []gax.CallOption{}, 94 UpdateFeature: []gax.CallOption{}, 95 DeleteFeature: []gax.CallOption{}, 96 GetLocation: []gax.CallOption{}, 97 ListLocations: []gax.CallOption{}, 98 GetIamPolicy: []gax.CallOption{}, 99 SetIamPolicy: []gax.CallOption{}, 100 TestIamPermissions: []gax.CallOption{}, 101 CancelOperation: []gax.CallOption{}, 102 DeleteOperation: []gax.CallOption{}, 103 GetOperation: []gax.CallOption{}, 104 ListOperations: []gax.CallOption{}, 105 WaitOperation: []gax.CallOption{}, 106 } 107 } 108 109 // internalFeatureRegistryClient is an interface that defines the methods available from Vertex AI API. 110 type internalFeatureRegistryClient interface { 111 Close() error 112 setGoogleClientInfo(...string) 113 Connection() *grpc.ClientConn 114 CreateFeatureGroup(context.Context, *aiplatformpb.CreateFeatureGroupRequest, ...gax.CallOption) (*CreateFeatureGroupOperation, error) 115 CreateFeatureGroupOperation(name string) *CreateFeatureGroupOperation 116 GetFeatureGroup(context.Context, *aiplatformpb.GetFeatureGroupRequest, ...gax.CallOption) (*aiplatformpb.FeatureGroup, error) 117 ListFeatureGroups(context.Context, *aiplatformpb.ListFeatureGroupsRequest, ...gax.CallOption) *FeatureGroupIterator 118 UpdateFeatureGroup(context.Context, *aiplatformpb.UpdateFeatureGroupRequest, ...gax.CallOption) (*UpdateFeatureGroupOperation, error) 119 UpdateFeatureGroupOperation(name string) *UpdateFeatureGroupOperation 120 DeleteFeatureGroup(context.Context, *aiplatformpb.DeleteFeatureGroupRequest, ...gax.CallOption) (*DeleteFeatureGroupOperation, error) 121 DeleteFeatureGroupOperation(name string) *DeleteFeatureGroupOperation 122 CreateFeature(context.Context, *aiplatformpb.CreateFeatureRequest, ...gax.CallOption) (*CreateFeatureOperation, error) 123 CreateFeatureOperation(name string) *CreateFeatureOperation 124 BatchCreateFeatures(context.Context, *aiplatformpb.BatchCreateFeaturesRequest, ...gax.CallOption) (*BatchCreateFeaturesOperation, error) 125 BatchCreateFeaturesOperation(name string) *BatchCreateFeaturesOperation 126 GetFeature(context.Context, *aiplatformpb.GetFeatureRequest, ...gax.CallOption) (*aiplatformpb.Feature, error) 127 ListFeatures(context.Context, *aiplatformpb.ListFeaturesRequest, ...gax.CallOption) *FeatureIterator 128 UpdateFeature(context.Context, *aiplatformpb.UpdateFeatureRequest, ...gax.CallOption) (*UpdateFeatureOperation, error) 129 UpdateFeatureOperation(name string) *UpdateFeatureOperation 130 DeleteFeature(context.Context, *aiplatformpb.DeleteFeatureRequest, ...gax.CallOption) (*DeleteFeatureOperation, error) 131 DeleteFeatureOperation(name string) *DeleteFeatureOperation 132 GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error) 133 ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator 134 GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) 135 SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) 136 TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) 137 CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error 138 DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error 139 GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error) 140 ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator 141 WaitOperation(context.Context, *longrunningpb.WaitOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error) 142 } 143 144 // FeatureRegistryClient is a client for interacting with Vertex AI API. 145 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. 146 // 147 // The service that handles CRUD and List for resources for 148 // FeatureRegistry. 149 type FeatureRegistryClient struct { 150 // The internal transport-dependent client. 151 internalClient internalFeatureRegistryClient 152 153 // The call options for this service. 154 CallOptions *FeatureRegistryCallOptions 155 156 // LROClient is used internally to handle long-running operations. 157 // It is exposed so that its CallOptions can be modified if required. 158 // Users should not Close this client. 159 LROClient *lroauto.OperationsClient 160 } 161 162 // Wrapper methods routed to the internal client. 163 164 // Close closes the connection to the API service. The user should invoke this when 165 // the client is no longer required. 166 func (c *FeatureRegistryClient) Close() error { 167 return c.internalClient.Close() 168 } 169 170 // setGoogleClientInfo sets the name and version of the application in 171 // the `x-goog-api-client` header passed on each request. Intended for 172 // use by Google-written clients. 173 func (c *FeatureRegistryClient) setGoogleClientInfo(keyval ...string) { 174 c.internalClient.setGoogleClientInfo(keyval...) 175 } 176 177 // Connection returns a connection to the API service. 178 // 179 // Deprecated: Connections are now pooled so this method does not always 180 // return the same resource. 181 func (c *FeatureRegistryClient) Connection() *grpc.ClientConn { 182 return c.internalClient.Connection() 183 } 184 185 // CreateFeatureGroup creates a new FeatureGroup in a given project and location. 186 func (c *FeatureRegistryClient) CreateFeatureGroup(ctx context.Context, req *aiplatformpb.CreateFeatureGroupRequest, opts ...gax.CallOption) (*CreateFeatureGroupOperation, error) { 187 return c.internalClient.CreateFeatureGroup(ctx, req, opts...) 188 } 189 190 // CreateFeatureGroupOperation returns a new CreateFeatureGroupOperation from a given name. 191 // The name must be that of a previously created CreateFeatureGroupOperation, possibly from a different process. 192 func (c *FeatureRegistryClient) CreateFeatureGroupOperation(name string) *CreateFeatureGroupOperation { 193 return c.internalClient.CreateFeatureGroupOperation(name) 194 } 195 196 // GetFeatureGroup gets details of a single FeatureGroup. 197 func (c *FeatureRegistryClient) GetFeatureGroup(ctx context.Context, req *aiplatformpb.GetFeatureGroupRequest, opts ...gax.CallOption) (*aiplatformpb.FeatureGroup, error) { 198 return c.internalClient.GetFeatureGroup(ctx, req, opts...) 199 } 200 201 // ListFeatureGroups lists FeatureGroups in a given project and location. 202 func (c *FeatureRegistryClient) ListFeatureGroups(ctx context.Context, req *aiplatformpb.ListFeatureGroupsRequest, opts ...gax.CallOption) *FeatureGroupIterator { 203 return c.internalClient.ListFeatureGroups(ctx, req, opts...) 204 } 205 206 // UpdateFeatureGroup updates the parameters of a single FeatureGroup. 207 func (c *FeatureRegistryClient) UpdateFeatureGroup(ctx context.Context, req *aiplatformpb.UpdateFeatureGroupRequest, opts ...gax.CallOption) (*UpdateFeatureGroupOperation, error) { 208 return c.internalClient.UpdateFeatureGroup(ctx, req, opts...) 209 } 210 211 // UpdateFeatureGroupOperation returns a new UpdateFeatureGroupOperation from a given name. 212 // The name must be that of a previously created UpdateFeatureGroupOperation, possibly from a different process. 213 func (c *FeatureRegistryClient) UpdateFeatureGroupOperation(name string) *UpdateFeatureGroupOperation { 214 return c.internalClient.UpdateFeatureGroupOperation(name) 215 } 216 217 // DeleteFeatureGroup deletes a single FeatureGroup. 218 func (c *FeatureRegistryClient) DeleteFeatureGroup(ctx context.Context, req *aiplatformpb.DeleteFeatureGroupRequest, opts ...gax.CallOption) (*DeleteFeatureGroupOperation, error) { 219 return c.internalClient.DeleteFeatureGroup(ctx, req, opts...) 220 } 221 222 // DeleteFeatureGroupOperation returns a new DeleteFeatureGroupOperation from a given name. 223 // The name must be that of a previously created DeleteFeatureGroupOperation, possibly from a different process. 224 func (c *FeatureRegistryClient) DeleteFeatureGroupOperation(name string) *DeleteFeatureGroupOperation { 225 return c.internalClient.DeleteFeatureGroupOperation(name) 226 } 227 228 // CreateFeature creates a new Feature in a given FeatureGroup. 229 func (c *FeatureRegistryClient) CreateFeature(ctx context.Context, req *aiplatformpb.CreateFeatureRequest, opts ...gax.CallOption) (*CreateFeatureOperation, error) { 230 return c.internalClient.CreateFeature(ctx, req, opts...) 231 } 232 233 // CreateFeatureOperation returns a new CreateFeatureOperation from a given name. 234 // The name must be that of a previously created CreateFeatureOperation, possibly from a different process. 235 func (c *FeatureRegistryClient) CreateFeatureOperation(name string) *CreateFeatureOperation { 236 return c.internalClient.CreateFeatureOperation(name) 237 } 238 239 // BatchCreateFeatures creates a batch of Features in a given FeatureGroup. 240 func (c *FeatureRegistryClient) BatchCreateFeatures(ctx context.Context, req *aiplatformpb.BatchCreateFeaturesRequest, opts ...gax.CallOption) (*BatchCreateFeaturesOperation, error) { 241 return c.internalClient.BatchCreateFeatures(ctx, req, opts...) 242 } 243 244 // BatchCreateFeaturesOperation returns a new BatchCreateFeaturesOperation from a given name. 245 // The name must be that of a previously created BatchCreateFeaturesOperation, possibly from a different process. 246 func (c *FeatureRegistryClient) BatchCreateFeaturesOperation(name string) *BatchCreateFeaturesOperation { 247 return c.internalClient.BatchCreateFeaturesOperation(name) 248 } 249 250 // GetFeature gets details of a single Feature. 251 func (c *FeatureRegistryClient) GetFeature(ctx context.Context, req *aiplatformpb.GetFeatureRequest, opts ...gax.CallOption) (*aiplatformpb.Feature, error) { 252 return c.internalClient.GetFeature(ctx, req, opts...) 253 } 254 255 // ListFeatures lists Features in a given FeatureGroup. 256 func (c *FeatureRegistryClient) ListFeatures(ctx context.Context, req *aiplatformpb.ListFeaturesRequest, opts ...gax.CallOption) *FeatureIterator { 257 return c.internalClient.ListFeatures(ctx, req, opts...) 258 } 259 260 // UpdateFeature updates the parameters of a single Feature. 261 func (c *FeatureRegistryClient) UpdateFeature(ctx context.Context, req *aiplatformpb.UpdateFeatureRequest, opts ...gax.CallOption) (*UpdateFeatureOperation, error) { 262 return c.internalClient.UpdateFeature(ctx, req, opts...) 263 } 264 265 // UpdateFeatureOperation returns a new UpdateFeatureOperation from a given name. 266 // The name must be that of a previously created UpdateFeatureOperation, possibly from a different process. 267 func (c *FeatureRegistryClient) UpdateFeatureOperation(name string) *UpdateFeatureOperation { 268 return c.internalClient.UpdateFeatureOperation(name) 269 } 270 271 // DeleteFeature deletes a single Feature. 272 func (c *FeatureRegistryClient) DeleteFeature(ctx context.Context, req *aiplatformpb.DeleteFeatureRequest, opts ...gax.CallOption) (*DeleteFeatureOperation, error) { 273 return c.internalClient.DeleteFeature(ctx, req, opts...) 274 } 275 276 // DeleteFeatureOperation returns a new DeleteFeatureOperation from a given name. 277 // The name must be that of a previously created DeleteFeatureOperation, possibly from a different process. 278 func (c *FeatureRegistryClient) DeleteFeatureOperation(name string) *DeleteFeatureOperation { 279 return c.internalClient.DeleteFeatureOperation(name) 280 } 281 282 // GetLocation gets information about a location. 283 func (c *FeatureRegistryClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { 284 return c.internalClient.GetLocation(ctx, req, opts...) 285 } 286 287 // ListLocations lists information about the supported locations for this service. 288 func (c *FeatureRegistryClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { 289 return c.internalClient.ListLocations(ctx, req, opts...) 290 } 291 292 // GetIamPolicy gets the access control policy for a resource. Returns an empty policy 293 // if the resource exists and does not have a policy set. 294 func (c *FeatureRegistryClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 295 return c.internalClient.GetIamPolicy(ctx, req, opts...) 296 } 297 298 // SetIamPolicy sets the access control policy on the specified resource. Replaces 299 // any existing policy. 300 // 301 // Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED 302 // errors. 303 func (c *FeatureRegistryClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 304 return c.internalClient.SetIamPolicy(ctx, req, opts...) 305 } 306 307 // TestIamPermissions returns permissions that a caller has on the specified resource. If the 308 // resource does not exist, this will return an empty set of 309 // permissions, not a NOT_FOUND error. 310 // 311 // Note: This operation is designed to be used for building 312 // permission-aware UIs and command-line tools, not for authorization 313 // checking. This operation may “fail open” without warning. 314 func (c *FeatureRegistryClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { 315 return c.internalClient.TestIamPermissions(ctx, req, opts...) 316 } 317 318 // CancelOperation is a utility method from google.longrunning.Operations. 319 func (c *FeatureRegistryClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { 320 return c.internalClient.CancelOperation(ctx, req, opts...) 321 } 322 323 // DeleteOperation is a utility method from google.longrunning.Operations. 324 func (c *FeatureRegistryClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { 325 return c.internalClient.DeleteOperation(ctx, req, opts...) 326 } 327 328 // GetOperation is a utility method from google.longrunning.Operations. 329 func (c *FeatureRegistryClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 330 return c.internalClient.GetOperation(ctx, req, opts...) 331 } 332 333 // ListOperations is a utility method from google.longrunning.Operations. 334 func (c *FeatureRegistryClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { 335 return c.internalClient.ListOperations(ctx, req, opts...) 336 } 337 338 // WaitOperation is a utility method from google.longrunning.Operations. 339 func (c *FeatureRegistryClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 340 return c.internalClient.WaitOperation(ctx, req, opts...) 341 } 342 343 // featureRegistryGRPCClient is a client for interacting with Vertex AI API over gRPC transport. 344 // 345 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. 346 type featureRegistryGRPCClient struct { 347 // Connection pool of gRPC connections to the service. 348 connPool gtransport.ConnPool 349 350 // Points back to the CallOptions field of the containing FeatureRegistryClient 351 CallOptions **FeatureRegistryCallOptions 352 353 // The gRPC API client. 354 featureRegistryClient aiplatformpb.FeatureRegistryServiceClient 355 356 // LROClient is used internally to handle long-running operations. 357 // It is exposed so that its CallOptions can be modified if required. 358 // Users should not Close this client. 359 LROClient **lroauto.OperationsClient 360 361 operationsClient longrunningpb.OperationsClient 362 363 iamPolicyClient iampb.IAMPolicyClient 364 365 locationsClient locationpb.LocationsClient 366 367 // The x-goog-* metadata to be sent with each request. 368 xGoogHeaders []string 369 370 logger *slog.Logger 371 } 372 373 // NewFeatureRegistryClient creates a new feature registry service client based on gRPC. 374 // The returned client must be Closed when it is done being used to clean up its underlying connections. 375 // 376 // The service that handles CRUD and List for resources for 377 // FeatureRegistry. 378 func NewFeatureRegistryClient(ctx context.Context, opts ...option.ClientOption) (*FeatureRegistryClient, error) { 379 clientOpts := defaultFeatureRegistryGRPCClientOptions() 380 if newFeatureRegistryClientHook != nil { 381 hookOpts, err := newFeatureRegistryClientHook(ctx, clientHookParams{}) 382 if err != nil { 383 return nil, err 384 } 385 clientOpts = append(clientOpts, hookOpts...) 386 } 387 388 connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) 389 if err != nil { 390 return nil, err 391 } 392 client := FeatureRegistryClient{CallOptions: defaultFeatureRegistryCallOptions()} 393 394 c := &featureRegistryGRPCClient{ 395 connPool: connPool, 396 featureRegistryClient: aiplatformpb.NewFeatureRegistryServiceClient(connPool), 397 CallOptions: &client.CallOptions, 398 logger: internaloption.GetLogger(opts), 399 operationsClient: longrunningpb.NewOperationsClient(connPool), 400 iamPolicyClient: iampb.NewIAMPolicyClient(connPool), 401 locationsClient: locationpb.NewLocationsClient(connPool), 402 } 403 c.setGoogleClientInfo() 404 405 client.internalClient = c 406 407 client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool)) 408 if err != nil { 409 // This error "should not happen", since we are just reusing old connection pool 410 // and never actually need to dial. 411 // If this does happen, we could leak connp. However, we cannot close conn: 412 // If the user invoked the constructor with option.WithGRPCConn, 413 // we would close a connection that's still in use. 414 // TODO: investigate error conditions. 415 return nil, err 416 } 417 c.LROClient = &client.LROClient 418 return &client, nil 419 } 420 421 // Connection returns a connection to the API service. 422 // 423 // Deprecated: Connections are now pooled so this method does not always 424 // return the same resource. 425 func (c *featureRegistryGRPCClient) Connection() *grpc.ClientConn { 426 return c.connPool.Conn() 427 } 428 429 // setGoogleClientInfo sets the name and version of the application in 430 // the `x-goog-api-client` header passed on each request. Intended for 431 // use by Google-written clients. 432 func (c *featureRegistryGRPCClient) setGoogleClientInfo(keyval ...string) { 433 kv := append([]string{"gl-go", gax.GoVersion}, keyval...) 434 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion) 435 c.xGoogHeaders = []string{ 436 "x-goog-api-client", gax.XGoogHeader(kv...), 437 } 438 } 439 440 // Close closes the connection to the API service. The user should invoke this when 441 // the client is no longer required. 442 func (c *featureRegistryGRPCClient) Close() error { 443 return c.connPool.Close() 444 } 445 446 func (c *featureRegistryGRPCClient) CreateFeatureGroup(ctx context.Context, req *aiplatformpb.CreateFeatureGroupRequest, opts ...gax.CallOption) (*CreateFeatureGroupOperation, error) { 447 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 448 449 hds = append(c.xGoogHeaders, hds...) 450 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 451 opts = append((*c.CallOptions).CreateFeatureGroup[0:len((*c.CallOptions).CreateFeatureGroup):len((*c.CallOptions).CreateFeatureGroup)], opts...) 452 var resp *longrunningpb.Operation 453 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 454 var err error 455 resp, err = executeRPC(ctx, c.featureRegistryClient.CreateFeatureGroup, req, settings.GRPC, c.logger, "CreateFeatureGroup") 456 return err 457 }, opts...) 458 if err != nil { 459 return nil, err 460 } 461 return &CreateFeatureGroupOperation{ 462 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 463 }, nil 464 } 465 466 func (c *featureRegistryGRPCClient) GetFeatureGroup(ctx context.Context, req *aiplatformpb.GetFeatureGroupRequest, opts ...gax.CallOption) (*aiplatformpb.FeatureGroup, error) { 467 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 468 469 hds = append(c.xGoogHeaders, hds...) 470 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 471 opts = append((*c.CallOptions).GetFeatureGroup[0:len((*c.CallOptions).GetFeatureGroup):len((*c.CallOptions).GetFeatureGroup)], opts...) 472 var resp *aiplatformpb.FeatureGroup 473 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 474 var err error 475 resp, err = executeRPC(ctx, c.featureRegistryClient.GetFeatureGroup, req, settings.GRPC, c.logger, "GetFeatureGroup") 476 return err 477 }, opts...) 478 if err != nil { 479 return nil, err 480 } 481 return resp, nil 482 } 483 484 func (c *featureRegistryGRPCClient) ListFeatureGroups(ctx context.Context, req *aiplatformpb.ListFeatureGroupsRequest, opts ...gax.CallOption) *FeatureGroupIterator { 485 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 486 487 hds = append(c.xGoogHeaders, hds...) 488 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 489 opts = append((*c.CallOptions).ListFeatureGroups[0:len((*c.CallOptions).ListFeatureGroups):len((*c.CallOptions).ListFeatureGroups)], opts...) 490 it := &FeatureGroupIterator{} 491 req = proto.Clone(req).(*aiplatformpb.ListFeatureGroupsRequest) 492 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.FeatureGroup, string, error) { 493 resp := &aiplatformpb.ListFeatureGroupsResponse{} 494 if pageToken != "" { 495 req.PageToken = pageToken 496 } 497 if pageSize > math.MaxInt32 { 498 req.PageSize = math.MaxInt32 499 } else if pageSize != 0 { 500 req.PageSize = int32(pageSize) 501 } 502 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 503 var err error 504 resp, err = executeRPC(ctx, c.featureRegistryClient.ListFeatureGroups, req, settings.GRPC, c.logger, "ListFeatureGroups") 505 return err 506 }, opts...) 507 if err != nil { 508 return nil, "", err 509 } 510 511 it.Response = resp 512 return resp.GetFeatureGroups(), resp.GetNextPageToken(), nil 513 } 514 fetch := func(pageSize int, pageToken string) (string, error) { 515 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 516 if err != nil { 517 return "", err 518 } 519 it.items = append(it.items, items...) 520 return nextPageToken, nil 521 } 522 523 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 524 it.pageInfo.MaxSize = int(req.GetPageSize()) 525 it.pageInfo.Token = req.GetPageToken() 526 527 return it 528 } 529 530 func (c *featureRegistryGRPCClient) UpdateFeatureGroup(ctx context.Context, req *aiplatformpb.UpdateFeatureGroupRequest, opts ...gax.CallOption) (*UpdateFeatureGroupOperation, error) { 531 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "feature_group.name", url.QueryEscape(req.GetFeatureGroup().GetName()))} 532 533 hds = append(c.xGoogHeaders, hds...) 534 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 535 opts = append((*c.CallOptions).UpdateFeatureGroup[0:len((*c.CallOptions).UpdateFeatureGroup):len((*c.CallOptions).UpdateFeatureGroup)], opts...) 536 var resp *longrunningpb.Operation 537 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 538 var err error 539 resp, err = executeRPC(ctx, c.featureRegistryClient.UpdateFeatureGroup, req, settings.GRPC, c.logger, "UpdateFeatureGroup") 540 return err 541 }, opts...) 542 if err != nil { 543 return nil, err 544 } 545 return &UpdateFeatureGroupOperation{ 546 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 547 }, nil 548 } 549 550 func (c *featureRegistryGRPCClient) DeleteFeatureGroup(ctx context.Context, req *aiplatformpb.DeleteFeatureGroupRequest, opts ...gax.CallOption) (*DeleteFeatureGroupOperation, error) { 551 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 552 553 hds = append(c.xGoogHeaders, hds...) 554 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 555 opts = append((*c.CallOptions).DeleteFeatureGroup[0:len((*c.CallOptions).DeleteFeatureGroup):len((*c.CallOptions).DeleteFeatureGroup)], opts...) 556 var resp *longrunningpb.Operation 557 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 558 var err error 559 resp, err = executeRPC(ctx, c.featureRegistryClient.DeleteFeatureGroup, req, settings.GRPC, c.logger, "DeleteFeatureGroup") 560 return err 561 }, opts...) 562 if err != nil { 563 return nil, err 564 } 565 return &DeleteFeatureGroupOperation{ 566 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 567 }, nil 568 } 569 570 func (c *featureRegistryGRPCClient) CreateFeature(ctx context.Context, req *aiplatformpb.CreateFeatureRequest, opts ...gax.CallOption) (*CreateFeatureOperation, error) { 571 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 572 573 hds = append(c.xGoogHeaders, hds...) 574 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 575 opts = append((*c.CallOptions).CreateFeature[0:len((*c.CallOptions).CreateFeature):len((*c.CallOptions).CreateFeature)], opts...) 576 var resp *longrunningpb.Operation 577 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 578 var err error 579 resp, err = executeRPC(ctx, c.featureRegistryClient.CreateFeature, req, settings.GRPC, c.logger, "CreateFeature") 580 return err 581 }, opts...) 582 if err != nil { 583 return nil, err 584 } 585 return &CreateFeatureOperation{ 586 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 587 }, nil 588 } 589 590 func (c *featureRegistryGRPCClient) BatchCreateFeatures(ctx context.Context, req *aiplatformpb.BatchCreateFeaturesRequest, opts ...gax.CallOption) (*BatchCreateFeaturesOperation, error) { 591 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 592 593 hds = append(c.xGoogHeaders, hds...) 594 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 595 opts = append((*c.CallOptions).BatchCreateFeatures[0:len((*c.CallOptions).BatchCreateFeatures):len((*c.CallOptions).BatchCreateFeatures)], opts...) 596 var resp *longrunningpb.Operation 597 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 598 var err error 599 resp, err = executeRPC(ctx, c.featureRegistryClient.BatchCreateFeatures, req, settings.GRPC, c.logger, "BatchCreateFeatures") 600 return err 601 }, opts...) 602 if err != nil { 603 return nil, err 604 } 605 return &BatchCreateFeaturesOperation{ 606 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 607 }, nil 608 } 609 610 func (c *featureRegistryGRPCClient) GetFeature(ctx context.Context, req *aiplatformpb.GetFeatureRequest, opts ...gax.CallOption) (*aiplatformpb.Feature, error) { 611 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 612 613 hds = append(c.xGoogHeaders, hds...) 614 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 615 opts = append((*c.CallOptions).GetFeature[0:len((*c.CallOptions).GetFeature):len((*c.CallOptions).GetFeature)], opts...) 616 var resp *aiplatformpb.Feature 617 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 618 var err error 619 resp, err = executeRPC(ctx, c.featureRegistryClient.GetFeature, req, settings.GRPC, c.logger, "GetFeature") 620 return err 621 }, opts...) 622 if err != nil { 623 return nil, err 624 } 625 return resp, nil 626 } 627 628 func (c *featureRegistryGRPCClient) ListFeatures(ctx context.Context, req *aiplatformpb.ListFeaturesRequest, opts ...gax.CallOption) *FeatureIterator { 629 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 630 631 hds = append(c.xGoogHeaders, hds...) 632 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 633 opts = append((*c.CallOptions).ListFeatures[0:len((*c.CallOptions).ListFeatures):len((*c.CallOptions).ListFeatures)], opts...) 634 it := &FeatureIterator{} 635 req = proto.Clone(req).(*aiplatformpb.ListFeaturesRequest) 636 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.Feature, string, error) { 637 resp := &aiplatformpb.ListFeaturesResponse{} 638 if pageToken != "" { 639 req.PageToken = pageToken 640 } 641 if pageSize > math.MaxInt32 { 642 req.PageSize = math.MaxInt32 643 } else if pageSize != 0 { 644 req.PageSize = int32(pageSize) 645 } 646 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 647 var err error 648 resp, err = executeRPC(ctx, c.featureRegistryClient.ListFeatures, req, settings.GRPC, c.logger, "ListFeatures") 649 return err 650 }, opts...) 651 if err != nil { 652 return nil, "", err 653 } 654 655 it.Response = resp 656 return resp.GetFeatures(), resp.GetNextPageToken(), nil 657 } 658 fetch := func(pageSize int, pageToken string) (string, error) { 659 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 660 if err != nil { 661 return "", err 662 } 663 it.items = append(it.items, items...) 664 return nextPageToken, nil 665 } 666 667 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 668 it.pageInfo.MaxSize = int(req.GetPageSize()) 669 it.pageInfo.Token = req.GetPageToken() 670 671 return it 672 } 673 674 func (c *featureRegistryGRPCClient) UpdateFeature(ctx context.Context, req *aiplatformpb.UpdateFeatureRequest, opts ...gax.CallOption) (*UpdateFeatureOperation, error) { 675 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "feature.name", url.QueryEscape(req.GetFeature().GetName()))} 676 677 hds = append(c.xGoogHeaders, hds...) 678 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 679 opts = append((*c.CallOptions).UpdateFeature[0:len((*c.CallOptions).UpdateFeature):len((*c.CallOptions).UpdateFeature)], opts...) 680 var resp *longrunningpb.Operation 681 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 682 var err error 683 resp, err = executeRPC(ctx, c.featureRegistryClient.UpdateFeature, req, settings.GRPC, c.logger, "UpdateFeature") 684 return err 685 }, opts...) 686 if err != nil { 687 return nil, err 688 } 689 return &UpdateFeatureOperation{ 690 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 691 }, nil 692 } 693 694 func (c *featureRegistryGRPCClient) DeleteFeature(ctx context.Context, req *aiplatformpb.DeleteFeatureRequest, opts ...gax.CallOption) (*DeleteFeatureOperation, error) { 695 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 696 697 hds = append(c.xGoogHeaders, hds...) 698 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 699 opts = append((*c.CallOptions).DeleteFeature[0:len((*c.CallOptions).DeleteFeature):len((*c.CallOptions).DeleteFeature)], opts...) 700 var resp *longrunningpb.Operation 701 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 702 var err error 703 resp, err = executeRPC(ctx, c.featureRegistryClient.DeleteFeature, req, settings.GRPC, c.logger, "DeleteFeature") 704 return err 705 }, opts...) 706 if err != nil { 707 return nil, err 708 } 709 return &DeleteFeatureOperation{ 710 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 711 }, nil 712 } 713 714 func (c *featureRegistryGRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { 715 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 716 717 hds = append(c.xGoogHeaders, hds...) 718 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 719 opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...) 720 var resp *locationpb.Location 721 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 722 var err error 723 resp, err = executeRPC(ctx, c.locationsClient.GetLocation, req, settings.GRPC, c.logger, "GetLocation") 724 return err 725 }, opts...) 726 if err != nil { 727 return nil, err 728 } 729 return resp, nil 730 } 731 732 func (c *featureRegistryGRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { 733 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 734 735 hds = append(c.xGoogHeaders, hds...) 736 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 737 opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...) 738 it := &LocationIterator{} 739 req = proto.Clone(req).(*locationpb.ListLocationsRequest) 740 it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) { 741 resp := &locationpb.ListLocationsResponse{} 742 if pageToken != "" { 743 req.PageToken = pageToken 744 } 745 if pageSize > math.MaxInt32 { 746 req.PageSize = math.MaxInt32 747 } else if pageSize != 0 { 748 req.PageSize = int32(pageSize) 749 } 750 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 751 var err error 752 resp, err = executeRPC(ctx, c.locationsClient.ListLocations, req, settings.GRPC, c.logger, "ListLocations") 753 return err 754 }, opts...) 755 if err != nil { 756 return nil, "", err 757 } 758 759 it.Response = resp 760 return resp.GetLocations(), resp.GetNextPageToken(), nil 761 } 762 fetch := func(pageSize int, pageToken string) (string, error) { 763 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 764 if err != nil { 765 return "", err 766 } 767 it.items = append(it.items, items...) 768 return nextPageToken, nil 769 } 770 771 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 772 it.pageInfo.MaxSize = int(req.GetPageSize()) 773 it.pageInfo.Token = req.GetPageToken() 774 775 return it 776 } 777 778 func (c *featureRegistryGRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 779 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 780 781 hds = append(c.xGoogHeaders, hds...) 782 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 783 opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...) 784 var resp *iampb.Policy 785 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 786 var err error 787 resp, err = executeRPC(ctx, c.iamPolicyClient.GetIamPolicy, req, settings.GRPC, c.logger, "GetIamPolicy") 788 return err 789 }, opts...) 790 if err != nil { 791 return nil, err 792 } 793 return resp, nil 794 } 795 796 func (c *featureRegistryGRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 797 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 798 799 hds = append(c.xGoogHeaders, hds...) 800 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 801 opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...) 802 var resp *iampb.Policy 803 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 804 var err error 805 resp, err = executeRPC(ctx, c.iamPolicyClient.SetIamPolicy, req, settings.GRPC, c.logger, "SetIamPolicy") 806 return err 807 }, opts...) 808 if err != nil { 809 return nil, err 810 } 811 return resp, nil 812 } 813 814 func (c *featureRegistryGRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { 815 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 816 817 hds = append(c.xGoogHeaders, hds...) 818 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 819 opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...) 820 var resp *iampb.TestIamPermissionsResponse 821 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 822 var err error 823 resp, err = executeRPC(ctx, c.iamPolicyClient.TestIamPermissions, req, settings.GRPC, c.logger, "TestIamPermissions") 824 return err 825 }, opts...) 826 if err != nil { 827 return nil, err 828 } 829 return resp, nil 830 } 831 832 func (c *featureRegistryGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { 833 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 834 835 hds = append(c.xGoogHeaders, hds...) 836 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 837 opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...) 838 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 839 var err error 840 _, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation") 841 return err 842 }, opts...) 843 return err 844 } 845 846 func (c *featureRegistryGRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { 847 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 848 849 hds = append(c.xGoogHeaders, hds...) 850 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 851 opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...) 852 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 853 var err error 854 _, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation") 855 return err 856 }, opts...) 857 return err 858 } 859 860 func (c *featureRegistryGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 861 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 862 863 hds = append(c.xGoogHeaders, hds...) 864 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 865 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...) 866 var resp *longrunningpb.Operation 867 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 868 var err error 869 resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation") 870 return err 871 }, opts...) 872 if err != nil { 873 return nil, err 874 } 875 return resp, nil 876 } 877 878 func (c *featureRegistryGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { 879 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 880 881 hds = append(c.xGoogHeaders, hds...) 882 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 883 opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...) 884 it := &OperationIterator{} 885 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest) 886 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) { 887 resp := &longrunningpb.ListOperationsResponse{} 888 if pageToken != "" { 889 req.PageToken = pageToken 890 } 891 if pageSize > math.MaxInt32 { 892 req.PageSize = math.MaxInt32 893 } else if pageSize != 0 { 894 req.PageSize = int32(pageSize) 895 } 896 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 897 var err error 898 resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations") 899 return err 900 }, opts...) 901 if err != nil { 902 return nil, "", err 903 } 904 905 it.Response = resp 906 return resp.GetOperations(), resp.GetNextPageToken(), nil 907 } 908 fetch := func(pageSize int, pageToken string) (string, error) { 909 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 910 if err != nil { 911 return "", err 912 } 913 it.items = append(it.items, items...) 914 return nextPageToken, nil 915 } 916 917 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 918 it.pageInfo.MaxSize = int(req.GetPageSize()) 919 it.pageInfo.Token = req.GetPageToken() 920 921 return it 922 } 923 924 func (c *featureRegistryGRPCClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 925 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 926 927 hds = append(c.xGoogHeaders, hds...) 928 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 929 opts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...) 930 var resp *longrunningpb.Operation 931 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 932 var err error 933 resp, err = executeRPC(ctx, c.operationsClient.WaitOperation, req, settings.GRPC, c.logger, "WaitOperation") 934 return err 935 }, opts...) 936 if err != nil { 937 return nil, err 938 } 939 return resp, nil 940 } 941 942 // BatchCreateFeaturesOperation returns a new BatchCreateFeaturesOperation from a given name. 943 // The name must be that of a previously created BatchCreateFeaturesOperation, possibly from a different process. 944 func (c *featureRegistryGRPCClient) BatchCreateFeaturesOperation(name string) *BatchCreateFeaturesOperation { 945 return &BatchCreateFeaturesOperation{ 946 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 947 } 948 } 949 950 // CreateFeatureOperation returns a new CreateFeatureOperation from a given name. 951 // The name must be that of a previously created CreateFeatureOperation, possibly from a different process. 952 func (c *featureRegistryGRPCClient) CreateFeatureOperation(name string) *CreateFeatureOperation { 953 return &CreateFeatureOperation{ 954 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 955 } 956 } 957 958 // CreateFeatureGroupOperation returns a new CreateFeatureGroupOperation from a given name. 959 // The name must be that of a previously created CreateFeatureGroupOperation, possibly from a different process. 960 func (c *featureRegistryGRPCClient) CreateFeatureGroupOperation(name string) *CreateFeatureGroupOperation { 961 return &CreateFeatureGroupOperation{ 962 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 963 } 964 } 965 966 // DeleteFeatureOperation returns a new DeleteFeatureOperation from a given name. 967 // The name must be that of a previously created DeleteFeatureOperation, possibly from a different process. 968 func (c *featureRegistryGRPCClient) DeleteFeatureOperation(name string) *DeleteFeatureOperation { 969 return &DeleteFeatureOperation{ 970 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 971 } 972 } 973 974 // DeleteFeatureGroupOperation returns a new DeleteFeatureGroupOperation from a given name. 975 // The name must be that of a previously created DeleteFeatureGroupOperation, possibly from a different process. 976 func (c *featureRegistryGRPCClient) DeleteFeatureGroupOperation(name string) *DeleteFeatureGroupOperation { 977 return &DeleteFeatureGroupOperation{ 978 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 979 } 980 } 981 982 // UpdateFeatureOperation returns a new UpdateFeatureOperation from a given name. 983 // The name must be that of a previously created UpdateFeatureOperation, possibly from a different process. 984 func (c *featureRegistryGRPCClient) UpdateFeatureOperation(name string) *UpdateFeatureOperation { 985 return &UpdateFeatureOperation{ 986 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 987 } 988 } 989 990 // UpdateFeatureGroupOperation returns a new UpdateFeatureGroupOperation from a given name. 991 // The name must be that of a previously created UpdateFeatureGroupOperation, possibly from a different process. 992 func (c *featureRegistryGRPCClient) UpdateFeatureGroupOperation(name string) *UpdateFeatureGroupOperation { 993 return &UpdateFeatureGroupOperation{ 994 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 995 } 996 }