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