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