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