cloud.google.com/go/aiplatform@v1.106.0/apiv1beta1/model_monitoring_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 ExampleNewModelMonitoringClient() {
    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.NewModelMonitoringClient(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 ExampleNewModelMonitoringRESTClient() {
    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.NewModelMonitoringRESTClient(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 ExampleModelMonitoringClient_CreateModelMonitor() {
    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.NewModelMonitoringClient(ctx)
    72  	if err != nil {
    73  		// TODO: Handle error.
    74  	}
    75  	defer c.Close()
    76  
    77  	req := &aiplatformpb.CreateModelMonitorRequest{
    78  		// TODO: Fill request struct fields.
    79  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateModelMonitorRequest.
    80  	}
    81  	op, err := c.CreateModelMonitor(ctx, req)
    82  	if err != nil {
    83  		// TODO: Handle error.
    84  	}
    85  
    86  	resp, err := op.Wait(ctx)
    87  	if err != nil {
    88  		// TODO: Handle error.
    89  	}
    90  	// TODO: Use resp.
    91  	_ = resp
    92  }
    93  
    94  func ExampleModelMonitoringClient_CreateModelMonitoringJob() {
    95  	ctx := context.Background()
    96  	// This snippet has been automatically generated and should be regarded as a code template only.
    97  	// It will require modifications to work:
    98  	// - It may require correct/in-range values for request initialization.
    99  	// - It may require specifying regional endpoints when creating the service client as shown in:
   100  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   101  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   102  	if err != nil {
   103  		// TODO: Handle error.
   104  	}
   105  	defer c.Close()
   106  
   107  	req := &aiplatformpb.CreateModelMonitoringJobRequest{
   108  		// TODO: Fill request struct fields.
   109  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#CreateModelMonitoringJobRequest.
   110  	}
   111  	resp, err := c.CreateModelMonitoringJob(ctx, req)
   112  	if err != nil {
   113  		// TODO: Handle error.
   114  	}
   115  	// TODO: Use resp.
   116  	_ = resp
   117  }
   118  
   119  func ExampleModelMonitoringClient_DeleteModelMonitor() {
   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.NewModelMonitoringClient(ctx)
   127  	if err != nil {
   128  		// TODO: Handle error.
   129  	}
   130  	defer c.Close()
   131  
   132  	req := &aiplatformpb.DeleteModelMonitorRequest{
   133  		// TODO: Fill request struct fields.
   134  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#DeleteModelMonitorRequest.
   135  	}
   136  	op, err := c.DeleteModelMonitor(ctx, req)
   137  	if err != nil {
   138  		// TODO: Handle error.
   139  	}
   140  
   141  	err = op.Wait(ctx)
   142  	if err != nil {
   143  		// TODO: Handle error.
   144  	}
   145  }
   146  
   147  func ExampleModelMonitoringClient_DeleteModelMonitoringJob() {
   148  	ctx := context.Background()
   149  	// This snippet has been automatically generated and should be regarded as a code template only.
   150  	// It will require modifications to work:
   151  	// - It may require correct/in-range values for request initialization.
   152  	// - It may require specifying regional endpoints when creating the service client as shown in:
   153  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   154  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   155  	if err != nil {
   156  		// TODO: Handle error.
   157  	}
   158  	defer c.Close()
   159  
   160  	req := &aiplatformpb.DeleteModelMonitoringJobRequest{
   161  		// TODO: Fill request struct fields.
   162  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#DeleteModelMonitoringJobRequest.
   163  	}
   164  	op, err := c.DeleteModelMonitoringJob(ctx, req)
   165  	if err != nil {
   166  		// TODO: Handle error.
   167  	}
   168  
   169  	err = op.Wait(ctx)
   170  	if err != nil {
   171  		// TODO: Handle error.
   172  	}
   173  }
   174  
   175  func ExampleModelMonitoringClient_GetModelMonitor() {
   176  	ctx := context.Background()
   177  	// This snippet has been automatically generated and should be regarded as a code template only.
   178  	// It will require modifications to work:
   179  	// - It may require correct/in-range values for request initialization.
   180  	// - It may require specifying regional endpoints when creating the service client as shown in:
   181  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   182  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   183  	if err != nil {
   184  		// TODO: Handle error.
   185  	}
   186  	defer c.Close()
   187  
   188  	req := &aiplatformpb.GetModelMonitorRequest{
   189  		// TODO: Fill request struct fields.
   190  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetModelMonitorRequest.
   191  	}
   192  	resp, err := c.GetModelMonitor(ctx, req)
   193  	if err != nil {
   194  		// TODO: Handle error.
   195  	}
   196  	// TODO: Use resp.
   197  	_ = resp
   198  }
   199  
   200  func ExampleModelMonitoringClient_GetModelMonitoringJob() {
   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.NewModelMonitoringClient(ctx)
   208  	if err != nil {
   209  		// TODO: Handle error.
   210  	}
   211  	defer c.Close()
   212  
   213  	req := &aiplatformpb.GetModelMonitoringJobRequest{
   214  		// TODO: Fill request struct fields.
   215  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetModelMonitoringJobRequest.
   216  	}
   217  	resp, err := c.GetModelMonitoringJob(ctx, req)
   218  	if err != nil {
   219  		// TODO: Handle error.
   220  	}
   221  	// TODO: Use resp.
   222  	_ = resp
   223  }
   224  
   225  func ExampleModelMonitoringClient_ListModelMonitoringJobs() {
   226  	ctx := context.Background()
   227  	// This snippet has been automatically generated and should be regarded as a code template only.
   228  	// It will require modifications to work:
   229  	// - It may require correct/in-range values for request initialization.
   230  	// - It may require specifying regional endpoints when creating the service client as shown in:
   231  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   232  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   233  	if err != nil {
   234  		// TODO: Handle error.
   235  	}
   236  	defer c.Close()
   237  
   238  	req := &aiplatformpb.ListModelMonitoringJobsRequest{
   239  		// TODO: Fill request struct fields.
   240  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListModelMonitoringJobsRequest.
   241  	}
   242  	it := c.ListModelMonitoringJobs(ctx, req)
   243  	for {
   244  		resp, err := it.Next()
   245  		if err == iterator.Done {
   246  			break
   247  		}
   248  		if err != nil {
   249  			// TODO: Handle error.
   250  		}
   251  		// TODO: Use resp.
   252  		_ = resp
   253  
   254  		// If you need to access the underlying RPC response,
   255  		// you can do so by casting the `Response` as below.
   256  		// Otherwise, remove this line. Only populated after
   257  		// first call to Next(). Not safe for concurrent access.
   258  		_ = it.Response.(*aiplatformpb.ListModelMonitoringJobsResponse)
   259  	}
   260  }
   261  
   262  func ExampleModelMonitoringClient_ListModelMonitors() {
   263  	ctx := context.Background()
   264  	// This snippet has been automatically generated and should be regarded as a code template only.
   265  	// It will require modifications to work:
   266  	// - It may require correct/in-range values for request initialization.
   267  	// - It may require specifying regional endpoints when creating the service client as shown in:
   268  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   269  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   270  	if err != nil {
   271  		// TODO: Handle error.
   272  	}
   273  	defer c.Close()
   274  
   275  	req := &aiplatformpb.ListModelMonitorsRequest{
   276  		// TODO: Fill request struct fields.
   277  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#ListModelMonitorsRequest.
   278  	}
   279  	it := c.ListModelMonitors(ctx, req)
   280  	for {
   281  		resp, err := it.Next()
   282  		if err == iterator.Done {
   283  			break
   284  		}
   285  		if err != nil {
   286  			// TODO: Handle error.
   287  		}
   288  		// TODO: Use resp.
   289  		_ = resp
   290  
   291  		// If you need to access the underlying RPC response,
   292  		// you can do so by casting the `Response` as below.
   293  		// Otherwise, remove this line. Only populated after
   294  		// first call to Next(). Not safe for concurrent access.
   295  		_ = it.Response.(*aiplatformpb.ListModelMonitorsResponse)
   296  	}
   297  }
   298  
   299  func ExampleModelMonitoringClient_SearchModelMonitoringAlerts() {
   300  	ctx := context.Background()
   301  	// This snippet has been automatically generated and should be regarded as a code template only.
   302  	// It will require modifications to work:
   303  	// - It may require correct/in-range values for request initialization.
   304  	// - It may require specifying regional endpoints when creating the service client as shown in:
   305  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   306  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   307  	if err != nil {
   308  		// TODO: Handle error.
   309  	}
   310  	defer c.Close()
   311  
   312  	req := &aiplatformpb.SearchModelMonitoringAlertsRequest{
   313  		// TODO: Fill request struct fields.
   314  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#SearchModelMonitoringAlertsRequest.
   315  	}
   316  	it := c.SearchModelMonitoringAlerts(ctx, req)
   317  	for {
   318  		resp, err := it.Next()
   319  		if err == iterator.Done {
   320  			break
   321  		}
   322  		if err != nil {
   323  			// TODO: Handle error.
   324  		}
   325  		// TODO: Use resp.
   326  		_ = resp
   327  
   328  		// If you need to access the underlying RPC response,
   329  		// you can do so by casting the `Response` as below.
   330  		// Otherwise, remove this line. Only populated after
   331  		// first call to Next(). Not safe for concurrent access.
   332  		_ = it.Response.(*aiplatformpb.SearchModelMonitoringAlertsResponse)
   333  	}
   334  }
   335  
   336  func ExampleModelMonitoringClient_SearchModelMonitoringStats() {
   337  	ctx := context.Background()
   338  	// This snippet has been automatically generated and should be regarded as a code template only.
   339  	// It will require modifications to work:
   340  	// - It may require correct/in-range values for request initialization.
   341  	// - It may require specifying regional endpoints when creating the service client as shown in:
   342  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   343  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   344  	if err != nil {
   345  		// TODO: Handle error.
   346  	}
   347  	defer c.Close()
   348  
   349  	req := &aiplatformpb.SearchModelMonitoringStatsRequest{
   350  		// TODO: Fill request struct fields.
   351  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#SearchModelMonitoringStatsRequest.
   352  	}
   353  	it := c.SearchModelMonitoringStats(ctx, req)
   354  	for {
   355  		resp, err := it.Next()
   356  		if err == iterator.Done {
   357  			break
   358  		}
   359  		if err != nil {
   360  			// TODO: Handle error.
   361  		}
   362  		// TODO: Use resp.
   363  		_ = resp
   364  
   365  		// If you need to access the underlying RPC response,
   366  		// you can do so by casting the `Response` as below.
   367  		// Otherwise, remove this line. Only populated after
   368  		// first call to Next(). Not safe for concurrent access.
   369  		_ = it.Response.(*aiplatformpb.SearchModelMonitoringStatsResponse)
   370  	}
   371  }
   372  
   373  func ExampleModelMonitoringClient_UpdateModelMonitor() {
   374  	ctx := context.Background()
   375  	// This snippet has been automatically generated and should be regarded as a code template only.
   376  	// It will require modifications to work:
   377  	// - It may require correct/in-range values for request initialization.
   378  	// - It may require specifying regional endpoints when creating the service client as shown in:
   379  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   380  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   381  	if err != nil {
   382  		// TODO: Handle error.
   383  	}
   384  	defer c.Close()
   385  
   386  	req := &aiplatformpb.UpdateModelMonitorRequest{
   387  		// TODO: Fill request struct fields.
   388  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#UpdateModelMonitorRequest.
   389  	}
   390  	op, err := c.UpdateModelMonitor(ctx, req)
   391  	if err != nil {
   392  		// TODO: Handle error.
   393  	}
   394  
   395  	resp, err := op.Wait(ctx)
   396  	if err != nil {
   397  		// TODO: Handle error.
   398  	}
   399  	// TODO: Use resp.
   400  	_ = resp
   401  }
   402  
   403  func ExampleModelMonitoringClient_GetLocation() {
   404  	ctx := context.Background()
   405  	// This snippet has been automatically generated and should be regarded as a code template only.
   406  	// It will require modifications to work:
   407  	// - It may require correct/in-range values for request initialization.
   408  	// - It may require specifying regional endpoints when creating the service client as shown in:
   409  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   410  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   411  	if err != nil {
   412  		// TODO: Handle error.
   413  	}
   414  	defer c.Close()
   415  
   416  	req := &locationpb.GetLocationRequest{
   417  		// TODO: Fill request struct fields.
   418  		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
   419  	}
   420  	resp, err := c.GetLocation(ctx, req)
   421  	if err != nil {
   422  		// TODO: Handle error.
   423  	}
   424  	// TODO: Use resp.
   425  	_ = resp
   426  }
   427  
   428  func ExampleModelMonitoringClient_ListLocations() {
   429  	ctx := context.Background()
   430  	// This snippet has been automatically generated and should be regarded as a code template only.
   431  	// It will require modifications to work:
   432  	// - It may require correct/in-range values for request initialization.
   433  	// - It may require specifying regional endpoints when creating the service client as shown in:
   434  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   435  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   436  	if err != nil {
   437  		// TODO: Handle error.
   438  	}
   439  	defer c.Close()
   440  
   441  	req := &locationpb.ListLocationsRequest{
   442  		// TODO: Fill request struct fields.
   443  		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
   444  	}
   445  	it := c.ListLocations(ctx, req)
   446  	for {
   447  		resp, err := it.Next()
   448  		if err == iterator.Done {
   449  			break
   450  		}
   451  		if err != nil {
   452  			// TODO: Handle error.
   453  		}
   454  		// TODO: Use resp.
   455  		_ = resp
   456  
   457  		// If you need to access the underlying RPC response,
   458  		// you can do so by casting the `Response` as below.
   459  		// Otherwise, remove this line. Only populated after
   460  		// first call to Next(). Not safe for concurrent access.
   461  		_ = it.Response.(*locationpb.ListLocationsResponse)
   462  	}
   463  }
   464  
   465  func ExampleModelMonitoringClient_GetIamPolicy() {
   466  	ctx := context.Background()
   467  	// This snippet has been automatically generated and should be regarded as a code template only.
   468  	// It will require modifications to work:
   469  	// - It may require correct/in-range values for request initialization.
   470  	// - It may require specifying regional endpoints when creating the service client as shown in:
   471  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   472  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   473  	if err != nil {
   474  		// TODO: Handle error.
   475  	}
   476  	defer c.Close()
   477  
   478  	req := &iampb.GetIamPolicyRequest{
   479  		// TODO: Fill request struct fields.
   480  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
   481  	}
   482  	resp, err := c.GetIamPolicy(ctx, req)
   483  	if err != nil {
   484  		// TODO: Handle error.
   485  	}
   486  	// TODO: Use resp.
   487  	_ = resp
   488  }
   489  
   490  func ExampleModelMonitoringClient_SetIamPolicy() {
   491  	ctx := context.Background()
   492  	// This snippet has been automatically generated and should be regarded as a code template only.
   493  	// It will require modifications to work:
   494  	// - It may require correct/in-range values for request initialization.
   495  	// - It may require specifying regional endpoints when creating the service client as shown in:
   496  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   497  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   498  	if err != nil {
   499  		// TODO: Handle error.
   500  	}
   501  	defer c.Close()
   502  
   503  	req := &iampb.SetIamPolicyRequest{
   504  		// TODO: Fill request struct fields.
   505  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
   506  	}
   507  	resp, err := c.SetIamPolicy(ctx, req)
   508  	if err != nil {
   509  		// TODO: Handle error.
   510  	}
   511  	// TODO: Use resp.
   512  	_ = resp
   513  }
   514  
   515  func ExampleModelMonitoringClient_TestIamPermissions() {
   516  	ctx := context.Background()
   517  	// This snippet has been automatically generated and should be regarded as a code template only.
   518  	// It will require modifications to work:
   519  	// - It may require correct/in-range values for request initialization.
   520  	// - It may require specifying regional endpoints when creating the service client as shown in:
   521  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   522  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   523  	if err != nil {
   524  		// TODO: Handle error.
   525  	}
   526  	defer c.Close()
   527  
   528  	req := &iampb.TestIamPermissionsRequest{
   529  		// TODO: Fill request struct fields.
   530  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
   531  	}
   532  	resp, err := c.TestIamPermissions(ctx, req)
   533  	if err != nil {
   534  		// TODO: Handle error.
   535  	}
   536  	// TODO: Use resp.
   537  	_ = resp
   538  }
   539  
   540  func ExampleModelMonitoringClient_CancelOperation() {
   541  	ctx := context.Background()
   542  	// This snippet has been automatically generated and should be regarded as a code template only.
   543  	// It will require modifications to work:
   544  	// - It may require correct/in-range values for request initialization.
   545  	// - It may require specifying regional endpoints when creating the service client as shown in:
   546  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   547  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   548  	if err != nil {
   549  		// TODO: Handle error.
   550  	}
   551  	defer c.Close()
   552  
   553  	req := &longrunningpb.CancelOperationRequest{
   554  		// TODO: Fill request struct fields.
   555  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
   556  	}
   557  	err = c.CancelOperation(ctx, req)
   558  	if err != nil {
   559  		// TODO: Handle error.
   560  	}
   561  }
   562  
   563  func ExampleModelMonitoringClient_DeleteOperation() {
   564  	ctx := context.Background()
   565  	// This snippet has been automatically generated and should be regarded as a code template only.
   566  	// It will require modifications to work:
   567  	// - It may require correct/in-range values for request initialization.
   568  	// - It may require specifying regional endpoints when creating the service client as shown in:
   569  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   570  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   571  	if err != nil {
   572  		// TODO: Handle error.
   573  	}
   574  	defer c.Close()
   575  
   576  	req := &longrunningpb.DeleteOperationRequest{
   577  		// TODO: Fill request struct fields.
   578  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
   579  	}
   580  	err = c.DeleteOperation(ctx, req)
   581  	if err != nil {
   582  		// TODO: Handle error.
   583  	}
   584  }
   585  
   586  func ExampleModelMonitoringClient_GetOperation() {
   587  	ctx := context.Background()
   588  	// This snippet has been automatically generated and should be regarded as a code template only.
   589  	// It will require modifications to work:
   590  	// - It may require correct/in-range values for request initialization.
   591  	// - It may require specifying regional endpoints when creating the service client as shown in:
   592  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   593  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   594  	if err != nil {
   595  		// TODO: Handle error.
   596  	}
   597  	defer c.Close()
   598  
   599  	req := &longrunningpb.GetOperationRequest{
   600  		// TODO: Fill request struct fields.
   601  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
   602  	}
   603  	resp, err := c.GetOperation(ctx, req)
   604  	if err != nil {
   605  		// TODO: Handle error.
   606  	}
   607  	// TODO: Use resp.
   608  	_ = resp
   609  }
   610  
   611  func ExampleModelMonitoringClient_ListOperations() {
   612  	ctx := context.Background()
   613  	// This snippet has been automatically generated and should be regarded as a code template only.
   614  	// It will require modifications to work:
   615  	// - It may require correct/in-range values for request initialization.
   616  	// - It may require specifying regional endpoints when creating the service client as shown in:
   617  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   618  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   619  	if err != nil {
   620  		// TODO: Handle error.
   621  	}
   622  	defer c.Close()
   623  
   624  	req := &longrunningpb.ListOperationsRequest{
   625  		// TODO: Fill request struct fields.
   626  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
   627  	}
   628  	it := c.ListOperations(ctx, req)
   629  	for {
   630  		resp, err := it.Next()
   631  		if err == iterator.Done {
   632  			break
   633  		}
   634  		if err != nil {
   635  			// TODO: Handle error.
   636  		}
   637  		// TODO: Use resp.
   638  		_ = resp
   639  
   640  		// If you need to access the underlying RPC response,
   641  		// you can do so by casting the `Response` as below.
   642  		// Otherwise, remove this line. Only populated after
   643  		// first call to Next(). Not safe for concurrent access.
   644  		_ = it.Response.(*longrunningpb.ListOperationsResponse)
   645  	}
   646  }
   647  
   648  func ExampleModelMonitoringClient_WaitOperation() {
   649  	ctx := context.Background()
   650  	// This snippet has been automatically generated and should be regarded as a code template only.
   651  	// It will require modifications to work:
   652  	// - It may require correct/in-range values for request initialization.
   653  	// - It may require specifying regional endpoints when creating the service client as shown in:
   654  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   655  	c, err := aiplatform.NewModelMonitoringClient(ctx)
   656  	if err != nil {
   657  		// TODO: Handle error.
   658  	}
   659  	defer c.Close()
   660  
   661  	req := &longrunningpb.WaitOperationRequest{
   662  		// TODO: Fill request struct fields.
   663  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest.
   664  	}
   665  	resp, err := c.WaitOperation(ctx, req)
   666  	if err != nil {
   667  		// TODO: Handle error.
   668  	}
   669  	// TODO: Use resp.
   670  	_ = resp
   671  }