cloud.google.com/go/aiplatform@v1.106.0/apiv1/vertex_rag_data_client_example_test.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_test
    18  
    19  import (
    20  	"context"
    21  
    22  	aiplatform "cloud.google.com/go/aiplatform/apiv1"
    23  	aiplatformpb "cloud.google.com/go/aiplatform/apiv1/aiplatformpb"
    24  	iampb "cloud.google.com/go/iam/apiv1/iampb"
    25  	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
    26  	"google.golang.org/api/iterator"
    27  	locationpb "google.golang.org/genproto/googleapis/cloud/location"
    28  )
    29  
    30  func ExampleNewVertexRagDataClient() {
    31  	ctx := context.Background()
    32  	// This snippet has been automatically generated and should be regarded as a code template only.
    33  	// It will require modifications to work:
    34  	// - It may require correct/in-range values for request initialization.
    35  	// - It may require specifying regional endpoints when creating the service client as shown in:
    36  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
    37  	c, err := aiplatform.NewVertexRagDataClient(ctx)
    38  	if err != nil {
    39  		// TODO: Handle error.
    40  	}
    41  	defer c.Close()
    42  
    43  	// TODO: Use client.
    44  	_ = c
    45  }
    46  
    47  func ExampleVertexRagDataClient_CreateRagCorpus() {
    48  	ctx := context.Background()
    49  	// This snippet has been automatically generated and should be regarded as a code template only.
    50  	// It will require modifications to work:
    51  	// - It may require correct/in-range values for request initialization.
    52  	// - It may require specifying regional endpoints when creating the service client as shown in:
    53  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
    54  	c, err := aiplatform.NewVertexRagDataClient(ctx)
    55  	if err != nil {
    56  		// TODO: Handle error.
    57  	}
    58  	defer c.Close()
    59  
    60  	req := &aiplatformpb.CreateRagCorpusRequest{
    61  		// TODO: Fill request struct fields.
    62  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateRagCorpusRequest.
    63  	}
    64  	op, err := c.CreateRagCorpus(ctx, req)
    65  	if err != nil {
    66  		// TODO: Handle error.
    67  	}
    68  
    69  	resp, err := op.Wait(ctx)
    70  	if err != nil {
    71  		// TODO: Handle error.
    72  	}
    73  	// TODO: Use resp.
    74  	_ = resp
    75  }
    76  
    77  func ExampleVertexRagDataClient_DeleteRagCorpus() {
    78  	ctx := context.Background()
    79  	// This snippet has been automatically generated and should be regarded as a code template only.
    80  	// It will require modifications to work:
    81  	// - It may require correct/in-range values for request initialization.
    82  	// - It may require specifying regional endpoints when creating the service client as shown in:
    83  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
    84  	c, err := aiplatform.NewVertexRagDataClient(ctx)
    85  	if err != nil {
    86  		// TODO: Handle error.
    87  	}
    88  	defer c.Close()
    89  
    90  	req := &aiplatformpb.DeleteRagCorpusRequest{
    91  		// TODO: Fill request struct fields.
    92  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteRagCorpusRequest.
    93  	}
    94  	op, err := c.DeleteRagCorpus(ctx, req)
    95  	if err != nil {
    96  		// TODO: Handle error.
    97  	}
    98  
    99  	err = op.Wait(ctx)
   100  	if err != nil {
   101  		// TODO: Handle error.
   102  	}
   103  }
   104  
   105  func ExampleVertexRagDataClient_DeleteRagFile() {
   106  	ctx := context.Background()
   107  	// This snippet has been automatically generated and should be regarded as a code template only.
   108  	// It will require modifications to work:
   109  	// - It may require correct/in-range values for request initialization.
   110  	// - It may require specifying regional endpoints when creating the service client as shown in:
   111  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   112  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   113  	if err != nil {
   114  		// TODO: Handle error.
   115  	}
   116  	defer c.Close()
   117  
   118  	req := &aiplatformpb.DeleteRagFileRequest{
   119  		// TODO: Fill request struct fields.
   120  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteRagFileRequest.
   121  	}
   122  	op, err := c.DeleteRagFile(ctx, req)
   123  	if err != nil {
   124  		// TODO: Handle error.
   125  	}
   126  
   127  	err = op.Wait(ctx)
   128  	if err != nil {
   129  		// TODO: Handle error.
   130  	}
   131  }
   132  
   133  func ExampleVertexRagDataClient_GetRagCorpus() {
   134  	ctx := context.Background()
   135  	// This snippet has been automatically generated and should be regarded as a code template only.
   136  	// It will require modifications to work:
   137  	// - It may require correct/in-range values for request initialization.
   138  	// - It may require specifying regional endpoints when creating the service client as shown in:
   139  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   140  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   141  	if err != nil {
   142  		// TODO: Handle error.
   143  	}
   144  	defer c.Close()
   145  
   146  	req := &aiplatformpb.GetRagCorpusRequest{
   147  		// TODO: Fill request struct fields.
   148  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetRagCorpusRequest.
   149  	}
   150  	resp, err := c.GetRagCorpus(ctx, req)
   151  	if err != nil {
   152  		// TODO: Handle error.
   153  	}
   154  	// TODO: Use resp.
   155  	_ = resp
   156  }
   157  
   158  func ExampleVertexRagDataClient_GetRagEngineConfig() {
   159  	ctx := context.Background()
   160  	// This snippet has been automatically generated and should be regarded as a code template only.
   161  	// It will require modifications to work:
   162  	// - It may require correct/in-range values for request initialization.
   163  	// - It may require specifying regional endpoints when creating the service client as shown in:
   164  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   165  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   166  	if err != nil {
   167  		// TODO: Handle error.
   168  	}
   169  	defer c.Close()
   170  
   171  	req := &aiplatformpb.GetRagEngineConfigRequest{
   172  		// TODO: Fill request struct fields.
   173  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetRagEngineConfigRequest.
   174  	}
   175  	resp, err := c.GetRagEngineConfig(ctx, req)
   176  	if err != nil {
   177  		// TODO: Handle error.
   178  	}
   179  	// TODO: Use resp.
   180  	_ = resp
   181  }
   182  
   183  func ExampleVertexRagDataClient_GetRagFile() {
   184  	ctx := context.Background()
   185  	// This snippet has been automatically generated and should be regarded as a code template only.
   186  	// It will require modifications to work:
   187  	// - It may require correct/in-range values for request initialization.
   188  	// - It may require specifying regional endpoints when creating the service client as shown in:
   189  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   190  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   191  	if err != nil {
   192  		// TODO: Handle error.
   193  	}
   194  	defer c.Close()
   195  
   196  	req := &aiplatformpb.GetRagFileRequest{
   197  		// TODO: Fill request struct fields.
   198  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetRagFileRequest.
   199  	}
   200  	resp, err := c.GetRagFile(ctx, req)
   201  	if err != nil {
   202  		// TODO: Handle error.
   203  	}
   204  	// TODO: Use resp.
   205  	_ = resp
   206  }
   207  
   208  func ExampleVertexRagDataClient_ImportRagFiles() {
   209  	ctx := context.Background()
   210  	// This snippet has been automatically generated and should be regarded as a code template only.
   211  	// It will require modifications to work:
   212  	// - It may require correct/in-range values for request initialization.
   213  	// - It may require specifying regional endpoints when creating the service client as shown in:
   214  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   215  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   216  	if err != nil {
   217  		// TODO: Handle error.
   218  	}
   219  	defer c.Close()
   220  
   221  	req := &aiplatformpb.ImportRagFilesRequest{
   222  		// TODO: Fill request struct fields.
   223  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ImportRagFilesRequest.
   224  	}
   225  	op, err := c.ImportRagFiles(ctx, req)
   226  	if err != nil {
   227  		// TODO: Handle error.
   228  	}
   229  
   230  	resp, err := op.Wait(ctx)
   231  	if err != nil {
   232  		// TODO: Handle error.
   233  	}
   234  	// TODO: Use resp.
   235  	_ = resp
   236  }
   237  
   238  func ExampleVertexRagDataClient_ListRagCorpora() {
   239  	ctx := context.Background()
   240  	// This snippet has been automatically generated and should be regarded as a code template only.
   241  	// It will require modifications to work:
   242  	// - It may require correct/in-range values for request initialization.
   243  	// - It may require specifying regional endpoints when creating the service client as shown in:
   244  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   245  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   246  	if err != nil {
   247  		// TODO: Handle error.
   248  	}
   249  	defer c.Close()
   250  
   251  	req := &aiplatformpb.ListRagCorporaRequest{
   252  		// TODO: Fill request struct fields.
   253  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListRagCorporaRequest.
   254  	}
   255  	it := c.ListRagCorpora(ctx, req)
   256  	for {
   257  		resp, err := it.Next()
   258  		if err == iterator.Done {
   259  			break
   260  		}
   261  		if err != nil {
   262  			// TODO: Handle error.
   263  		}
   264  		// TODO: Use resp.
   265  		_ = resp
   266  
   267  		// If you need to access the underlying RPC response,
   268  		// you can do so by casting the `Response` as below.
   269  		// Otherwise, remove this line. Only populated after
   270  		// first call to Next(). Not safe for concurrent access.
   271  		_ = it.Response.(*aiplatformpb.ListRagCorporaResponse)
   272  	}
   273  }
   274  
   275  func ExampleVertexRagDataClient_ListRagFiles() {
   276  	ctx := context.Background()
   277  	// This snippet has been automatically generated and should be regarded as a code template only.
   278  	// It will require modifications to work:
   279  	// - It may require correct/in-range values for request initialization.
   280  	// - It may require specifying regional endpoints when creating the service client as shown in:
   281  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   282  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   283  	if err != nil {
   284  		// TODO: Handle error.
   285  	}
   286  	defer c.Close()
   287  
   288  	req := &aiplatformpb.ListRagFilesRequest{
   289  		// TODO: Fill request struct fields.
   290  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListRagFilesRequest.
   291  	}
   292  	it := c.ListRagFiles(ctx, req)
   293  	for {
   294  		resp, err := it.Next()
   295  		if err == iterator.Done {
   296  			break
   297  		}
   298  		if err != nil {
   299  			// TODO: Handle error.
   300  		}
   301  		// TODO: Use resp.
   302  		_ = resp
   303  
   304  		// If you need to access the underlying RPC response,
   305  		// you can do so by casting the `Response` as below.
   306  		// Otherwise, remove this line. Only populated after
   307  		// first call to Next(). Not safe for concurrent access.
   308  		_ = it.Response.(*aiplatformpb.ListRagFilesResponse)
   309  	}
   310  }
   311  
   312  func ExampleVertexRagDataClient_UpdateRagCorpus() {
   313  	ctx := context.Background()
   314  	// This snippet has been automatically generated and should be regarded as a code template only.
   315  	// It will require modifications to work:
   316  	// - It may require correct/in-range values for request initialization.
   317  	// - It may require specifying regional endpoints when creating the service client as shown in:
   318  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   319  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   320  	if err != nil {
   321  		// TODO: Handle error.
   322  	}
   323  	defer c.Close()
   324  
   325  	req := &aiplatformpb.UpdateRagCorpusRequest{
   326  		// TODO: Fill request struct fields.
   327  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#UpdateRagCorpusRequest.
   328  	}
   329  	op, err := c.UpdateRagCorpus(ctx, req)
   330  	if err != nil {
   331  		// TODO: Handle error.
   332  	}
   333  
   334  	resp, err := op.Wait(ctx)
   335  	if err != nil {
   336  		// TODO: Handle error.
   337  	}
   338  	// TODO: Use resp.
   339  	_ = resp
   340  }
   341  
   342  func ExampleVertexRagDataClient_UpdateRagEngineConfig() {
   343  	ctx := context.Background()
   344  	// This snippet has been automatically generated and should be regarded as a code template only.
   345  	// It will require modifications to work:
   346  	// - It may require correct/in-range values for request initialization.
   347  	// - It may require specifying regional endpoints when creating the service client as shown in:
   348  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   349  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   350  	if err != nil {
   351  		// TODO: Handle error.
   352  	}
   353  	defer c.Close()
   354  
   355  	req := &aiplatformpb.UpdateRagEngineConfigRequest{
   356  		// TODO: Fill request struct fields.
   357  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#UpdateRagEngineConfigRequest.
   358  	}
   359  	op, err := c.UpdateRagEngineConfig(ctx, req)
   360  	if err != nil {
   361  		// TODO: Handle error.
   362  	}
   363  
   364  	resp, err := op.Wait(ctx)
   365  	if err != nil {
   366  		// TODO: Handle error.
   367  	}
   368  	// TODO: Use resp.
   369  	_ = resp
   370  }
   371  
   372  func ExampleVertexRagDataClient_UploadRagFile() {
   373  	ctx := context.Background()
   374  	// This snippet has been automatically generated and should be regarded as a code template only.
   375  	// It will require modifications to work:
   376  	// - It may require correct/in-range values for request initialization.
   377  	// - It may require specifying regional endpoints when creating the service client as shown in:
   378  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   379  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   380  	if err != nil {
   381  		// TODO: Handle error.
   382  	}
   383  	defer c.Close()
   384  
   385  	req := &aiplatformpb.UploadRagFileRequest{
   386  		// TODO: Fill request struct fields.
   387  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#UploadRagFileRequest.
   388  	}
   389  	resp, err := c.UploadRagFile(ctx, req)
   390  	if err != nil {
   391  		// TODO: Handle error.
   392  	}
   393  	// TODO: Use resp.
   394  	_ = resp
   395  }
   396  
   397  func ExampleVertexRagDataClient_GetLocation() {
   398  	ctx := context.Background()
   399  	// This snippet has been automatically generated and should be regarded as a code template only.
   400  	// It will require modifications to work:
   401  	// - It may require correct/in-range values for request initialization.
   402  	// - It may require specifying regional endpoints when creating the service client as shown in:
   403  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   404  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   405  	if err != nil {
   406  		// TODO: Handle error.
   407  	}
   408  	defer c.Close()
   409  
   410  	req := &locationpb.GetLocationRequest{
   411  		// TODO: Fill request struct fields.
   412  		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
   413  	}
   414  	resp, err := c.GetLocation(ctx, req)
   415  	if err != nil {
   416  		// TODO: Handle error.
   417  	}
   418  	// TODO: Use resp.
   419  	_ = resp
   420  }
   421  
   422  func ExampleVertexRagDataClient_ListLocations() {
   423  	ctx := context.Background()
   424  	// This snippet has been automatically generated and should be regarded as a code template only.
   425  	// It will require modifications to work:
   426  	// - It may require correct/in-range values for request initialization.
   427  	// - It may require specifying regional endpoints when creating the service client as shown in:
   428  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   429  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   430  	if err != nil {
   431  		// TODO: Handle error.
   432  	}
   433  	defer c.Close()
   434  
   435  	req := &locationpb.ListLocationsRequest{
   436  		// TODO: Fill request struct fields.
   437  		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
   438  	}
   439  	it := c.ListLocations(ctx, req)
   440  	for {
   441  		resp, err := it.Next()
   442  		if err == iterator.Done {
   443  			break
   444  		}
   445  		if err != nil {
   446  			// TODO: Handle error.
   447  		}
   448  		// TODO: Use resp.
   449  		_ = resp
   450  
   451  		// If you need to access the underlying RPC response,
   452  		// you can do so by casting the `Response` as below.
   453  		// Otherwise, remove this line. Only populated after
   454  		// first call to Next(). Not safe for concurrent access.
   455  		_ = it.Response.(*locationpb.ListLocationsResponse)
   456  	}
   457  }
   458  
   459  func ExampleVertexRagDataClient_GetIamPolicy() {
   460  	ctx := context.Background()
   461  	// This snippet has been automatically generated and should be regarded as a code template only.
   462  	// It will require modifications to work:
   463  	// - It may require correct/in-range values for request initialization.
   464  	// - It may require specifying regional endpoints when creating the service client as shown in:
   465  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   466  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   467  	if err != nil {
   468  		// TODO: Handle error.
   469  	}
   470  	defer c.Close()
   471  
   472  	req := &iampb.GetIamPolicyRequest{
   473  		// TODO: Fill request struct fields.
   474  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
   475  	}
   476  	resp, err := c.GetIamPolicy(ctx, req)
   477  	if err != nil {
   478  		// TODO: Handle error.
   479  	}
   480  	// TODO: Use resp.
   481  	_ = resp
   482  }
   483  
   484  func ExampleVertexRagDataClient_SetIamPolicy() {
   485  	ctx := context.Background()
   486  	// This snippet has been automatically generated and should be regarded as a code template only.
   487  	// It will require modifications to work:
   488  	// - It may require correct/in-range values for request initialization.
   489  	// - It may require specifying regional endpoints when creating the service client as shown in:
   490  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   491  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   492  	if err != nil {
   493  		// TODO: Handle error.
   494  	}
   495  	defer c.Close()
   496  
   497  	req := &iampb.SetIamPolicyRequest{
   498  		// TODO: Fill request struct fields.
   499  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
   500  	}
   501  	resp, err := c.SetIamPolicy(ctx, req)
   502  	if err != nil {
   503  		// TODO: Handle error.
   504  	}
   505  	// TODO: Use resp.
   506  	_ = resp
   507  }
   508  
   509  func ExampleVertexRagDataClient_TestIamPermissions() {
   510  	ctx := context.Background()
   511  	// This snippet has been automatically generated and should be regarded as a code template only.
   512  	// It will require modifications to work:
   513  	// - It may require correct/in-range values for request initialization.
   514  	// - It may require specifying regional endpoints when creating the service client as shown in:
   515  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   516  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   517  	if err != nil {
   518  		// TODO: Handle error.
   519  	}
   520  	defer c.Close()
   521  
   522  	req := &iampb.TestIamPermissionsRequest{
   523  		// TODO: Fill request struct fields.
   524  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
   525  	}
   526  	resp, err := c.TestIamPermissions(ctx, req)
   527  	if err != nil {
   528  		// TODO: Handle error.
   529  	}
   530  	// TODO: Use resp.
   531  	_ = resp
   532  }
   533  
   534  func ExampleVertexRagDataClient_CancelOperation() {
   535  	ctx := context.Background()
   536  	// This snippet has been automatically generated and should be regarded as a code template only.
   537  	// It will require modifications to work:
   538  	// - It may require correct/in-range values for request initialization.
   539  	// - It may require specifying regional endpoints when creating the service client as shown in:
   540  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   541  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   542  	if err != nil {
   543  		// TODO: Handle error.
   544  	}
   545  	defer c.Close()
   546  
   547  	req := &longrunningpb.CancelOperationRequest{
   548  		// TODO: Fill request struct fields.
   549  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
   550  	}
   551  	err = c.CancelOperation(ctx, req)
   552  	if err != nil {
   553  		// TODO: Handle error.
   554  	}
   555  }
   556  
   557  func ExampleVertexRagDataClient_DeleteOperation() {
   558  	ctx := context.Background()
   559  	// This snippet has been automatically generated and should be regarded as a code template only.
   560  	// It will require modifications to work:
   561  	// - It may require correct/in-range values for request initialization.
   562  	// - It may require specifying regional endpoints when creating the service client as shown in:
   563  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   564  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   565  	if err != nil {
   566  		// TODO: Handle error.
   567  	}
   568  	defer c.Close()
   569  
   570  	req := &longrunningpb.DeleteOperationRequest{
   571  		// TODO: Fill request struct fields.
   572  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
   573  	}
   574  	err = c.DeleteOperation(ctx, req)
   575  	if err != nil {
   576  		// TODO: Handle error.
   577  	}
   578  }
   579  
   580  func ExampleVertexRagDataClient_GetOperation() {
   581  	ctx := context.Background()
   582  	// This snippet has been automatically generated and should be regarded as a code template only.
   583  	// It will require modifications to work:
   584  	// - It may require correct/in-range values for request initialization.
   585  	// - It may require specifying regional endpoints when creating the service client as shown in:
   586  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   587  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   588  	if err != nil {
   589  		// TODO: Handle error.
   590  	}
   591  	defer c.Close()
   592  
   593  	req := &longrunningpb.GetOperationRequest{
   594  		// TODO: Fill request struct fields.
   595  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
   596  	}
   597  	resp, err := c.GetOperation(ctx, req)
   598  	if err != nil {
   599  		// TODO: Handle error.
   600  	}
   601  	// TODO: Use resp.
   602  	_ = resp
   603  }
   604  
   605  func ExampleVertexRagDataClient_ListOperations() {
   606  	ctx := context.Background()
   607  	// This snippet has been automatically generated and should be regarded as a code template only.
   608  	// It will require modifications to work:
   609  	// - It may require correct/in-range values for request initialization.
   610  	// - It may require specifying regional endpoints when creating the service client as shown in:
   611  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   612  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   613  	if err != nil {
   614  		// TODO: Handle error.
   615  	}
   616  	defer c.Close()
   617  
   618  	req := &longrunningpb.ListOperationsRequest{
   619  		// TODO: Fill request struct fields.
   620  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
   621  	}
   622  	it := c.ListOperations(ctx, req)
   623  	for {
   624  		resp, err := it.Next()
   625  		if err == iterator.Done {
   626  			break
   627  		}
   628  		if err != nil {
   629  			// TODO: Handle error.
   630  		}
   631  		// TODO: Use resp.
   632  		_ = resp
   633  
   634  		// If you need to access the underlying RPC response,
   635  		// you can do so by casting the `Response` as below.
   636  		// Otherwise, remove this line. Only populated after
   637  		// first call to Next(). Not safe for concurrent access.
   638  		_ = it.Response.(*longrunningpb.ListOperationsResponse)
   639  	}
   640  }
   641  
   642  func ExampleVertexRagDataClient_WaitOperation() {
   643  	ctx := context.Background()
   644  	// This snippet has been automatically generated and should be regarded as a code template only.
   645  	// It will require modifications to work:
   646  	// - It may require correct/in-range values for request initialization.
   647  	// - It may require specifying regional endpoints when creating the service client as shown in:
   648  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   649  	c, err := aiplatform.NewVertexRagDataClient(ctx)
   650  	if err != nil {
   651  		// TODO: Handle error.
   652  	}
   653  	defer c.Close()
   654  
   655  	req := &longrunningpb.WaitOperationRequest{
   656  		// TODO: Fill request struct fields.
   657  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest.
   658  	}
   659  	resp, err := c.WaitOperation(ctx, req)
   660  	if err != nil {
   661  		// TODO: Handle error.
   662  	}
   663  	// TODO: Use resp.
   664  	_ = resp
   665  }