cloud.google.com/go/aiplatform@v1.106.0/apiv1/vizier_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 ExampleNewVizierClient() {
    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.NewVizierClient(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 ExampleVizierClient_AddTrialMeasurement() {
    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.NewVizierClient(ctx)
    55  	if err != nil {
    56  		// TODO: Handle error.
    57  	}
    58  	defer c.Close()
    59  
    60  	req := &aiplatformpb.AddTrialMeasurementRequest{
    61  		// TODO: Fill request struct fields.
    62  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#AddTrialMeasurementRequest.
    63  	}
    64  	resp, err := c.AddTrialMeasurement(ctx, req)
    65  	if err != nil {
    66  		// TODO: Handle error.
    67  	}
    68  	// TODO: Use resp.
    69  	_ = resp
    70  }
    71  
    72  func ExampleVizierClient_CheckTrialEarlyStoppingState() {
    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.NewVizierClient(ctx)
    80  	if err != nil {
    81  		// TODO: Handle error.
    82  	}
    83  	defer c.Close()
    84  
    85  	req := &aiplatformpb.CheckTrialEarlyStoppingStateRequest{
    86  		// TODO: Fill request struct fields.
    87  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CheckTrialEarlyStoppingStateRequest.
    88  	}
    89  	op, err := c.CheckTrialEarlyStoppingState(ctx, req)
    90  	if err != nil {
    91  		// TODO: Handle error.
    92  	}
    93  
    94  	resp, err := op.Wait(ctx)
    95  	if err != nil {
    96  		// TODO: Handle error.
    97  	}
    98  	// TODO: Use resp.
    99  	_ = resp
   100  }
   101  
   102  func ExampleVizierClient_CompleteTrial() {
   103  	ctx := context.Background()
   104  	// This snippet has been automatically generated and should be regarded as a code template only.
   105  	// It will require modifications to work:
   106  	// - It may require correct/in-range values for request initialization.
   107  	// - It may require specifying regional endpoints when creating the service client as shown in:
   108  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   109  	c, err := aiplatform.NewVizierClient(ctx)
   110  	if err != nil {
   111  		// TODO: Handle error.
   112  	}
   113  	defer c.Close()
   114  
   115  	req := &aiplatformpb.CompleteTrialRequest{
   116  		// TODO: Fill request struct fields.
   117  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CompleteTrialRequest.
   118  	}
   119  	resp, err := c.CompleteTrial(ctx, req)
   120  	if err != nil {
   121  		// TODO: Handle error.
   122  	}
   123  	// TODO: Use resp.
   124  	_ = resp
   125  }
   126  
   127  func ExampleVizierClient_CreateStudy() {
   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.NewVizierClient(ctx)
   135  	if err != nil {
   136  		// TODO: Handle error.
   137  	}
   138  	defer c.Close()
   139  
   140  	req := &aiplatformpb.CreateStudyRequest{
   141  		// TODO: Fill request struct fields.
   142  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateStudyRequest.
   143  	}
   144  	resp, err := c.CreateStudy(ctx, req)
   145  	if err != nil {
   146  		// TODO: Handle error.
   147  	}
   148  	// TODO: Use resp.
   149  	_ = resp
   150  }
   151  
   152  func ExampleVizierClient_CreateTrial() {
   153  	ctx := context.Background()
   154  	// This snippet has been automatically generated and should be regarded as a code template only.
   155  	// It will require modifications to work:
   156  	// - It may require correct/in-range values for request initialization.
   157  	// - It may require specifying regional endpoints when creating the service client as shown in:
   158  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   159  	c, err := aiplatform.NewVizierClient(ctx)
   160  	if err != nil {
   161  		// TODO: Handle error.
   162  	}
   163  	defer c.Close()
   164  
   165  	req := &aiplatformpb.CreateTrialRequest{
   166  		// TODO: Fill request struct fields.
   167  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateTrialRequest.
   168  	}
   169  	resp, err := c.CreateTrial(ctx, req)
   170  	if err != nil {
   171  		// TODO: Handle error.
   172  	}
   173  	// TODO: Use resp.
   174  	_ = resp
   175  }
   176  
   177  func ExampleVizierClient_DeleteStudy() {
   178  	ctx := context.Background()
   179  	// This snippet has been automatically generated and should be regarded as a code template only.
   180  	// It will require modifications to work:
   181  	// - It may require correct/in-range values for request initialization.
   182  	// - It may require specifying regional endpoints when creating the service client as shown in:
   183  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   184  	c, err := aiplatform.NewVizierClient(ctx)
   185  	if err != nil {
   186  		// TODO: Handle error.
   187  	}
   188  	defer c.Close()
   189  
   190  	req := &aiplatformpb.DeleteStudyRequest{
   191  		// TODO: Fill request struct fields.
   192  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteStudyRequest.
   193  	}
   194  	err = c.DeleteStudy(ctx, req)
   195  	if err != nil {
   196  		// TODO: Handle error.
   197  	}
   198  }
   199  
   200  func ExampleVizierClient_DeleteTrial() {
   201  	ctx := context.Background()
   202  	// This snippet has been automatically generated and should be regarded as a code template only.
   203  	// It will require modifications to work:
   204  	// - It may require correct/in-range values for request initialization.
   205  	// - It may require specifying regional endpoints when creating the service client as shown in:
   206  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   207  	c, err := aiplatform.NewVizierClient(ctx)
   208  	if err != nil {
   209  		// TODO: Handle error.
   210  	}
   211  	defer c.Close()
   212  
   213  	req := &aiplatformpb.DeleteTrialRequest{
   214  		// TODO: Fill request struct fields.
   215  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteTrialRequest.
   216  	}
   217  	err = c.DeleteTrial(ctx, req)
   218  	if err != nil {
   219  		// TODO: Handle error.
   220  	}
   221  }
   222  
   223  func ExampleVizierClient_GetStudy() {
   224  	ctx := context.Background()
   225  	// This snippet has been automatically generated and should be regarded as a code template only.
   226  	// It will require modifications to work:
   227  	// - It may require correct/in-range values for request initialization.
   228  	// - It may require specifying regional endpoints when creating the service client as shown in:
   229  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   230  	c, err := aiplatform.NewVizierClient(ctx)
   231  	if err != nil {
   232  		// TODO: Handle error.
   233  	}
   234  	defer c.Close()
   235  
   236  	req := &aiplatformpb.GetStudyRequest{
   237  		// TODO: Fill request struct fields.
   238  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetStudyRequest.
   239  	}
   240  	resp, err := c.GetStudy(ctx, req)
   241  	if err != nil {
   242  		// TODO: Handle error.
   243  	}
   244  	// TODO: Use resp.
   245  	_ = resp
   246  }
   247  
   248  func ExampleVizierClient_GetTrial() {
   249  	ctx := context.Background()
   250  	// This snippet has been automatically generated and should be regarded as a code template only.
   251  	// It will require modifications to work:
   252  	// - It may require correct/in-range values for request initialization.
   253  	// - It may require specifying regional endpoints when creating the service client as shown in:
   254  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   255  	c, err := aiplatform.NewVizierClient(ctx)
   256  	if err != nil {
   257  		// TODO: Handle error.
   258  	}
   259  	defer c.Close()
   260  
   261  	req := &aiplatformpb.GetTrialRequest{
   262  		// TODO: Fill request struct fields.
   263  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetTrialRequest.
   264  	}
   265  	resp, err := c.GetTrial(ctx, req)
   266  	if err != nil {
   267  		// TODO: Handle error.
   268  	}
   269  	// TODO: Use resp.
   270  	_ = resp
   271  }
   272  
   273  func ExampleVizierClient_ListOptimalTrials() {
   274  	ctx := context.Background()
   275  	// This snippet has been automatically generated and should be regarded as a code template only.
   276  	// It will require modifications to work:
   277  	// - It may require correct/in-range values for request initialization.
   278  	// - It may require specifying regional endpoints when creating the service client as shown in:
   279  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   280  	c, err := aiplatform.NewVizierClient(ctx)
   281  	if err != nil {
   282  		// TODO: Handle error.
   283  	}
   284  	defer c.Close()
   285  
   286  	req := &aiplatformpb.ListOptimalTrialsRequest{
   287  		// TODO: Fill request struct fields.
   288  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListOptimalTrialsRequest.
   289  	}
   290  	resp, err := c.ListOptimalTrials(ctx, req)
   291  	if err != nil {
   292  		// TODO: Handle error.
   293  	}
   294  	// TODO: Use resp.
   295  	_ = resp
   296  }
   297  
   298  func ExampleVizierClient_ListStudies() {
   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.NewVizierClient(ctx)
   306  	if err != nil {
   307  		// TODO: Handle error.
   308  	}
   309  	defer c.Close()
   310  
   311  	req := &aiplatformpb.ListStudiesRequest{
   312  		// TODO: Fill request struct fields.
   313  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListStudiesRequest.
   314  	}
   315  	it := c.ListStudies(ctx, req)
   316  	for {
   317  		resp, err := it.Next()
   318  		if err == iterator.Done {
   319  			break
   320  		}
   321  		if err != nil {
   322  			// TODO: Handle error.
   323  		}
   324  		// TODO: Use resp.
   325  		_ = resp
   326  
   327  		// If you need to access the underlying RPC response,
   328  		// you can do so by casting the `Response` as below.
   329  		// Otherwise, remove this line. Only populated after
   330  		// first call to Next(). Not safe for concurrent access.
   331  		_ = it.Response.(*aiplatformpb.ListStudiesResponse)
   332  	}
   333  }
   334  
   335  func ExampleVizierClient_ListTrials() {
   336  	ctx := context.Background()
   337  	// This snippet has been automatically generated and should be regarded as a code template only.
   338  	// It will require modifications to work:
   339  	// - It may require correct/in-range values for request initialization.
   340  	// - It may require specifying regional endpoints when creating the service client as shown in:
   341  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   342  	c, err := aiplatform.NewVizierClient(ctx)
   343  	if err != nil {
   344  		// TODO: Handle error.
   345  	}
   346  	defer c.Close()
   347  
   348  	req := &aiplatformpb.ListTrialsRequest{
   349  		// TODO: Fill request struct fields.
   350  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListTrialsRequest.
   351  	}
   352  	it := c.ListTrials(ctx, req)
   353  	for {
   354  		resp, err := it.Next()
   355  		if err == iterator.Done {
   356  			break
   357  		}
   358  		if err != nil {
   359  			// TODO: Handle error.
   360  		}
   361  		// TODO: Use resp.
   362  		_ = resp
   363  
   364  		// If you need to access the underlying RPC response,
   365  		// you can do so by casting the `Response` as below.
   366  		// Otherwise, remove this line. Only populated after
   367  		// first call to Next(). Not safe for concurrent access.
   368  		_ = it.Response.(*aiplatformpb.ListTrialsResponse)
   369  	}
   370  }
   371  
   372  func ExampleVizierClient_LookupStudy() {
   373  	ctx := context.Background()
   374  	// This snippet has been automatically generated and should be regarded as a code template only.
   375  	// It will require modifications to work:
   376  	// - It may require correct/in-range values for request initialization.
   377  	// - It may require specifying regional endpoints when creating the service client as shown in:
   378  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   379  	c, err := aiplatform.NewVizierClient(ctx)
   380  	if err != nil {
   381  		// TODO: Handle error.
   382  	}
   383  	defer c.Close()
   384  
   385  	req := &aiplatformpb.LookupStudyRequest{
   386  		// TODO: Fill request struct fields.
   387  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#LookupStudyRequest.
   388  	}
   389  	resp, err := c.LookupStudy(ctx, req)
   390  	if err != nil {
   391  		// TODO: Handle error.
   392  	}
   393  	// TODO: Use resp.
   394  	_ = resp
   395  }
   396  
   397  func ExampleVizierClient_StopTrial() {
   398  	ctx := context.Background()
   399  	// This snippet has been automatically generated and should be regarded as a code template only.
   400  	// It will require modifications to work:
   401  	// - It may require correct/in-range values for request initialization.
   402  	// - It may require specifying regional endpoints when creating the service client as shown in:
   403  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   404  	c, err := aiplatform.NewVizierClient(ctx)
   405  	if err != nil {
   406  		// TODO: Handle error.
   407  	}
   408  	defer c.Close()
   409  
   410  	req := &aiplatformpb.StopTrialRequest{
   411  		// TODO: Fill request struct fields.
   412  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#StopTrialRequest.
   413  	}
   414  	resp, err := c.StopTrial(ctx, req)
   415  	if err != nil {
   416  		// TODO: Handle error.
   417  	}
   418  	// TODO: Use resp.
   419  	_ = resp
   420  }
   421  
   422  func ExampleVizierClient_SuggestTrials() {
   423  	ctx := context.Background()
   424  	// This snippet has been automatically generated and should be regarded as a code template only.
   425  	// It will require modifications to work:
   426  	// - It may require correct/in-range values for request initialization.
   427  	// - It may require specifying regional endpoints when creating the service client as shown in:
   428  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   429  	c, err := aiplatform.NewVizierClient(ctx)
   430  	if err != nil {
   431  		// TODO: Handle error.
   432  	}
   433  	defer c.Close()
   434  
   435  	req := &aiplatformpb.SuggestTrialsRequest{
   436  		// TODO: Fill request struct fields.
   437  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#SuggestTrialsRequest.
   438  	}
   439  	op, err := c.SuggestTrials(ctx, req)
   440  	if err != nil {
   441  		// TODO: Handle error.
   442  	}
   443  
   444  	resp, err := op.Wait(ctx)
   445  	if err != nil {
   446  		// TODO: Handle error.
   447  	}
   448  	// TODO: Use resp.
   449  	_ = resp
   450  }
   451  
   452  func ExampleVizierClient_GetLocation() {
   453  	ctx := context.Background()
   454  	// This snippet has been automatically generated and should be regarded as a code template only.
   455  	// It will require modifications to work:
   456  	// - It may require correct/in-range values for request initialization.
   457  	// - It may require specifying regional endpoints when creating the service client as shown in:
   458  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   459  	c, err := aiplatform.NewVizierClient(ctx)
   460  	if err != nil {
   461  		// TODO: Handle error.
   462  	}
   463  	defer c.Close()
   464  
   465  	req := &locationpb.GetLocationRequest{
   466  		// TODO: Fill request struct fields.
   467  		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
   468  	}
   469  	resp, err := c.GetLocation(ctx, req)
   470  	if err != nil {
   471  		// TODO: Handle error.
   472  	}
   473  	// TODO: Use resp.
   474  	_ = resp
   475  }
   476  
   477  func ExampleVizierClient_ListLocations() {
   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.NewVizierClient(ctx)
   485  	if err != nil {
   486  		// TODO: Handle error.
   487  	}
   488  	defer c.Close()
   489  
   490  	req := &locationpb.ListLocationsRequest{
   491  		// TODO: Fill request struct fields.
   492  		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
   493  	}
   494  	it := c.ListLocations(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.(*locationpb.ListLocationsResponse)
   511  	}
   512  }
   513  
   514  func ExampleVizierClient_GetIamPolicy() {
   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.NewVizierClient(ctx)
   522  	if err != nil {
   523  		// TODO: Handle error.
   524  	}
   525  	defer c.Close()
   526  
   527  	req := &iampb.GetIamPolicyRequest{
   528  		// TODO: Fill request struct fields.
   529  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
   530  	}
   531  	resp, err := c.GetIamPolicy(ctx, req)
   532  	if err != nil {
   533  		// TODO: Handle error.
   534  	}
   535  	// TODO: Use resp.
   536  	_ = resp
   537  }
   538  
   539  func ExampleVizierClient_SetIamPolicy() {
   540  	ctx := context.Background()
   541  	// This snippet has been automatically generated and should be regarded as a code template only.
   542  	// It will require modifications to work:
   543  	// - It may require correct/in-range values for request initialization.
   544  	// - It may require specifying regional endpoints when creating the service client as shown in:
   545  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   546  	c, err := aiplatform.NewVizierClient(ctx)
   547  	if err != nil {
   548  		// TODO: Handle error.
   549  	}
   550  	defer c.Close()
   551  
   552  	req := &iampb.SetIamPolicyRequest{
   553  		// TODO: Fill request struct fields.
   554  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
   555  	}
   556  	resp, err := c.SetIamPolicy(ctx, req)
   557  	if err != nil {
   558  		// TODO: Handle error.
   559  	}
   560  	// TODO: Use resp.
   561  	_ = resp
   562  }
   563  
   564  func ExampleVizierClient_TestIamPermissions() {
   565  	ctx := context.Background()
   566  	// This snippet has been automatically generated and should be regarded as a code template only.
   567  	// It will require modifications to work:
   568  	// - It may require correct/in-range values for request initialization.
   569  	// - It may require specifying regional endpoints when creating the service client as shown in:
   570  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   571  	c, err := aiplatform.NewVizierClient(ctx)
   572  	if err != nil {
   573  		// TODO: Handle error.
   574  	}
   575  	defer c.Close()
   576  
   577  	req := &iampb.TestIamPermissionsRequest{
   578  		// TODO: Fill request struct fields.
   579  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
   580  	}
   581  	resp, err := c.TestIamPermissions(ctx, req)
   582  	if err != nil {
   583  		// TODO: Handle error.
   584  	}
   585  	// TODO: Use resp.
   586  	_ = resp
   587  }
   588  
   589  func ExampleVizierClient_CancelOperation() {
   590  	ctx := context.Background()
   591  	// This snippet has been automatically generated and should be regarded as a code template only.
   592  	// It will require modifications to work:
   593  	// - It may require correct/in-range values for request initialization.
   594  	// - It may require specifying regional endpoints when creating the service client as shown in:
   595  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   596  	c, err := aiplatform.NewVizierClient(ctx)
   597  	if err != nil {
   598  		// TODO: Handle error.
   599  	}
   600  	defer c.Close()
   601  
   602  	req := &longrunningpb.CancelOperationRequest{
   603  		// TODO: Fill request struct fields.
   604  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
   605  	}
   606  	err = c.CancelOperation(ctx, req)
   607  	if err != nil {
   608  		// TODO: Handle error.
   609  	}
   610  }
   611  
   612  func ExampleVizierClient_DeleteOperation() {
   613  	ctx := context.Background()
   614  	// This snippet has been automatically generated and should be regarded as a code template only.
   615  	// It will require modifications to work:
   616  	// - It may require correct/in-range values for request initialization.
   617  	// - It may require specifying regional endpoints when creating the service client as shown in:
   618  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   619  	c, err := aiplatform.NewVizierClient(ctx)
   620  	if err != nil {
   621  		// TODO: Handle error.
   622  	}
   623  	defer c.Close()
   624  
   625  	req := &longrunningpb.DeleteOperationRequest{
   626  		// TODO: Fill request struct fields.
   627  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
   628  	}
   629  	err = c.DeleteOperation(ctx, req)
   630  	if err != nil {
   631  		// TODO: Handle error.
   632  	}
   633  }
   634  
   635  func ExampleVizierClient_GetOperation() {
   636  	ctx := context.Background()
   637  	// This snippet has been automatically generated and should be regarded as a code template only.
   638  	// It will require modifications to work:
   639  	// - It may require correct/in-range values for request initialization.
   640  	// - It may require specifying regional endpoints when creating the service client as shown in:
   641  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   642  	c, err := aiplatform.NewVizierClient(ctx)
   643  	if err != nil {
   644  		// TODO: Handle error.
   645  	}
   646  	defer c.Close()
   647  
   648  	req := &longrunningpb.GetOperationRequest{
   649  		// TODO: Fill request struct fields.
   650  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
   651  	}
   652  	resp, err := c.GetOperation(ctx, req)
   653  	if err != nil {
   654  		// TODO: Handle error.
   655  	}
   656  	// TODO: Use resp.
   657  	_ = resp
   658  }
   659  
   660  func ExampleVizierClient_ListOperations() {
   661  	ctx := context.Background()
   662  	// This snippet has been automatically generated and should be regarded as a code template only.
   663  	// It will require modifications to work:
   664  	// - It may require correct/in-range values for request initialization.
   665  	// - It may require specifying regional endpoints when creating the service client as shown in:
   666  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   667  	c, err := aiplatform.NewVizierClient(ctx)
   668  	if err != nil {
   669  		// TODO: Handle error.
   670  	}
   671  	defer c.Close()
   672  
   673  	req := &longrunningpb.ListOperationsRequest{
   674  		// TODO: Fill request struct fields.
   675  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
   676  	}
   677  	it := c.ListOperations(ctx, req)
   678  	for {
   679  		resp, err := it.Next()
   680  		if err == iterator.Done {
   681  			break
   682  		}
   683  		if err != nil {
   684  			// TODO: Handle error.
   685  		}
   686  		// TODO: Use resp.
   687  		_ = resp
   688  
   689  		// If you need to access the underlying RPC response,
   690  		// you can do so by casting the `Response` as below.
   691  		// Otherwise, remove this line. Only populated after
   692  		// first call to Next(). Not safe for concurrent access.
   693  		_ = it.Response.(*longrunningpb.ListOperationsResponse)
   694  	}
   695  }
   696  
   697  func ExampleVizierClient_WaitOperation() {
   698  	ctx := context.Background()
   699  	// This snippet has been automatically generated and should be regarded as a code template only.
   700  	// It will require modifications to work:
   701  	// - It may require correct/in-range values for request initialization.
   702  	// - It may require specifying regional endpoints when creating the service client as shown in:
   703  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   704  	c, err := aiplatform.NewVizierClient(ctx)
   705  	if err != nil {
   706  		// TODO: Handle error.
   707  	}
   708  	defer c.Close()
   709  
   710  	req := &longrunningpb.WaitOperationRequest{
   711  		// TODO: Fill request struct fields.
   712  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest.
   713  	}
   714  	resp, err := c.WaitOperation(ctx, req)
   715  	if err != nil {
   716  		// TODO: Handle error.
   717  	}
   718  	// TODO: Use resp.
   719  	_ = resp
   720  }