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