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