cloud.google.com/go/aiplatform@v1.106.0/apiv1/vertex_rag_data_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 newVertexRagDataClientHook clientHook 42 43 // VertexRagDataCallOptions contains the retry settings for each method of VertexRagDataClient. 44 type VertexRagDataCallOptions struct { 45 CreateRagCorpus []gax.CallOption 46 UpdateRagCorpus []gax.CallOption 47 GetRagCorpus []gax.CallOption 48 ListRagCorpora []gax.CallOption 49 DeleteRagCorpus []gax.CallOption 50 UploadRagFile []gax.CallOption 51 ImportRagFiles []gax.CallOption 52 GetRagFile []gax.CallOption 53 ListRagFiles []gax.CallOption 54 DeleteRagFile []gax.CallOption 55 UpdateRagEngineConfig []gax.CallOption 56 GetRagEngineConfig []gax.CallOption 57 GetLocation []gax.CallOption 58 ListLocations []gax.CallOption 59 GetIamPolicy []gax.CallOption 60 SetIamPolicy []gax.CallOption 61 TestIamPermissions []gax.CallOption 62 CancelOperation []gax.CallOption 63 DeleteOperation []gax.CallOption 64 GetOperation []gax.CallOption 65 ListOperations []gax.CallOption 66 WaitOperation []gax.CallOption 67 } 68 69 func defaultVertexRagDataGRPCClientOptions() []option.ClientOption { 70 return []option.ClientOption{ 71 internaloption.WithDefaultEndpoint("aiplatform.googleapis.com:443"), 72 internaloption.WithDefaultEndpointTemplate("aiplatform.UNIVERSE_DOMAIN:443"), 73 internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"), 74 internaloption.WithDefaultUniverseDomain("googleapis.com"), 75 internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), 76 internaloption.WithDefaultScopes(DefaultAuthScopes()...), 77 internaloption.EnableJwtWithScope(), 78 internaloption.EnableNewAuthLibrary(), 79 option.WithGRPCDialOption(grpc.WithDefaultCallOptions( 80 grpc.MaxCallRecvMsgSize(math.MaxInt32))), 81 } 82 } 83 84 func defaultVertexRagDataCallOptions() *VertexRagDataCallOptions { 85 return &VertexRagDataCallOptions{ 86 CreateRagCorpus: []gax.CallOption{}, 87 UpdateRagCorpus: []gax.CallOption{}, 88 GetRagCorpus: []gax.CallOption{}, 89 ListRagCorpora: []gax.CallOption{}, 90 DeleteRagCorpus: []gax.CallOption{}, 91 UploadRagFile: []gax.CallOption{}, 92 ImportRagFiles: []gax.CallOption{}, 93 GetRagFile: []gax.CallOption{}, 94 ListRagFiles: []gax.CallOption{}, 95 DeleteRagFile: []gax.CallOption{}, 96 UpdateRagEngineConfig: []gax.CallOption{}, 97 GetRagEngineConfig: []gax.CallOption{}, 98 GetLocation: []gax.CallOption{}, 99 ListLocations: []gax.CallOption{}, 100 GetIamPolicy: []gax.CallOption{}, 101 SetIamPolicy: []gax.CallOption{}, 102 TestIamPermissions: []gax.CallOption{}, 103 CancelOperation: []gax.CallOption{}, 104 DeleteOperation: []gax.CallOption{}, 105 GetOperation: []gax.CallOption{}, 106 ListOperations: []gax.CallOption{}, 107 WaitOperation: []gax.CallOption{}, 108 } 109 } 110 111 // internalVertexRagDataClient is an interface that defines the methods available from Vertex AI API. 112 type internalVertexRagDataClient interface { 113 Close() error 114 setGoogleClientInfo(...string) 115 Connection() *grpc.ClientConn 116 CreateRagCorpus(context.Context, *aiplatformpb.CreateRagCorpusRequest, ...gax.CallOption) (*CreateRagCorpusOperation, error) 117 CreateRagCorpusOperation(name string) *CreateRagCorpusOperation 118 UpdateRagCorpus(context.Context, *aiplatformpb.UpdateRagCorpusRequest, ...gax.CallOption) (*UpdateRagCorpusOperation, error) 119 UpdateRagCorpusOperation(name string) *UpdateRagCorpusOperation 120 GetRagCorpus(context.Context, *aiplatformpb.GetRagCorpusRequest, ...gax.CallOption) (*aiplatformpb.RagCorpus, error) 121 ListRagCorpora(context.Context, *aiplatformpb.ListRagCorporaRequest, ...gax.CallOption) *RagCorpusIterator 122 DeleteRagCorpus(context.Context, *aiplatformpb.DeleteRagCorpusRequest, ...gax.CallOption) (*DeleteRagCorpusOperation, error) 123 DeleteRagCorpusOperation(name string) *DeleteRagCorpusOperation 124 UploadRagFile(context.Context, *aiplatformpb.UploadRagFileRequest, ...gax.CallOption) (*aiplatformpb.UploadRagFileResponse, error) 125 ImportRagFiles(context.Context, *aiplatformpb.ImportRagFilesRequest, ...gax.CallOption) (*ImportRagFilesOperation, error) 126 ImportRagFilesOperation(name string) *ImportRagFilesOperation 127 GetRagFile(context.Context, *aiplatformpb.GetRagFileRequest, ...gax.CallOption) (*aiplatformpb.RagFile, error) 128 ListRagFiles(context.Context, *aiplatformpb.ListRagFilesRequest, ...gax.CallOption) *RagFileIterator 129 DeleteRagFile(context.Context, *aiplatformpb.DeleteRagFileRequest, ...gax.CallOption) (*DeleteRagFileOperation, error) 130 DeleteRagFileOperation(name string) *DeleteRagFileOperation 131 UpdateRagEngineConfig(context.Context, *aiplatformpb.UpdateRagEngineConfigRequest, ...gax.CallOption) (*UpdateRagEngineConfigOperation, error) 132 UpdateRagEngineConfigOperation(name string) *UpdateRagEngineConfigOperation 133 GetRagEngineConfig(context.Context, *aiplatformpb.GetRagEngineConfigRequest, ...gax.CallOption) (*aiplatformpb.RagEngineConfig, error) 134 GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error) 135 ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator 136 GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) 137 SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) 138 TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) 139 CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error 140 DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error 141 GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error) 142 ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator 143 WaitOperation(context.Context, *longrunningpb.WaitOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error) 144 } 145 146 // VertexRagDataClient is a client for interacting with Vertex AI API. 147 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. 148 // 149 // A service for managing user data for RAG. 150 type VertexRagDataClient struct { 151 // The internal transport-dependent client. 152 internalClient internalVertexRagDataClient 153 154 // The call options for this service. 155 CallOptions *VertexRagDataCallOptions 156 157 // LROClient is used internally to handle long-running operations. 158 // It is exposed so that its CallOptions can be modified if required. 159 // Users should not Close this client. 160 LROClient *lroauto.OperationsClient 161 } 162 163 // Wrapper methods routed to the internal client. 164 165 // Close closes the connection to the API service. The user should invoke this when 166 // the client is no longer required. 167 func (c *VertexRagDataClient) Close() error { 168 return c.internalClient.Close() 169 } 170 171 // setGoogleClientInfo sets the name and version of the application in 172 // the `x-goog-api-client` header passed on each request. Intended for 173 // use by Google-written clients. 174 func (c *VertexRagDataClient) setGoogleClientInfo(keyval ...string) { 175 c.internalClient.setGoogleClientInfo(keyval...) 176 } 177 178 // Connection returns a connection to the API service. 179 // 180 // Deprecated: Connections are now pooled so this method does not always 181 // return the same resource. 182 func (c *VertexRagDataClient) Connection() *grpc.ClientConn { 183 return c.internalClient.Connection() 184 } 185 186 // CreateRagCorpus creates a RagCorpus. 187 func (c *VertexRagDataClient) CreateRagCorpus(ctx context.Context, req *aiplatformpb.CreateRagCorpusRequest, opts ...gax.CallOption) (*CreateRagCorpusOperation, error) { 188 return c.internalClient.CreateRagCorpus(ctx, req, opts...) 189 } 190 191 // CreateRagCorpusOperation returns a new CreateRagCorpusOperation from a given name. 192 // The name must be that of a previously created CreateRagCorpusOperation, possibly from a different process. 193 func (c *VertexRagDataClient) CreateRagCorpusOperation(name string) *CreateRagCorpusOperation { 194 return c.internalClient.CreateRagCorpusOperation(name) 195 } 196 197 // UpdateRagCorpus updates a RagCorpus. 198 func (c *VertexRagDataClient) UpdateRagCorpus(ctx context.Context, req *aiplatformpb.UpdateRagCorpusRequest, opts ...gax.CallOption) (*UpdateRagCorpusOperation, error) { 199 return c.internalClient.UpdateRagCorpus(ctx, req, opts...) 200 } 201 202 // UpdateRagCorpusOperation returns a new UpdateRagCorpusOperation from a given name. 203 // The name must be that of a previously created UpdateRagCorpusOperation, possibly from a different process. 204 func (c *VertexRagDataClient) UpdateRagCorpusOperation(name string) *UpdateRagCorpusOperation { 205 return c.internalClient.UpdateRagCorpusOperation(name) 206 } 207 208 // GetRagCorpus gets a RagCorpus. 209 func (c *VertexRagDataClient) GetRagCorpus(ctx context.Context, req *aiplatformpb.GetRagCorpusRequest, opts ...gax.CallOption) (*aiplatformpb.RagCorpus, error) { 210 return c.internalClient.GetRagCorpus(ctx, req, opts...) 211 } 212 213 // ListRagCorpora lists RagCorpora in a Location. 214 func (c *VertexRagDataClient) ListRagCorpora(ctx context.Context, req *aiplatformpb.ListRagCorporaRequest, opts ...gax.CallOption) *RagCorpusIterator { 215 return c.internalClient.ListRagCorpora(ctx, req, opts...) 216 } 217 218 // DeleteRagCorpus deletes a RagCorpus. 219 func (c *VertexRagDataClient) DeleteRagCorpus(ctx context.Context, req *aiplatformpb.DeleteRagCorpusRequest, opts ...gax.CallOption) (*DeleteRagCorpusOperation, error) { 220 return c.internalClient.DeleteRagCorpus(ctx, req, opts...) 221 } 222 223 // DeleteRagCorpusOperation returns a new DeleteRagCorpusOperation from a given name. 224 // The name must be that of a previously created DeleteRagCorpusOperation, possibly from a different process. 225 func (c *VertexRagDataClient) DeleteRagCorpusOperation(name string) *DeleteRagCorpusOperation { 226 return c.internalClient.DeleteRagCorpusOperation(name) 227 } 228 229 // UploadRagFile upload a file into a RagCorpus. 230 func (c *VertexRagDataClient) UploadRagFile(ctx context.Context, req *aiplatformpb.UploadRagFileRequest, opts ...gax.CallOption) (*aiplatformpb.UploadRagFileResponse, error) { 231 return c.internalClient.UploadRagFile(ctx, req, opts...) 232 } 233 234 // ImportRagFiles import files from Google Cloud Storage or Google Drive into a RagCorpus. 235 func (c *VertexRagDataClient) ImportRagFiles(ctx context.Context, req *aiplatformpb.ImportRagFilesRequest, opts ...gax.CallOption) (*ImportRagFilesOperation, error) { 236 return c.internalClient.ImportRagFiles(ctx, req, opts...) 237 } 238 239 // ImportRagFilesOperation returns a new ImportRagFilesOperation from a given name. 240 // The name must be that of a previously created ImportRagFilesOperation, possibly from a different process. 241 func (c *VertexRagDataClient) ImportRagFilesOperation(name string) *ImportRagFilesOperation { 242 return c.internalClient.ImportRagFilesOperation(name) 243 } 244 245 // GetRagFile gets a RagFile. 246 func (c *VertexRagDataClient) GetRagFile(ctx context.Context, req *aiplatformpb.GetRagFileRequest, opts ...gax.CallOption) (*aiplatformpb.RagFile, error) { 247 return c.internalClient.GetRagFile(ctx, req, opts...) 248 } 249 250 // ListRagFiles lists RagFiles in a RagCorpus. 251 func (c *VertexRagDataClient) ListRagFiles(ctx context.Context, req *aiplatformpb.ListRagFilesRequest, opts ...gax.CallOption) *RagFileIterator { 252 return c.internalClient.ListRagFiles(ctx, req, opts...) 253 } 254 255 // DeleteRagFile deletes a RagFile. 256 func (c *VertexRagDataClient) DeleteRagFile(ctx context.Context, req *aiplatformpb.DeleteRagFileRequest, opts ...gax.CallOption) (*DeleteRagFileOperation, error) { 257 return c.internalClient.DeleteRagFile(ctx, req, opts...) 258 } 259 260 // DeleteRagFileOperation returns a new DeleteRagFileOperation from a given name. 261 // The name must be that of a previously created DeleteRagFileOperation, possibly from a different process. 262 func (c *VertexRagDataClient) DeleteRagFileOperation(name string) *DeleteRagFileOperation { 263 return c.internalClient.DeleteRagFileOperation(name) 264 } 265 266 // UpdateRagEngineConfig updates a RagEngineConfig. 267 func (c *VertexRagDataClient) UpdateRagEngineConfig(ctx context.Context, req *aiplatformpb.UpdateRagEngineConfigRequest, opts ...gax.CallOption) (*UpdateRagEngineConfigOperation, error) { 268 return c.internalClient.UpdateRagEngineConfig(ctx, req, opts...) 269 } 270 271 // UpdateRagEngineConfigOperation returns a new UpdateRagEngineConfigOperation from a given name. 272 // The name must be that of a previously created UpdateRagEngineConfigOperation, possibly from a different process. 273 func (c *VertexRagDataClient) UpdateRagEngineConfigOperation(name string) *UpdateRagEngineConfigOperation { 274 return c.internalClient.UpdateRagEngineConfigOperation(name) 275 } 276 277 // GetRagEngineConfig gets a RagEngineConfig. 278 func (c *VertexRagDataClient) GetRagEngineConfig(ctx context.Context, req *aiplatformpb.GetRagEngineConfigRequest, opts ...gax.CallOption) (*aiplatformpb.RagEngineConfig, error) { 279 return c.internalClient.GetRagEngineConfig(ctx, req, opts...) 280 } 281 282 // GetLocation gets information about a location. 283 func (c *VertexRagDataClient) 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 *VertexRagDataClient) 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 *VertexRagDataClient) 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 *VertexRagDataClient) 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 *VertexRagDataClient) 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 *VertexRagDataClient) 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 *VertexRagDataClient) 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 *VertexRagDataClient) 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 *VertexRagDataClient) 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 *VertexRagDataClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 340 return c.internalClient.WaitOperation(ctx, req, opts...) 341 } 342 343 // vertexRagDataGRPCClient 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 vertexRagDataGRPCClient 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 VertexRagDataClient 351 CallOptions **VertexRagDataCallOptions 352 353 // The gRPC API client. 354 vertexRagDataClient aiplatformpb.VertexRagDataServiceClient 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 // NewVertexRagDataClient creates a new vertex rag data 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 // A service for managing user data for RAG. 377 func NewVertexRagDataClient(ctx context.Context, opts ...option.ClientOption) (*VertexRagDataClient, error) { 378 clientOpts := defaultVertexRagDataGRPCClientOptions() 379 if newVertexRagDataClientHook != nil { 380 hookOpts, err := newVertexRagDataClientHook(ctx, clientHookParams{}) 381 if err != nil { 382 return nil, err 383 } 384 clientOpts = append(clientOpts, hookOpts...) 385 } 386 387 connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) 388 if err != nil { 389 return nil, err 390 } 391 client := VertexRagDataClient{CallOptions: defaultVertexRagDataCallOptions()} 392 393 c := &vertexRagDataGRPCClient{ 394 connPool: connPool, 395 vertexRagDataClient: aiplatformpb.NewVertexRagDataServiceClient(connPool), 396 CallOptions: &client.CallOptions, 397 logger: internaloption.GetLogger(opts), 398 operationsClient: longrunningpb.NewOperationsClient(connPool), 399 iamPolicyClient: iampb.NewIAMPolicyClient(connPool), 400 locationsClient: locationpb.NewLocationsClient(connPool), 401 } 402 c.setGoogleClientInfo() 403 404 client.internalClient = c 405 406 client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool)) 407 if err != nil { 408 // This error "should not happen", since we are just reusing old connection pool 409 // and never actually need to dial. 410 // If this does happen, we could leak connp. However, we cannot close conn: 411 // If the user invoked the constructor with option.WithGRPCConn, 412 // we would close a connection that's still in use. 413 // TODO: investigate error conditions. 414 return nil, err 415 } 416 c.LROClient = &client.LROClient 417 return &client, nil 418 } 419 420 // Connection returns a connection to the API service. 421 // 422 // Deprecated: Connections are now pooled so this method does not always 423 // return the same resource. 424 func (c *vertexRagDataGRPCClient) Connection() *grpc.ClientConn { 425 return c.connPool.Conn() 426 } 427 428 // setGoogleClientInfo sets the name and version of the application in 429 // the `x-goog-api-client` header passed on each request. Intended for 430 // use by Google-written clients. 431 func (c *vertexRagDataGRPCClient) setGoogleClientInfo(keyval ...string) { 432 kv := append([]string{"gl-go", gax.GoVersion}, keyval...) 433 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion) 434 c.xGoogHeaders = []string{ 435 "x-goog-api-client", gax.XGoogHeader(kv...), 436 } 437 } 438 439 // Close closes the connection to the API service. The user should invoke this when 440 // the client is no longer required. 441 func (c *vertexRagDataGRPCClient) Close() error { 442 return c.connPool.Close() 443 } 444 445 func (c *vertexRagDataGRPCClient) CreateRagCorpus(ctx context.Context, req *aiplatformpb.CreateRagCorpusRequest, opts ...gax.CallOption) (*CreateRagCorpusOperation, error) { 446 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 447 448 hds = append(c.xGoogHeaders, hds...) 449 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 450 opts = append((*c.CallOptions).CreateRagCorpus[0:len((*c.CallOptions).CreateRagCorpus):len((*c.CallOptions).CreateRagCorpus)], opts...) 451 var resp *longrunningpb.Operation 452 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 453 var err error 454 resp, err = executeRPC(ctx, c.vertexRagDataClient.CreateRagCorpus, req, settings.GRPC, c.logger, "CreateRagCorpus") 455 return err 456 }, opts...) 457 if err != nil { 458 return nil, err 459 } 460 return &CreateRagCorpusOperation{ 461 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 462 }, nil 463 } 464 465 func (c *vertexRagDataGRPCClient) UpdateRagCorpus(ctx context.Context, req *aiplatformpb.UpdateRagCorpusRequest, opts ...gax.CallOption) (*UpdateRagCorpusOperation, error) { 466 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "rag_corpus.name", url.QueryEscape(req.GetRagCorpus().GetName()))} 467 468 hds = append(c.xGoogHeaders, hds...) 469 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 470 opts = append((*c.CallOptions).UpdateRagCorpus[0:len((*c.CallOptions).UpdateRagCorpus):len((*c.CallOptions).UpdateRagCorpus)], opts...) 471 var resp *longrunningpb.Operation 472 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 473 var err error 474 resp, err = executeRPC(ctx, c.vertexRagDataClient.UpdateRagCorpus, req, settings.GRPC, c.logger, "UpdateRagCorpus") 475 return err 476 }, opts...) 477 if err != nil { 478 return nil, err 479 } 480 return &UpdateRagCorpusOperation{ 481 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 482 }, nil 483 } 484 485 func (c *vertexRagDataGRPCClient) GetRagCorpus(ctx context.Context, req *aiplatformpb.GetRagCorpusRequest, opts ...gax.CallOption) (*aiplatformpb.RagCorpus, error) { 486 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 487 488 hds = append(c.xGoogHeaders, hds...) 489 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 490 opts = append((*c.CallOptions).GetRagCorpus[0:len((*c.CallOptions).GetRagCorpus):len((*c.CallOptions).GetRagCorpus)], opts...) 491 var resp *aiplatformpb.RagCorpus 492 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 493 var err error 494 resp, err = executeRPC(ctx, c.vertexRagDataClient.GetRagCorpus, req, settings.GRPC, c.logger, "GetRagCorpus") 495 return err 496 }, opts...) 497 if err != nil { 498 return nil, err 499 } 500 return resp, nil 501 } 502 503 func (c *vertexRagDataGRPCClient) ListRagCorpora(ctx context.Context, req *aiplatformpb.ListRagCorporaRequest, opts ...gax.CallOption) *RagCorpusIterator { 504 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 505 506 hds = append(c.xGoogHeaders, hds...) 507 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 508 opts = append((*c.CallOptions).ListRagCorpora[0:len((*c.CallOptions).ListRagCorpora):len((*c.CallOptions).ListRagCorpora)], opts...) 509 it := &RagCorpusIterator{} 510 req = proto.Clone(req).(*aiplatformpb.ListRagCorporaRequest) 511 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.RagCorpus, string, error) { 512 resp := &aiplatformpb.ListRagCorporaResponse{} 513 if pageToken != "" { 514 req.PageToken = pageToken 515 } 516 if pageSize > math.MaxInt32 { 517 req.PageSize = math.MaxInt32 518 } else if pageSize != 0 { 519 req.PageSize = int32(pageSize) 520 } 521 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 522 var err error 523 resp, err = executeRPC(ctx, c.vertexRagDataClient.ListRagCorpora, req, settings.GRPC, c.logger, "ListRagCorpora") 524 return err 525 }, opts...) 526 if err != nil { 527 return nil, "", err 528 } 529 530 it.Response = resp 531 return resp.GetRagCorpora(), resp.GetNextPageToken(), nil 532 } 533 fetch := func(pageSize int, pageToken string) (string, error) { 534 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 535 if err != nil { 536 return "", err 537 } 538 it.items = append(it.items, items...) 539 return nextPageToken, nil 540 } 541 542 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 543 it.pageInfo.MaxSize = int(req.GetPageSize()) 544 it.pageInfo.Token = req.GetPageToken() 545 546 return it 547 } 548 549 func (c *vertexRagDataGRPCClient) DeleteRagCorpus(ctx context.Context, req *aiplatformpb.DeleteRagCorpusRequest, opts ...gax.CallOption) (*DeleteRagCorpusOperation, error) { 550 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 551 552 hds = append(c.xGoogHeaders, hds...) 553 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 554 opts = append((*c.CallOptions).DeleteRagCorpus[0:len((*c.CallOptions).DeleteRagCorpus):len((*c.CallOptions).DeleteRagCorpus)], opts...) 555 var resp *longrunningpb.Operation 556 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 557 var err error 558 resp, err = executeRPC(ctx, c.vertexRagDataClient.DeleteRagCorpus, req, settings.GRPC, c.logger, "DeleteRagCorpus") 559 return err 560 }, opts...) 561 if err != nil { 562 return nil, err 563 } 564 return &DeleteRagCorpusOperation{ 565 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 566 }, nil 567 } 568 569 func (c *vertexRagDataGRPCClient) UploadRagFile(ctx context.Context, req *aiplatformpb.UploadRagFileRequest, opts ...gax.CallOption) (*aiplatformpb.UploadRagFileResponse, error) { 570 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 571 572 hds = append(c.xGoogHeaders, hds...) 573 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 574 opts = append((*c.CallOptions).UploadRagFile[0:len((*c.CallOptions).UploadRagFile):len((*c.CallOptions).UploadRagFile)], opts...) 575 var resp *aiplatformpb.UploadRagFileResponse 576 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 577 var err error 578 resp, err = executeRPC(ctx, c.vertexRagDataClient.UploadRagFile, req, settings.GRPC, c.logger, "UploadRagFile") 579 return err 580 }, opts...) 581 if err != nil { 582 return nil, err 583 } 584 return resp, nil 585 } 586 587 func (c *vertexRagDataGRPCClient) ImportRagFiles(ctx context.Context, req *aiplatformpb.ImportRagFilesRequest, opts ...gax.CallOption) (*ImportRagFilesOperation, error) { 588 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 589 590 hds = append(c.xGoogHeaders, hds...) 591 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 592 opts = append((*c.CallOptions).ImportRagFiles[0:len((*c.CallOptions).ImportRagFiles):len((*c.CallOptions).ImportRagFiles)], opts...) 593 var resp *longrunningpb.Operation 594 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 595 var err error 596 resp, err = executeRPC(ctx, c.vertexRagDataClient.ImportRagFiles, req, settings.GRPC, c.logger, "ImportRagFiles") 597 return err 598 }, opts...) 599 if err != nil { 600 return nil, err 601 } 602 return &ImportRagFilesOperation{ 603 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 604 }, nil 605 } 606 607 func (c *vertexRagDataGRPCClient) GetRagFile(ctx context.Context, req *aiplatformpb.GetRagFileRequest, opts ...gax.CallOption) (*aiplatformpb.RagFile, error) { 608 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 609 610 hds = append(c.xGoogHeaders, hds...) 611 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 612 opts = append((*c.CallOptions).GetRagFile[0:len((*c.CallOptions).GetRagFile):len((*c.CallOptions).GetRagFile)], opts...) 613 var resp *aiplatformpb.RagFile 614 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 615 var err error 616 resp, err = executeRPC(ctx, c.vertexRagDataClient.GetRagFile, req, settings.GRPC, c.logger, "GetRagFile") 617 return err 618 }, opts...) 619 if err != nil { 620 return nil, err 621 } 622 return resp, nil 623 } 624 625 func (c *vertexRagDataGRPCClient) ListRagFiles(ctx context.Context, req *aiplatformpb.ListRagFilesRequest, opts ...gax.CallOption) *RagFileIterator { 626 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} 627 628 hds = append(c.xGoogHeaders, hds...) 629 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 630 opts = append((*c.CallOptions).ListRagFiles[0:len((*c.CallOptions).ListRagFiles):len((*c.CallOptions).ListRagFiles)], opts...) 631 it := &RagFileIterator{} 632 req = proto.Clone(req).(*aiplatformpb.ListRagFilesRequest) 633 it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.RagFile, string, error) { 634 resp := &aiplatformpb.ListRagFilesResponse{} 635 if pageToken != "" { 636 req.PageToken = pageToken 637 } 638 if pageSize > math.MaxInt32 { 639 req.PageSize = math.MaxInt32 640 } else if pageSize != 0 { 641 req.PageSize = int32(pageSize) 642 } 643 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 644 var err error 645 resp, err = executeRPC(ctx, c.vertexRagDataClient.ListRagFiles, req, settings.GRPC, c.logger, "ListRagFiles") 646 return err 647 }, opts...) 648 if err != nil { 649 return nil, "", err 650 } 651 652 it.Response = resp 653 return resp.GetRagFiles(), resp.GetNextPageToken(), nil 654 } 655 fetch := func(pageSize int, pageToken string) (string, error) { 656 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 657 if err != nil { 658 return "", err 659 } 660 it.items = append(it.items, items...) 661 return nextPageToken, nil 662 } 663 664 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 665 it.pageInfo.MaxSize = int(req.GetPageSize()) 666 it.pageInfo.Token = req.GetPageToken() 667 668 return it 669 } 670 671 func (c *vertexRagDataGRPCClient) DeleteRagFile(ctx context.Context, req *aiplatformpb.DeleteRagFileRequest, opts ...gax.CallOption) (*DeleteRagFileOperation, error) { 672 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 673 674 hds = append(c.xGoogHeaders, hds...) 675 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 676 opts = append((*c.CallOptions).DeleteRagFile[0:len((*c.CallOptions).DeleteRagFile):len((*c.CallOptions).DeleteRagFile)], opts...) 677 var resp *longrunningpb.Operation 678 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 679 var err error 680 resp, err = executeRPC(ctx, c.vertexRagDataClient.DeleteRagFile, req, settings.GRPC, c.logger, "DeleteRagFile") 681 return err 682 }, opts...) 683 if err != nil { 684 return nil, err 685 } 686 return &DeleteRagFileOperation{ 687 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 688 }, nil 689 } 690 691 func (c *vertexRagDataGRPCClient) UpdateRagEngineConfig(ctx context.Context, req *aiplatformpb.UpdateRagEngineConfigRequest, opts ...gax.CallOption) (*UpdateRagEngineConfigOperation, error) { 692 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "rag_engine_config.name", url.QueryEscape(req.GetRagEngineConfig().GetName()))} 693 694 hds = append(c.xGoogHeaders, hds...) 695 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 696 opts = append((*c.CallOptions).UpdateRagEngineConfig[0:len((*c.CallOptions).UpdateRagEngineConfig):len((*c.CallOptions).UpdateRagEngineConfig)], opts...) 697 var resp *longrunningpb.Operation 698 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 699 var err error 700 resp, err = executeRPC(ctx, c.vertexRagDataClient.UpdateRagEngineConfig, req, settings.GRPC, c.logger, "UpdateRagEngineConfig") 701 return err 702 }, opts...) 703 if err != nil { 704 return nil, err 705 } 706 return &UpdateRagEngineConfigOperation{ 707 lro: longrunning.InternalNewOperation(*c.LROClient, resp), 708 }, nil 709 } 710 711 func (c *vertexRagDataGRPCClient) GetRagEngineConfig(ctx context.Context, req *aiplatformpb.GetRagEngineConfigRequest, opts ...gax.CallOption) (*aiplatformpb.RagEngineConfig, error) { 712 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 713 714 hds = append(c.xGoogHeaders, hds...) 715 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 716 opts = append((*c.CallOptions).GetRagEngineConfig[0:len((*c.CallOptions).GetRagEngineConfig):len((*c.CallOptions).GetRagEngineConfig)], opts...) 717 var resp *aiplatformpb.RagEngineConfig 718 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 719 var err error 720 resp, err = executeRPC(ctx, c.vertexRagDataClient.GetRagEngineConfig, req, settings.GRPC, c.logger, "GetRagEngineConfig") 721 return err 722 }, opts...) 723 if err != nil { 724 return nil, err 725 } 726 return resp, nil 727 } 728 729 func (c *vertexRagDataGRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { 730 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 731 732 hds = append(c.xGoogHeaders, hds...) 733 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 734 opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...) 735 var resp *locationpb.Location 736 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 737 var err error 738 resp, err = executeRPC(ctx, c.locationsClient.GetLocation, req, settings.GRPC, c.logger, "GetLocation") 739 return err 740 }, opts...) 741 if err != nil { 742 return nil, err 743 } 744 return resp, nil 745 } 746 747 func (c *vertexRagDataGRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { 748 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 749 750 hds = append(c.xGoogHeaders, hds...) 751 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 752 opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...) 753 it := &LocationIterator{} 754 req = proto.Clone(req).(*locationpb.ListLocationsRequest) 755 it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) { 756 resp := &locationpb.ListLocationsResponse{} 757 if pageToken != "" { 758 req.PageToken = pageToken 759 } 760 if pageSize > math.MaxInt32 { 761 req.PageSize = math.MaxInt32 762 } else if pageSize != 0 { 763 req.PageSize = int32(pageSize) 764 } 765 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 766 var err error 767 resp, err = executeRPC(ctx, c.locationsClient.ListLocations, req, settings.GRPC, c.logger, "ListLocations") 768 return err 769 }, opts...) 770 if err != nil { 771 return nil, "", err 772 } 773 774 it.Response = resp 775 return resp.GetLocations(), resp.GetNextPageToken(), nil 776 } 777 fetch := func(pageSize int, pageToken string) (string, error) { 778 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 779 if err != nil { 780 return "", err 781 } 782 it.items = append(it.items, items...) 783 return nextPageToken, nil 784 } 785 786 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 787 it.pageInfo.MaxSize = int(req.GetPageSize()) 788 it.pageInfo.Token = req.GetPageToken() 789 790 return it 791 } 792 793 func (c *vertexRagDataGRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 794 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 795 796 hds = append(c.xGoogHeaders, hds...) 797 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 798 opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...) 799 var resp *iampb.Policy 800 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 801 var err error 802 resp, err = executeRPC(ctx, c.iamPolicyClient.GetIamPolicy, req, settings.GRPC, c.logger, "GetIamPolicy") 803 return err 804 }, opts...) 805 if err != nil { 806 return nil, err 807 } 808 return resp, nil 809 } 810 811 func (c *vertexRagDataGRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { 812 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 813 814 hds = append(c.xGoogHeaders, hds...) 815 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 816 opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...) 817 var resp *iampb.Policy 818 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 819 var err error 820 resp, err = executeRPC(ctx, c.iamPolicyClient.SetIamPolicy, req, settings.GRPC, c.logger, "SetIamPolicy") 821 return err 822 }, opts...) 823 if err != nil { 824 return nil, err 825 } 826 return resp, nil 827 } 828 829 func (c *vertexRagDataGRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { 830 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} 831 832 hds = append(c.xGoogHeaders, hds...) 833 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 834 opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...) 835 var resp *iampb.TestIamPermissionsResponse 836 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 837 var err error 838 resp, err = executeRPC(ctx, c.iamPolicyClient.TestIamPermissions, req, settings.GRPC, c.logger, "TestIamPermissions") 839 return err 840 }, opts...) 841 if err != nil { 842 return nil, err 843 } 844 return resp, nil 845 } 846 847 func (c *vertexRagDataGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { 848 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 849 850 hds = append(c.xGoogHeaders, hds...) 851 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 852 opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...) 853 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 854 var err error 855 _, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation") 856 return err 857 }, opts...) 858 return err 859 } 860 861 func (c *vertexRagDataGRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { 862 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 863 864 hds = append(c.xGoogHeaders, hds...) 865 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 866 opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...) 867 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 868 var err error 869 _, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation") 870 return err 871 }, opts...) 872 return err 873 } 874 875 func (c *vertexRagDataGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 876 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 877 878 hds = append(c.xGoogHeaders, hds...) 879 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 880 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...) 881 var resp *longrunningpb.Operation 882 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 883 var err error 884 resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation") 885 return err 886 }, opts...) 887 if err != nil { 888 return nil, err 889 } 890 return resp, nil 891 } 892 893 func (c *vertexRagDataGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { 894 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 895 896 hds = append(c.xGoogHeaders, hds...) 897 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 898 opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...) 899 it := &OperationIterator{} 900 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest) 901 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) { 902 resp := &longrunningpb.ListOperationsResponse{} 903 if pageToken != "" { 904 req.PageToken = pageToken 905 } 906 if pageSize > math.MaxInt32 { 907 req.PageSize = math.MaxInt32 908 } else if pageSize != 0 { 909 req.PageSize = int32(pageSize) 910 } 911 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 912 var err error 913 resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations") 914 return err 915 }, opts...) 916 if err != nil { 917 return nil, "", err 918 } 919 920 it.Response = resp 921 return resp.GetOperations(), resp.GetNextPageToken(), nil 922 } 923 fetch := func(pageSize int, pageToken string) (string, error) { 924 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 925 if err != nil { 926 return "", err 927 } 928 it.items = append(it.items, items...) 929 return nextPageToken, nil 930 } 931 932 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 933 it.pageInfo.MaxSize = int(req.GetPageSize()) 934 it.pageInfo.Token = req.GetPageToken() 935 936 return it 937 } 938 939 func (c *vertexRagDataGRPCClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { 940 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} 941 942 hds = append(c.xGoogHeaders, hds...) 943 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) 944 opts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...) 945 var resp *longrunningpb.Operation 946 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 947 var err error 948 resp, err = executeRPC(ctx, c.operationsClient.WaitOperation, req, settings.GRPC, c.logger, "WaitOperation") 949 return err 950 }, opts...) 951 if err != nil { 952 return nil, err 953 } 954 return resp, nil 955 } 956 957 // CreateRagCorpusOperation returns a new CreateRagCorpusOperation from a given name. 958 // The name must be that of a previously created CreateRagCorpusOperation, possibly from a different process. 959 func (c *vertexRagDataGRPCClient) CreateRagCorpusOperation(name string) *CreateRagCorpusOperation { 960 return &CreateRagCorpusOperation{ 961 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 962 } 963 } 964 965 // DeleteRagCorpusOperation returns a new DeleteRagCorpusOperation from a given name. 966 // The name must be that of a previously created DeleteRagCorpusOperation, possibly from a different process. 967 func (c *vertexRagDataGRPCClient) DeleteRagCorpusOperation(name string) *DeleteRagCorpusOperation { 968 return &DeleteRagCorpusOperation{ 969 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 970 } 971 } 972 973 // DeleteRagFileOperation returns a new DeleteRagFileOperation from a given name. 974 // The name must be that of a previously created DeleteRagFileOperation, possibly from a different process. 975 func (c *vertexRagDataGRPCClient) DeleteRagFileOperation(name string) *DeleteRagFileOperation { 976 return &DeleteRagFileOperation{ 977 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 978 } 979 } 980 981 // ImportRagFilesOperation returns a new ImportRagFilesOperation from a given name. 982 // The name must be that of a previously created ImportRagFilesOperation, possibly from a different process. 983 func (c *vertexRagDataGRPCClient) ImportRagFilesOperation(name string) *ImportRagFilesOperation { 984 return &ImportRagFilesOperation{ 985 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 986 } 987 } 988 989 // UpdateRagCorpusOperation returns a new UpdateRagCorpusOperation from a given name. 990 // The name must be that of a previously created UpdateRagCorpusOperation, possibly from a different process. 991 func (c *vertexRagDataGRPCClient) UpdateRagCorpusOperation(name string) *UpdateRagCorpusOperation { 992 return &UpdateRagCorpusOperation{ 993 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 994 } 995 } 996 997 // UpdateRagEngineConfigOperation returns a new UpdateRagEngineConfigOperation from a given name. 998 // The name must be that of a previously created UpdateRagEngineConfigOperation, possibly from a different process. 999 func (c *vertexRagDataGRPCClient) UpdateRagEngineConfigOperation(name string) *UpdateRagEngineConfigOperation { 1000 return &UpdateRagEngineConfigOperation{ 1001 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), 1002 } 1003 }