cloud.google.com/go/aiplatform@v1.106.0/apiv1beta1/dataset_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/apiv1beta1"
    23  	aiplatformpb "cloud.google.com/go/aiplatform/apiv1beta1/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 ExampleNewDatasetClient() {
    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.NewDatasetClient(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 ExampleNewDatasetRESTClient() {
    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.NewDatasetRESTClient(ctx)
    55  	if err != nil {
    56  		// TODO: Handle error.
    57  	}
    58  	defer c.Close()
    59  
    60  	// TODO: Use client.
    61  	_ = c
    62  }
    63  
    64  func ExampleDatasetClient_AssembleData() {
    65  	ctx := context.Background()
    66  	// This snippet has been automatically generated and should be regarded as a code template only.
    67  	// It will require modifications to work:
    68  	// - It may require correct/in-range values for request initialization.
    69  	// - It may require specifying regional endpoints when creating the service client as shown in:
    70  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
    71  	c, err := aiplatform.NewDatasetClient(ctx)
    72  	if err != nil {
    73  		// TODO: Handle error.
    74  	}
    75  	defer c.Close()
    76  
    77  	req := &aiplatformpb.AssembleDataRequest{
    78  		// TODO: Fill request struct fields.
    79  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#AssembleDataRequest.
    80  	}
    81  	op, err := c.AssembleData(ctx, req)
    82  	if err != nil {
    83  		// TODO: Handle error.
    84  	}
    85  
    86  	resp, err := op.Wait(ctx)
    87  	if err != nil {
    88  		// TODO: Handle error.
    89  	}
    90  	// TODO: Use resp.
    91  	_ = resp
    92  }
    93  
    94  func ExampleDatasetClient_AssessData() {
    95  	ctx := context.Background()
    96  	// This snippet has been automatically generated and should be regarded as a code template only.
    97  	// It will require modifications to work:
    98  	// - It may require correct/in-range values for request initialization.
    99  	// - It may require specifying regional endpoints when creating the service client as shown in:
   100  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   101  	c, err := aiplatform.NewDatasetClient(ctx)
   102  	if err != nil {
   103  		// TODO: Handle error.
   104  	}
   105  	defer c.Close()
   106  
   107  	req := &aiplatformpb.AssessDataRequest{
   108  		// TODO: Fill request struct fields.
   109  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#AssessDataRequest.
   110  	}
   111  	op, err := c.AssessData(ctx, req)
   112  	if err != nil {
   113  		// TODO: Handle error.
   114  	}
   115  
   116  	resp, err := op.Wait(ctx)
   117  	if err != nil {
   118  		// TODO: Handle error.
   119  	}
   120  	// TODO: Use resp.
   121  	_ = resp
   122  }
   123  
   124  func ExampleDatasetClient_CreateDataset() {
   125  	ctx := context.Background()
   126  	// This snippet has been automatically generated and should be regarded as a code template only.
   127  	// It will require modifications to work:
   128  	// - It may require correct/in-range values for request initialization.
   129  	// - It may require specifying regional endpoints when creating the service client as shown in:
   130  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   131  	c, err := aiplatform.NewDatasetClient(ctx)
   132  	if err != nil {
   133  		// TODO: Handle error.
   134  	}
   135  	defer c.Close()
   136  
   137  	req := &aiplatformpb.CreateDatasetRequest{
   138  		// TODO: Fill request struct fields.
   139  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateDatasetRequest.
   140  	}
   141  	op, err := c.CreateDataset(ctx, req)
   142  	if err != nil {
   143  		// TODO: Handle error.
   144  	}
   145  
   146  	resp, err := op.Wait(ctx)
   147  	if err != nil {
   148  		// TODO: Handle error.
   149  	}
   150  	// TODO: Use resp.
   151  	_ = resp
   152  }
   153  
   154  func ExampleDatasetClient_CreateDatasetVersion() {
   155  	ctx := context.Background()
   156  	// This snippet has been automatically generated and should be regarded as a code template only.
   157  	// It will require modifications to work:
   158  	// - It may require correct/in-range values for request initialization.
   159  	// - It may require specifying regional endpoints when creating the service client as shown in:
   160  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   161  	c, err := aiplatform.NewDatasetClient(ctx)
   162  	if err != nil {
   163  		// TODO: Handle error.
   164  	}
   165  	defer c.Close()
   166  
   167  	req := &aiplatformpb.CreateDatasetVersionRequest{
   168  		// TODO: Fill request struct fields.
   169  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateDatasetVersionRequest.
   170  	}
   171  	op, err := c.CreateDatasetVersion(ctx, req)
   172  	if err != nil {
   173  		// TODO: Handle error.
   174  	}
   175  
   176  	resp, err := op.Wait(ctx)
   177  	if err != nil {
   178  		// TODO: Handle error.
   179  	}
   180  	// TODO: Use resp.
   181  	_ = resp
   182  }
   183  
   184  func ExampleDatasetClient_DeleteDataset() {
   185  	ctx := context.Background()
   186  	// This snippet has been automatically generated and should be regarded as a code template only.
   187  	// It will require modifications to work:
   188  	// - It may require correct/in-range values for request initialization.
   189  	// - It may require specifying regional endpoints when creating the service client as shown in:
   190  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   191  	c, err := aiplatform.NewDatasetClient(ctx)
   192  	if err != nil {
   193  		// TODO: Handle error.
   194  	}
   195  	defer c.Close()
   196  
   197  	req := &aiplatformpb.DeleteDatasetRequest{
   198  		// TODO: Fill request struct fields.
   199  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#DeleteDatasetRequest.
   200  	}
   201  	op, err := c.DeleteDataset(ctx, req)
   202  	if err != nil {
   203  		// TODO: Handle error.
   204  	}
   205  
   206  	err = op.Wait(ctx)
   207  	if err != nil {
   208  		// TODO: Handle error.
   209  	}
   210  }
   211  
   212  func ExampleDatasetClient_DeleteDatasetVersion() {
   213  	ctx := context.Background()
   214  	// This snippet has been automatically generated and should be regarded as a code template only.
   215  	// It will require modifications to work:
   216  	// - It may require correct/in-range values for request initialization.
   217  	// - It may require specifying regional endpoints when creating the service client as shown in:
   218  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   219  	c, err := aiplatform.NewDatasetClient(ctx)
   220  	if err != nil {
   221  		// TODO: Handle error.
   222  	}
   223  	defer c.Close()
   224  
   225  	req := &aiplatformpb.DeleteDatasetVersionRequest{
   226  		// TODO: Fill request struct fields.
   227  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#DeleteDatasetVersionRequest.
   228  	}
   229  	op, err := c.DeleteDatasetVersion(ctx, req)
   230  	if err != nil {
   231  		// TODO: Handle error.
   232  	}
   233  
   234  	err = op.Wait(ctx)
   235  	if err != nil {
   236  		// TODO: Handle error.
   237  	}
   238  }
   239  
   240  func ExampleDatasetClient_DeleteSavedQuery() {
   241  	ctx := context.Background()
   242  	// This snippet has been automatically generated and should be regarded as a code template only.
   243  	// It will require modifications to work:
   244  	// - It may require correct/in-range values for request initialization.
   245  	// - It may require specifying regional endpoints when creating the service client as shown in:
   246  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   247  	c, err := aiplatform.NewDatasetClient(ctx)
   248  	if err != nil {
   249  		// TODO: Handle error.
   250  	}
   251  	defer c.Close()
   252  
   253  	req := &aiplatformpb.DeleteSavedQueryRequest{
   254  		// TODO: Fill request struct fields.
   255  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#DeleteSavedQueryRequest.
   256  	}
   257  	op, err := c.DeleteSavedQuery(ctx, req)
   258  	if err != nil {
   259  		// TODO: Handle error.
   260  	}
   261  
   262  	err = op.Wait(ctx)
   263  	if err != nil {
   264  		// TODO: Handle error.
   265  	}
   266  }
   267  
   268  func ExampleDatasetClient_ExportData() {
   269  	ctx := context.Background()
   270  	// This snippet has been automatically generated and should be regarded as a code template only.
   271  	// It will require modifications to work:
   272  	// - It may require correct/in-range values for request initialization.
   273  	// - It may require specifying regional endpoints when creating the service client as shown in:
   274  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   275  	c, err := aiplatform.NewDatasetClient(ctx)
   276  	if err != nil {
   277  		// TODO: Handle error.
   278  	}
   279  	defer c.Close()
   280  
   281  	req := &aiplatformpb.ExportDataRequest{
   282  		// TODO: Fill request struct fields.
   283  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ExportDataRequest.
   284  	}
   285  	op, err := c.ExportData(ctx, req)
   286  	if err != nil {
   287  		// TODO: Handle error.
   288  	}
   289  
   290  	resp, err := op.Wait(ctx)
   291  	if err != nil {
   292  		// TODO: Handle error.
   293  	}
   294  	// TODO: Use resp.
   295  	_ = resp
   296  }
   297  
   298  func ExampleDatasetClient_GetAnnotationSpec() {
   299  	ctx := context.Background()
   300  	// This snippet has been automatically generated and should be regarded as a code template only.
   301  	// It will require modifications to work:
   302  	// - It may require correct/in-range values for request initialization.
   303  	// - It may require specifying regional endpoints when creating the service client as shown in:
   304  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   305  	c, err := aiplatform.NewDatasetClient(ctx)
   306  	if err != nil {
   307  		// TODO: Handle error.
   308  	}
   309  	defer c.Close()
   310  
   311  	req := &aiplatformpb.GetAnnotationSpecRequest{
   312  		// TODO: Fill request struct fields.
   313  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetAnnotationSpecRequest.
   314  	}
   315  	resp, err := c.GetAnnotationSpec(ctx, req)
   316  	if err != nil {
   317  		// TODO: Handle error.
   318  	}
   319  	// TODO: Use resp.
   320  	_ = resp
   321  }
   322  
   323  func ExampleDatasetClient_GetDataset() {
   324  	ctx := context.Background()
   325  	// This snippet has been automatically generated and should be regarded as a code template only.
   326  	// It will require modifications to work:
   327  	// - It may require correct/in-range values for request initialization.
   328  	// - It may require specifying regional endpoints when creating the service client as shown in:
   329  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   330  	c, err := aiplatform.NewDatasetClient(ctx)
   331  	if err != nil {
   332  		// TODO: Handle error.
   333  	}
   334  	defer c.Close()
   335  
   336  	req := &aiplatformpb.GetDatasetRequest{
   337  		// TODO: Fill request struct fields.
   338  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetDatasetRequest.
   339  	}
   340  	resp, err := c.GetDataset(ctx, req)
   341  	if err != nil {
   342  		// TODO: Handle error.
   343  	}
   344  	// TODO: Use resp.
   345  	_ = resp
   346  }
   347  
   348  func ExampleDatasetClient_GetDatasetVersion() {
   349  	ctx := context.Background()
   350  	// This snippet has been automatically generated and should be regarded as a code template only.
   351  	// It will require modifications to work:
   352  	// - It may require correct/in-range values for request initialization.
   353  	// - It may require specifying regional endpoints when creating the service client as shown in:
   354  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   355  	c, err := aiplatform.NewDatasetClient(ctx)
   356  	if err != nil {
   357  		// TODO: Handle error.
   358  	}
   359  	defer c.Close()
   360  
   361  	req := &aiplatformpb.GetDatasetVersionRequest{
   362  		// TODO: Fill request struct fields.
   363  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetDatasetVersionRequest.
   364  	}
   365  	resp, err := c.GetDatasetVersion(ctx, req)
   366  	if err != nil {
   367  		// TODO: Handle error.
   368  	}
   369  	// TODO: Use resp.
   370  	_ = resp
   371  }
   372  
   373  func ExampleDatasetClient_ImportData() {
   374  	ctx := context.Background()
   375  	// This snippet has been automatically generated and should be regarded as a code template only.
   376  	// It will require modifications to work:
   377  	// - It may require correct/in-range values for request initialization.
   378  	// - It may require specifying regional endpoints when creating the service client as shown in:
   379  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   380  	c, err := aiplatform.NewDatasetClient(ctx)
   381  	if err != nil {
   382  		// TODO: Handle error.
   383  	}
   384  	defer c.Close()
   385  
   386  	req := &aiplatformpb.ImportDataRequest{
   387  		// TODO: Fill request struct fields.
   388  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ImportDataRequest.
   389  	}
   390  	op, err := c.ImportData(ctx, req)
   391  	if err != nil {
   392  		// TODO: Handle error.
   393  	}
   394  
   395  	resp, err := op.Wait(ctx)
   396  	if err != nil {
   397  		// TODO: Handle error.
   398  	}
   399  	// TODO: Use resp.
   400  	_ = resp
   401  }
   402  
   403  func ExampleDatasetClient_ListAnnotations() {
   404  	ctx := context.Background()
   405  	// This snippet has been automatically generated and should be regarded as a code template only.
   406  	// It will require modifications to work:
   407  	// - It may require correct/in-range values for request initialization.
   408  	// - It may require specifying regional endpoints when creating the service client as shown in:
   409  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   410  	c, err := aiplatform.NewDatasetClient(ctx)
   411  	if err != nil {
   412  		// TODO: Handle error.
   413  	}
   414  	defer c.Close()
   415  
   416  	req := &aiplatformpb.ListAnnotationsRequest{
   417  		// TODO: Fill request struct fields.
   418  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListAnnotationsRequest.
   419  	}
   420  	it := c.ListAnnotations(ctx, req)
   421  	for {
   422  		resp, err := it.Next()
   423  		if err == iterator.Done {
   424  			break
   425  		}
   426  		if err != nil {
   427  			// TODO: Handle error.
   428  		}
   429  		// TODO: Use resp.
   430  		_ = resp
   431  
   432  		// If you need to access the underlying RPC response,
   433  		// you can do so by casting the `Response` as below.
   434  		// Otherwise, remove this line. Only populated after
   435  		// first call to Next(). Not safe for concurrent access.
   436  		_ = it.Response.(*aiplatformpb.ListAnnotationsResponse)
   437  	}
   438  }
   439  
   440  func ExampleDatasetClient_ListDataItems() {
   441  	ctx := context.Background()
   442  	// This snippet has been automatically generated and should be regarded as a code template only.
   443  	// It will require modifications to work:
   444  	// - It may require correct/in-range values for request initialization.
   445  	// - It may require specifying regional endpoints when creating the service client as shown in:
   446  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   447  	c, err := aiplatform.NewDatasetClient(ctx)
   448  	if err != nil {
   449  		// TODO: Handle error.
   450  	}
   451  	defer c.Close()
   452  
   453  	req := &aiplatformpb.ListDataItemsRequest{
   454  		// TODO: Fill request struct fields.
   455  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListDataItemsRequest.
   456  	}
   457  	it := c.ListDataItems(ctx, req)
   458  	for {
   459  		resp, err := it.Next()
   460  		if err == iterator.Done {
   461  			break
   462  		}
   463  		if err != nil {
   464  			// TODO: Handle error.
   465  		}
   466  		// TODO: Use resp.
   467  		_ = resp
   468  
   469  		// If you need to access the underlying RPC response,
   470  		// you can do so by casting the `Response` as below.
   471  		// Otherwise, remove this line. Only populated after
   472  		// first call to Next(). Not safe for concurrent access.
   473  		_ = it.Response.(*aiplatformpb.ListDataItemsResponse)
   474  	}
   475  }
   476  
   477  func ExampleDatasetClient_ListDatasetVersions() {
   478  	ctx := context.Background()
   479  	// This snippet has been automatically generated and should be regarded as a code template only.
   480  	// It will require modifications to work:
   481  	// - It may require correct/in-range values for request initialization.
   482  	// - It may require specifying regional endpoints when creating the service client as shown in:
   483  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   484  	c, err := aiplatform.NewDatasetClient(ctx)
   485  	if err != nil {
   486  		// TODO: Handle error.
   487  	}
   488  	defer c.Close()
   489  
   490  	req := &aiplatformpb.ListDatasetVersionsRequest{
   491  		// TODO: Fill request struct fields.
   492  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListDatasetVersionsRequest.
   493  	}
   494  	it := c.ListDatasetVersions(ctx, req)
   495  	for {
   496  		resp, err := it.Next()
   497  		if err == iterator.Done {
   498  			break
   499  		}
   500  		if err != nil {
   501  			// TODO: Handle error.
   502  		}
   503  		// TODO: Use resp.
   504  		_ = resp
   505  
   506  		// If you need to access the underlying RPC response,
   507  		// you can do so by casting the `Response` as below.
   508  		// Otherwise, remove this line. Only populated after
   509  		// first call to Next(). Not safe for concurrent access.
   510  		_ = it.Response.(*aiplatformpb.ListDatasetVersionsResponse)
   511  	}
   512  }
   513  
   514  func ExampleDatasetClient_ListDatasets() {
   515  	ctx := context.Background()
   516  	// This snippet has been automatically generated and should be regarded as a code template only.
   517  	// It will require modifications to work:
   518  	// - It may require correct/in-range values for request initialization.
   519  	// - It may require specifying regional endpoints when creating the service client as shown in:
   520  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   521  	c, err := aiplatform.NewDatasetClient(ctx)
   522  	if err != nil {
   523  		// TODO: Handle error.
   524  	}
   525  	defer c.Close()
   526  
   527  	req := &aiplatformpb.ListDatasetsRequest{
   528  		// TODO: Fill request struct fields.
   529  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListDatasetsRequest.
   530  	}
   531  	it := c.ListDatasets(ctx, req)
   532  	for {
   533  		resp, err := it.Next()
   534  		if err == iterator.Done {
   535  			break
   536  		}
   537  		if err != nil {
   538  			// TODO: Handle error.
   539  		}
   540  		// TODO: Use resp.
   541  		_ = resp
   542  
   543  		// If you need to access the underlying RPC response,
   544  		// you can do so by casting the `Response` as below.
   545  		// Otherwise, remove this line. Only populated after
   546  		// first call to Next(). Not safe for concurrent access.
   547  		_ = it.Response.(*aiplatformpb.ListDatasetsResponse)
   548  	}
   549  }
   550  
   551  func ExampleDatasetClient_ListSavedQueries() {
   552  	ctx := context.Background()
   553  	// This snippet has been automatically generated and should be regarded as a code template only.
   554  	// It will require modifications to work:
   555  	// - It may require correct/in-range values for request initialization.
   556  	// - It may require specifying regional endpoints when creating the service client as shown in:
   557  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   558  	c, err := aiplatform.NewDatasetClient(ctx)
   559  	if err != nil {
   560  		// TODO: Handle error.
   561  	}
   562  	defer c.Close()
   563  
   564  	req := &aiplatformpb.ListSavedQueriesRequest{
   565  		// TODO: Fill request struct fields.
   566  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListSavedQueriesRequest.
   567  	}
   568  	it := c.ListSavedQueries(ctx, req)
   569  	for {
   570  		resp, err := it.Next()
   571  		if err == iterator.Done {
   572  			break
   573  		}
   574  		if err != nil {
   575  			// TODO: Handle error.
   576  		}
   577  		// TODO: Use resp.
   578  		_ = resp
   579  
   580  		// If you need to access the underlying RPC response,
   581  		// you can do so by casting the `Response` as below.
   582  		// Otherwise, remove this line. Only populated after
   583  		// first call to Next(). Not safe for concurrent access.
   584  		_ = it.Response.(*aiplatformpb.ListSavedQueriesResponse)
   585  	}
   586  }
   587  
   588  func ExampleDatasetClient_RestoreDatasetVersion() {
   589  	ctx := context.Background()
   590  	// This snippet has been automatically generated and should be regarded as a code template only.
   591  	// It will require modifications to work:
   592  	// - It may require correct/in-range values for request initialization.
   593  	// - It may require specifying regional endpoints when creating the service client as shown in:
   594  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   595  	c, err := aiplatform.NewDatasetClient(ctx)
   596  	if err != nil {
   597  		// TODO: Handle error.
   598  	}
   599  	defer c.Close()
   600  
   601  	req := &aiplatformpb.RestoreDatasetVersionRequest{
   602  		// TODO: Fill request struct fields.
   603  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#RestoreDatasetVersionRequest.
   604  	}
   605  	op, err := c.RestoreDatasetVersion(ctx, req)
   606  	if err != nil {
   607  		// TODO: Handle error.
   608  	}
   609  
   610  	resp, err := op.Wait(ctx)
   611  	if err != nil {
   612  		// TODO: Handle error.
   613  	}
   614  	// TODO: Use resp.
   615  	_ = resp
   616  }
   617  
   618  func ExampleDatasetClient_SearchDataItems() {
   619  	ctx := context.Background()
   620  	// This snippet has been automatically generated and should be regarded as a code template only.
   621  	// It will require modifications to work:
   622  	// - It may require correct/in-range values for request initialization.
   623  	// - It may require specifying regional endpoints when creating the service client as shown in:
   624  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   625  	c, err := aiplatform.NewDatasetClient(ctx)
   626  	if err != nil {
   627  		// TODO: Handle error.
   628  	}
   629  	defer c.Close()
   630  
   631  	req := &aiplatformpb.SearchDataItemsRequest{
   632  		// TODO: Fill request struct fields.
   633  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#SearchDataItemsRequest.
   634  	}
   635  	it := c.SearchDataItems(ctx, req)
   636  	for {
   637  		resp, err := it.Next()
   638  		if err == iterator.Done {
   639  			break
   640  		}
   641  		if err != nil {
   642  			// TODO: Handle error.
   643  		}
   644  		// TODO: Use resp.
   645  		_ = resp
   646  
   647  		// If you need to access the underlying RPC response,
   648  		// you can do so by casting the `Response` as below.
   649  		// Otherwise, remove this line. Only populated after
   650  		// first call to Next(). Not safe for concurrent access.
   651  		_ = it.Response.(*aiplatformpb.SearchDataItemsResponse)
   652  	}
   653  }
   654  
   655  func ExampleDatasetClient_UpdateDataset() {
   656  	ctx := context.Background()
   657  	// This snippet has been automatically generated and should be regarded as a code template only.
   658  	// It will require modifications to work:
   659  	// - It may require correct/in-range values for request initialization.
   660  	// - It may require specifying regional endpoints when creating the service client as shown in:
   661  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   662  	c, err := aiplatform.NewDatasetClient(ctx)
   663  	if err != nil {
   664  		// TODO: Handle error.
   665  	}
   666  	defer c.Close()
   667  
   668  	req := &aiplatformpb.UpdateDatasetRequest{
   669  		// TODO: Fill request struct fields.
   670  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#UpdateDatasetRequest.
   671  	}
   672  	resp, err := c.UpdateDataset(ctx, req)
   673  	if err != nil {
   674  		// TODO: Handle error.
   675  	}
   676  	// TODO: Use resp.
   677  	_ = resp
   678  }
   679  
   680  func ExampleDatasetClient_UpdateDatasetVersion() {
   681  	ctx := context.Background()
   682  	// This snippet has been automatically generated and should be regarded as a code template only.
   683  	// It will require modifications to work:
   684  	// - It may require correct/in-range values for request initialization.
   685  	// - It may require specifying regional endpoints when creating the service client as shown in:
   686  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   687  	c, err := aiplatform.NewDatasetClient(ctx)
   688  	if err != nil {
   689  		// TODO: Handle error.
   690  	}
   691  	defer c.Close()
   692  
   693  	req := &aiplatformpb.UpdateDatasetVersionRequest{
   694  		// TODO: Fill request struct fields.
   695  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#UpdateDatasetVersionRequest.
   696  	}
   697  	resp, err := c.UpdateDatasetVersion(ctx, req)
   698  	if err != nil {
   699  		// TODO: Handle error.
   700  	}
   701  	// TODO: Use resp.
   702  	_ = resp
   703  }
   704  
   705  func ExampleDatasetClient_GetLocation() {
   706  	ctx := context.Background()
   707  	// This snippet has been automatically generated and should be regarded as a code template only.
   708  	// It will require modifications to work:
   709  	// - It may require correct/in-range values for request initialization.
   710  	// - It may require specifying regional endpoints when creating the service client as shown in:
   711  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   712  	c, err := aiplatform.NewDatasetClient(ctx)
   713  	if err != nil {
   714  		// TODO: Handle error.
   715  	}
   716  	defer c.Close()
   717  
   718  	req := &locationpb.GetLocationRequest{
   719  		// TODO: Fill request struct fields.
   720  		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
   721  	}
   722  	resp, err := c.GetLocation(ctx, req)
   723  	if err != nil {
   724  		// TODO: Handle error.
   725  	}
   726  	// TODO: Use resp.
   727  	_ = resp
   728  }
   729  
   730  func ExampleDatasetClient_ListLocations() {
   731  	ctx := context.Background()
   732  	// This snippet has been automatically generated and should be regarded as a code template only.
   733  	// It will require modifications to work:
   734  	// - It may require correct/in-range values for request initialization.
   735  	// - It may require specifying regional endpoints when creating the service client as shown in:
   736  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   737  	c, err := aiplatform.NewDatasetClient(ctx)
   738  	if err != nil {
   739  		// TODO: Handle error.
   740  	}
   741  	defer c.Close()
   742  
   743  	req := &locationpb.ListLocationsRequest{
   744  		// TODO: Fill request struct fields.
   745  		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
   746  	}
   747  	it := c.ListLocations(ctx, req)
   748  	for {
   749  		resp, err := it.Next()
   750  		if err == iterator.Done {
   751  			break
   752  		}
   753  		if err != nil {
   754  			// TODO: Handle error.
   755  		}
   756  		// TODO: Use resp.
   757  		_ = resp
   758  
   759  		// If you need to access the underlying RPC response,
   760  		// you can do so by casting the `Response` as below.
   761  		// Otherwise, remove this line. Only populated after
   762  		// first call to Next(). Not safe for concurrent access.
   763  		_ = it.Response.(*locationpb.ListLocationsResponse)
   764  	}
   765  }
   766  
   767  func ExampleDatasetClient_GetIamPolicy() {
   768  	ctx := context.Background()
   769  	// This snippet has been automatically generated and should be regarded as a code template only.
   770  	// It will require modifications to work:
   771  	// - It may require correct/in-range values for request initialization.
   772  	// - It may require specifying regional endpoints when creating the service client as shown in:
   773  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   774  	c, err := aiplatform.NewDatasetClient(ctx)
   775  	if err != nil {
   776  		// TODO: Handle error.
   777  	}
   778  	defer c.Close()
   779  
   780  	req := &iampb.GetIamPolicyRequest{
   781  		// TODO: Fill request struct fields.
   782  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
   783  	}
   784  	resp, err := c.GetIamPolicy(ctx, req)
   785  	if err != nil {
   786  		// TODO: Handle error.
   787  	}
   788  	// TODO: Use resp.
   789  	_ = resp
   790  }
   791  
   792  func ExampleDatasetClient_SetIamPolicy() {
   793  	ctx := context.Background()
   794  	// This snippet has been automatically generated and should be regarded as a code template only.
   795  	// It will require modifications to work:
   796  	// - It may require correct/in-range values for request initialization.
   797  	// - It may require specifying regional endpoints when creating the service client as shown in:
   798  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   799  	c, err := aiplatform.NewDatasetClient(ctx)
   800  	if err != nil {
   801  		// TODO: Handle error.
   802  	}
   803  	defer c.Close()
   804  
   805  	req := &iampb.SetIamPolicyRequest{
   806  		// TODO: Fill request struct fields.
   807  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
   808  	}
   809  	resp, err := c.SetIamPolicy(ctx, req)
   810  	if err != nil {
   811  		// TODO: Handle error.
   812  	}
   813  	// TODO: Use resp.
   814  	_ = resp
   815  }
   816  
   817  func ExampleDatasetClient_TestIamPermissions() {
   818  	ctx := context.Background()
   819  	// This snippet has been automatically generated and should be regarded as a code template only.
   820  	// It will require modifications to work:
   821  	// - It may require correct/in-range values for request initialization.
   822  	// - It may require specifying regional endpoints when creating the service client as shown in:
   823  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   824  	c, err := aiplatform.NewDatasetClient(ctx)
   825  	if err != nil {
   826  		// TODO: Handle error.
   827  	}
   828  	defer c.Close()
   829  
   830  	req := &iampb.TestIamPermissionsRequest{
   831  		// TODO: Fill request struct fields.
   832  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
   833  	}
   834  	resp, err := c.TestIamPermissions(ctx, req)
   835  	if err != nil {
   836  		// TODO: Handle error.
   837  	}
   838  	// TODO: Use resp.
   839  	_ = resp
   840  }
   841  
   842  func ExampleDatasetClient_CancelOperation() {
   843  	ctx := context.Background()
   844  	// This snippet has been automatically generated and should be regarded as a code template only.
   845  	// It will require modifications to work:
   846  	// - It may require correct/in-range values for request initialization.
   847  	// - It may require specifying regional endpoints when creating the service client as shown in:
   848  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   849  	c, err := aiplatform.NewDatasetClient(ctx)
   850  	if err != nil {
   851  		// TODO: Handle error.
   852  	}
   853  	defer c.Close()
   854  
   855  	req := &longrunningpb.CancelOperationRequest{
   856  		// TODO: Fill request struct fields.
   857  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
   858  	}
   859  	err = c.CancelOperation(ctx, req)
   860  	if err != nil {
   861  		// TODO: Handle error.
   862  	}
   863  }
   864  
   865  func ExampleDatasetClient_DeleteOperation() {
   866  	ctx := context.Background()
   867  	// This snippet has been automatically generated and should be regarded as a code template only.
   868  	// It will require modifications to work:
   869  	// - It may require correct/in-range values for request initialization.
   870  	// - It may require specifying regional endpoints when creating the service client as shown in:
   871  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   872  	c, err := aiplatform.NewDatasetClient(ctx)
   873  	if err != nil {
   874  		// TODO: Handle error.
   875  	}
   876  	defer c.Close()
   877  
   878  	req := &longrunningpb.DeleteOperationRequest{
   879  		// TODO: Fill request struct fields.
   880  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
   881  	}
   882  	err = c.DeleteOperation(ctx, req)
   883  	if err != nil {
   884  		// TODO: Handle error.
   885  	}
   886  }
   887  
   888  func ExampleDatasetClient_GetOperation() {
   889  	ctx := context.Background()
   890  	// This snippet has been automatically generated and should be regarded as a code template only.
   891  	// It will require modifications to work:
   892  	// - It may require correct/in-range values for request initialization.
   893  	// - It may require specifying regional endpoints when creating the service client as shown in:
   894  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   895  	c, err := aiplatform.NewDatasetClient(ctx)
   896  	if err != nil {
   897  		// TODO: Handle error.
   898  	}
   899  	defer c.Close()
   900  
   901  	req := &longrunningpb.GetOperationRequest{
   902  		// TODO: Fill request struct fields.
   903  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
   904  	}
   905  	resp, err := c.GetOperation(ctx, req)
   906  	if err != nil {
   907  		// TODO: Handle error.
   908  	}
   909  	// TODO: Use resp.
   910  	_ = resp
   911  }
   912  
   913  func ExampleDatasetClient_ListOperations() {
   914  	ctx := context.Background()
   915  	// This snippet has been automatically generated and should be regarded as a code template only.
   916  	// It will require modifications to work:
   917  	// - It may require correct/in-range values for request initialization.
   918  	// - It may require specifying regional endpoints when creating the service client as shown in:
   919  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   920  	c, err := aiplatform.NewDatasetClient(ctx)
   921  	if err != nil {
   922  		// TODO: Handle error.
   923  	}
   924  	defer c.Close()
   925  
   926  	req := &longrunningpb.ListOperationsRequest{
   927  		// TODO: Fill request struct fields.
   928  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
   929  	}
   930  	it := c.ListOperations(ctx, req)
   931  	for {
   932  		resp, err := it.Next()
   933  		if err == iterator.Done {
   934  			break
   935  		}
   936  		if err != nil {
   937  			// TODO: Handle error.
   938  		}
   939  		// TODO: Use resp.
   940  		_ = resp
   941  
   942  		// If you need to access the underlying RPC response,
   943  		// you can do so by casting the `Response` as below.
   944  		// Otherwise, remove this line. Only populated after
   945  		// first call to Next(). Not safe for concurrent access.
   946  		_ = it.Response.(*longrunningpb.ListOperationsResponse)
   947  	}
   948  }
   949  
   950  func ExampleDatasetClient_WaitOperation() {
   951  	ctx := context.Background()
   952  	// This snippet has been automatically generated and should be regarded as a code template only.
   953  	// It will require modifications to work:
   954  	// - It may require correct/in-range values for request initialization.
   955  	// - It may require specifying regional endpoints when creating the service client as shown in:
   956  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   957  	c, err := aiplatform.NewDatasetClient(ctx)
   958  	if err != nil {
   959  		// TODO: Handle error.
   960  	}
   961  	defer c.Close()
   962  
   963  	req := &longrunningpb.WaitOperationRequest{
   964  		// TODO: Fill request struct fields.
   965  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest.
   966  	}
   967  	resp, err := c.WaitOperation(ctx, req)
   968  	if err != nil {
   969  		// TODO: Handle error.
   970  	}
   971  	// TODO: Use resp.
   972  	_ = resp
   973  }