cloud.google.com/go/aiplatform@v1.106.0/apiv1/metadata_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 ExampleNewMetadataClient() {
    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.NewMetadataClient(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 ExampleMetadataClient_AddContextArtifactsAndExecutions() {
    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.NewMetadataClient(ctx)
    55  	if err != nil {
    56  		// TODO: Handle error.
    57  	}
    58  	defer c.Close()
    59  
    60  	req := &aiplatformpb.AddContextArtifactsAndExecutionsRequest{
    61  		// TODO: Fill request struct fields.
    62  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#AddContextArtifactsAndExecutionsRequest.
    63  	}
    64  	resp, err := c.AddContextArtifactsAndExecutions(ctx, req)
    65  	if err != nil {
    66  		// TODO: Handle error.
    67  	}
    68  	// TODO: Use resp.
    69  	_ = resp
    70  }
    71  
    72  func ExampleMetadataClient_AddContextChildren() {
    73  	ctx := context.Background()
    74  	// This snippet has been automatically generated and should be regarded as a code template only.
    75  	// It will require modifications to work:
    76  	// - It may require correct/in-range values for request initialization.
    77  	// - It may require specifying regional endpoints when creating the service client as shown in:
    78  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
    79  	c, err := aiplatform.NewMetadataClient(ctx)
    80  	if err != nil {
    81  		// TODO: Handle error.
    82  	}
    83  	defer c.Close()
    84  
    85  	req := &aiplatformpb.AddContextChildrenRequest{
    86  		// TODO: Fill request struct fields.
    87  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#AddContextChildrenRequest.
    88  	}
    89  	resp, err := c.AddContextChildren(ctx, req)
    90  	if err != nil {
    91  		// TODO: Handle error.
    92  	}
    93  	// TODO: Use resp.
    94  	_ = resp
    95  }
    96  
    97  func ExampleMetadataClient_AddExecutionEvents() {
    98  	ctx := context.Background()
    99  	// This snippet has been automatically generated and should be regarded as a code template only.
   100  	// It will require modifications to work:
   101  	// - It may require correct/in-range values for request initialization.
   102  	// - It may require specifying regional endpoints when creating the service client as shown in:
   103  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   104  	c, err := aiplatform.NewMetadataClient(ctx)
   105  	if err != nil {
   106  		// TODO: Handle error.
   107  	}
   108  	defer c.Close()
   109  
   110  	req := &aiplatformpb.AddExecutionEventsRequest{
   111  		// TODO: Fill request struct fields.
   112  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#AddExecutionEventsRequest.
   113  	}
   114  	resp, err := c.AddExecutionEvents(ctx, req)
   115  	if err != nil {
   116  		// TODO: Handle error.
   117  	}
   118  	// TODO: Use resp.
   119  	_ = resp
   120  }
   121  
   122  func ExampleMetadataClient_CreateArtifact() {
   123  	ctx := context.Background()
   124  	// This snippet has been automatically generated and should be regarded as a code template only.
   125  	// It will require modifications to work:
   126  	// - It may require correct/in-range values for request initialization.
   127  	// - It may require specifying regional endpoints when creating the service client as shown in:
   128  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   129  	c, err := aiplatform.NewMetadataClient(ctx)
   130  	if err != nil {
   131  		// TODO: Handle error.
   132  	}
   133  	defer c.Close()
   134  
   135  	req := &aiplatformpb.CreateArtifactRequest{
   136  		// TODO: Fill request struct fields.
   137  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateArtifactRequest.
   138  	}
   139  	resp, err := c.CreateArtifact(ctx, req)
   140  	if err != nil {
   141  		// TODO: Handle error.
   142  	}
   143  	// TODO: Use resp.
   144  	_ = resp
   145  }
   146  
   147  func ExampleMetadataClient_CreateContext() {
   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.NewMetadataClient(ctx)
   155  	if err != nil {
   156  		// TODO: Handle error.
   157  	}
   158  	defer c.Close()
   159  
   160  	req := &aiplatformpb.CreateContextRequest{
   161  		// TODO: Fill request struct fields.
   162  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateContextRequest.
   163  	}
   164  	resp, err := c.CreateContext(ctx, req)
   165  	if err != nil {
   166  		// TODO: Handle error.
   167  	}
   168  	// TODO: Use resp.
   169  	_ = resp
   170  }
   171  
   172  func ExampleMetadataClient_CreateExecution() {
   173  	ctx := context.Background()
   174  	// This snippet has been automatically generated and should be regarded as a code template only.
   175  	// It will require modifications to work:
   176  	// - It may require correct/in-range values for request initialization.
   177  	// - It may require specifying regional endpoints when creating the service client as shown in:
   178  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   179  	c, err := aiplatform.NewMetadataClient(ctx)
   180  	if err != nil {
   181  		// TODO: Handle error.
   182  	}
   183  	defer c.Close()
   184  
   185  	req := &aiplatformpb.CreateExecutionRequest{
   186  		// TODO: Fill request struct fields.
   187  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateExecutionRequest.
   188  	}
   189  	resp, err := c.CreateExecution(ctx, req)
   190  	if err != nil {
   191  		// TODO: Handle error.
   192  	}
   193  	// TODO: Use resp.
   194  	_ = resp
   195  }
   196  
   197  func ExampleMetadataClient_CreateMetadataSchema() {
   198  	ctx := context.Background()
   199  	// This snippet has been automatically generated and should be regarded as a code template only.
   200  	// It will require modifications to work:
   201  	// - It may require correct/in-range values for request initialization.
   202  	// - It may require specifying regional endpoints when creating the service client as shown in:
   203  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   204  	c, err := aiplatform.NewMetadataClient(ctx)
   205  	if err != nil {
   206  		// TODO: Handle error.
   207  	}
   208  	defer c.Close()
   209  
   210  	req := &aiplatformpb.CreateMetadataSchemaRequest{
   211  		// TODO: Fill request struct fields.
   212  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateMetadataSchemaRequest.
   213  	}
   214  	resp, err := c.CreateMetadataSchema(ctx, req)
   215  	if err != nil {
   216  		// TODO: Handle error.
   217  	}
   218  	// TODO: Use resp.
   219  	_ = resp
   220  }
   221  
   222  func ExampleMetadataClient_CreateMetadataStore() {
   223  	ctx := context.Background()
   224  	// This snippet has been automatically generated and should be regarded as a code template only.
   225  	// It will require modifications to work:
   226  	// - It may require correct/in-range values for request initialization.
   227  	// - It may require specifying regional endpoints when creating the service client as shown in:
   228  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   229  	c, err := aiplatform.NewMetadataClient(ctx)
   230  	if err != nil {
   231  		// TODO: Handle error.
   232  	}
   233  	defer c.Close()
   234  
   235  	req := &aiplatformpb.CreateMetadataStoreRequest{
   236  		// TODO: Fill request struct fields.
   237  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateMetadataStoreRequest.
   238  	}
   239  	op, err := c.CreateMetadataStore(ctx, req)
   240  	if err != nil {
   241  		// TODO: Handle error.
   242  	}
   243  
   244  	resp, err := op.Wait(ctx)
   245  	if err != nil {
   246  		// TODO: Handle error.
   247  	}
   248  	// TODO: Use resp.
   249  	_ = resp
   250  }
   251  
   252  func ExampleMetadataClient_DeleteArtifact() {
   253  	ctx := context.Background()
   254  	// This snippet has been automatically generated and should be regarded as a code template only.
   255  	// It will require modifications to work:
   256  	// - It may require correct/in-range values for request initialization.
   257  	// - It may require specifying regional endpoints when creating the service client as shown in:
   258  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   259  	c, err := aiplatform.NewMetadataClient(ctx)
   260  	if err != nil {
   261  		// TODO: Handle error.
   262  	}
   263  	defer c.Close()
   264  
   265  	req := &aiplatformpb.DeleteArtifactRequest{
   266  		// TODO: Fill request struct fields.
   267  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteArtifactRequest.
   268  	}
   269  	op, err := c.DeleteArtifact(ctx, req)
   270  	if err != nil {
   271  		// TODO: Handle error.
   272  	}
   273  
   274  	err = op.Wait(ctx)
   275  	if err != nil {
   276  		// TODO: Handle error.
   277  	}
   278  }
   279  
   280  func ExampleMetadataClient_DeleteContext() {
   281  	ctx := context.Background()
   282  	// This snippet has been automatically generated and should be regarded as a code template only.
   283  	// It will require modifications to work:
   284  	// - It may require correct/in-range values for request initialization.
   285  	// - It may require specifying regional endpoints when creating the service client as shown in:
   286  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   287  	c, err := aiplatform.NewMetadataClient(ctx)
   288  	if err != nil {
   289  		// TODO: Handle error.
   290  	}
   291  	defer c.Close()
   292  
   293  	req := &aiplatformpb.DeleteContextRequest{
   294  		// TODO: Fill request struct fields.
   295  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteContextRequest.
   296  	}
   297  	op, err := c.DeleteContext(ctx, req)
   298  	if err != nil {
   299  		// TODO: Handle error.
   300  	}
   301  
   302  	err = op.Wait(ctx)
   303  	if err != nil {
   304  		// TODO: Handle error.
   305  	}
   306  }
   307  
   308  func ExampleMetadataClient_DeleteExecution() {
   309  	ctx := context.Background()
   310  	// This snippet has been automatically generated and should be regarded as a code template only.
   311  	// It will require modifications to work:
   312  	// - It may require correct/in-range values for request initialization.
   313  	// - It may require specifying regional endpoints when creating the service client as shown in:
   314  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   315  	c, err := aiplatform.NewMetadataClient(ctx)
   316  	if err != nil {
   317  		// TODO: Handle error.
   318  	}
   319  	defer c.Close()
   320  
   321  	req := &aiplatformpb.DeleteExecutionRequest{
   322  		// TODO: Fill request struct fields.
   323  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteExecutionRequest.
   324  	}
   325  	op, err := c.DeleteExecution(ctx, req)
   326  	if err != nil {
   327  		// TODO: Handle error.
   328  	}
   329  
   330  	err = op.Wait(ctx)
   331  	if err != nil {
   332  		// TODO: Handle error.
   333  	}
   334  }
   335  
   336  func ExampleMetadataClient_DeleteMetadataStore() {
   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.NewMetadataClient(ctx)
   344  	if err != nil {
   345  		// TODO: Handle error.
   346  	}
   347  	defer c.Close()
   348  
   349  	req := &aiplatformpb.DeleteMetadataStoreRequest{
   350  		// TODO: Fill request struct fields.
   351  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteMetadataStoreRequest.
   352  	}
   353  	op, err := c.DeleteMetadataStore(ctx, req)
   354  	if err != nil {
   355  		// TODO: Handle error.
   356  	}
   357  
   358  	err = op.Wait(ctx)
   359  	if err != nil {
   360  		// TODO: Handle error.
   361  	}
   362  }
   363  
   364  func ExampleMetadataClient_GetArtifact() {
   365  	ctx := context.Background()
   366  	// This snippet has been automatically generated and should be regarded as a code template only.
   367  	// It will require modifications to work:
   368  	// - It may require correct/in-range values for request initialization.
   369  	// - It may require specifying regional endpoints when creating the service client as shown in:
   370  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   371  	c, err := aiplatform.NewMetadataClient(ctx)
   372  	if err != nil {
   373  		// TODO: Handle error.
   374  	}
   375  	defer c.Close()
   376  
   377  	req := &aiplatformpb.GetArtifactRequest{
   378  		// TODO: Fill request struct fields.
   379  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetArtifactRequest.
   380  	}
   381  	resp, err := c.GetArtifact(ctx, req)
   382  	if err != nil {
   383  		// TODO: Handle error.
   384  	}
   385  	// TODO: Use resp.
   386  	_ = resp
   387  }
   388  
   389  func ExampleMetadataClient_GetContext() {
   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.NewMetadataClient(ctx)
   397  	if err != nil {
   398  		// TODO: Handle error.
   399  	}
   400  	defer c.Close()
   401  
   402  	req := &aiplatformpb.GetContextRequest{
   403  		// TODO: Fill request struct fields.
   404  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetContextRequest.
   405  	}
   406  	resp, err := c.GetContext(ctx, req)
   407  	if err != nil {
   408  		// TODO: Handle error.
   409  	}
   410  	// TODO: Use resp.
   411  	_ = resp
   412  }
   413  
   414  func ExampleMetadataClient_GetExecution() {
   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.NewMetadataClient(ctx)
   422  	if err != nil {
   423  		// TODO: Handle error.
   424  	}
   425  	defer c.Close()
   426  
   427  	req := &aiplatformpb.GetExecutionRequest{
   428  		// TODO: Fill request struct fields.
   429  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetExecutionRequest.
   430  	}
   431  	resp, err := c.GetExecution(ctx, req)
   432  	if err != nil {
   433  		// TODO: Handle error.
   434  	}
   435  	// TODO: Use resp.
   436  	_ = resp
   437  }
   438  
   439  func ExampleMetadataClient_GetMetadataSchema() {
   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.NewMetadataClient(ctx)
   447  	if err != nil {
   448  		// TODO: Handle error.
   449  	}
   450  	defer c.Close()
   451  
   452  	req := &aiplatformpb.GetMetadataSchemaRequest{
   453  		// TODO: Fill request struct fields.
   454  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetMetadataSchemaRequest.
   455  	}
   456  	resp, err := c.GetMetadataSchema(ctx, req)
   457  	if err != nil {
   458  		// TODO: Handle error.
   459  	}
   460  	// TODO: Use resp.
   461  	_ = resp
   462  }
   463  
   464  func ExampleMetadataClient_GetMetadataStore() {
   465  	ctx := context.Background()
   466  	// This snippet has been automatically generated and should be regarded as a code template only.
   467  	// It will require modifications to work:
   468  	// - It may require correct/in-range values for request initialization.
   469  	// - It may require specifying regional endpoints when creating the service client as shown in:
   470  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   471  	c, err := aiplatform.NewMetadataClient(ctx)
   472  	if err != nil {
   473  		// TODO: Handle error.
   474  	}
   475  	defer c.Close()
   476  
   477  	req := &aiplatformpb.GetMetadataStoreRequest{
   478  		// TODO: Fill request struct fields.
   479  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetMetadataStoreRequest.
   480  	}
   481  	resp, err := c.GetMetadataStore(ctx, req)
   482  	if err != nil {
   483  		// TODO: Handle error.
   484  	}
   485  	// TODO: Use resp.
   486  	_ = resp
   487  }
   488  
   489  func ExampleMetadataClient_ListArtifacts() {
   490  	ctx := context.Background()
   491  	// This snippet has been automatically generated and should be regarded as a code template only.
   492  	// It will require modifications to work:
   493  	// - It may require correct/in-range values for request initialization.
   494  	// - It may require specifying regional endpoints when creating the service client as shown in:
   495  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   496  	c, err := aiplatform.NewMetadataClient(ctx)
   497  	if err != nil {
   498  		// TODO: Handle error.
   499  	}
   500  	defer c.Close()
   501  
   502  	req := &aiplatformpb.ListArtifactsRequest{
   503  		// TODO: Fill request struct fields.
   504  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListArtifactsRequest.
   505  	}
   506  	it := c.ListArtifacts(ctx, req)
   507  	for {
   508  		resp, err := it.Next()
   509  		if err == iterator.Done {
   510  			break
   511  		}
   512  		if err != nil {
   513  			// TODO: Handle error.
   514  		}
   515  		// TODO: Use resp.
   516  		_ = resp
   517  
   518  		// If you need to access the underlying RPC response,
   519  		// you can do so by casting the `Response` as below.
   520  		// Otherwise, remove this line. Only populated after
   521  		// first call to Next(). Not safe for concurrent access.
   522  		_ = it.Response.(*aiplatformpb.ListArtifactsResponse)
   523  	}
   524  }
   525  
   526  func ExampleMetadataClient_ListContexts() {
   527  	ctx := context.Background()
   528  	// This snippet has been automatically generated and should be regarded as a code template only.
   529  	// It will require modifications to work:
   530  	// - It may require correct/in-range values for request initialization.
   531  	// - It may require specifying regional endpoints when creating the service client as shown in:
   532  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   533  	c, err := aiplatform.NewMetadataClient(ctx)
   534  	if err != nil {
   535  		// TODO: Handle error.
   536  	}
   537  	defer c.Close()
   538  
   539  	req := &aiplatformpb.ListContextsRequest{
   540  		// TODO: Fill request struct fields.
   541  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListContextsRequest.
   542  	}
   543  	it := c.ListContexts(ctx, req)
   544  	for {
   545  		resp, err := it.Next()
   546  		if err == iterator.Done {
   547  			break
   548  		}
   549  		if err != nil {
   550  			// TODO: Handle error.
   551  		}
   552  		// TODO: Use resp.
   553  		_ = resp
   554  
   555  		// If you need to access the underlying RPC response,
   556  		// you can do so by casting the `Response` as below.
   557  		// Otherwise, remove this line. Only populated after
   558  		// first call to Next(). Not safe for concurrent access.
   559  		_ = it.Response.(*aiplatformpb.ListContextsResponse)
   560  	}
   561  }
   562  
   563  func ExampleMetadataClient_ListExecutions() {
   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.NewMetadataClient(ctx)
   571  	if err != nil {
   572  		// TODO: Handle error.
   573  	}
   574  	defer c.Close()
   575  
   576  	req := &aiplatformpb.ListExecutionsRequest{
   577  		// TODO: Fill request struct fields.
   578  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListExecutionsRequest.
   579  	}
   580  	it := c.ListExecutions(ctx, req)
   581  	for {
   582  		resp, err := it.Next()
   583  		if err == iterator.Done {
   584  			break
   585  		}
   586  		if err != nil {
   587  			// TODO: Handle error.
   588  		}
   589  		// TODO: Use resp.
   590  		_ = resp
   591  
   592  		// If you need to access the underlying RPC response,
   593  		// you can do so by casting the `Response` as below.
   594  		// Otherwise, remove this line. Only populated after
   595  		// first call to Next(). Not safe for concurrent access.
   596  		_ = it.Response.(*aiplatformpb.ListExecutionsResponse)
   597  	}
   598  }
   599  
   600  func ExampleMetadataClient_ListMetadataSchemas() {
   601  	ctx := context.Background()
   602  	// This snippet has been automatically generated and should be regarded as a code template only.
   603  	// It will require modifications to work:
   604  	// - It may require correct/in-range values for request initialization.
   605  	// - It may require specifying regional endpoints when creating the service client as shown in:
   606  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   607  	c, err := aiplatform.NewMetadataClient(ctx)
   608  	if err != nil {
   609  		// TODO: Handle error.
   610  	}
   611  	defer c.Close()
   612  
   613  	req := &aiplatformpb.ListMetadataSchemasRequest{
   614  		// TODO: Fill request struct fields.
   615  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListMetadataSchemasRequest.
   616  	}
   617  	it := c.ListMetadataSchemas(ctx, req)
   618  	for {
   619  		resp, err := it.Next()
   620  		if err == iterator.Done {
   621  			break
   622  		}
   623  		if err != nil {
   624  			// TODO: Handle error.
   625  		}
   626  		// TODO: Use resp.
   627  		_ = resp
   628  
   629  		// If you need to access the underlying RPC response,
   630  		// you can do so by casting the `Response` as below.
   631  		// Otherwise, remove this line. Only populated after
   632  		// first call to Next(). Not safe for concurrent access.
   633  		_ = it.Response.(*aiplatformpb.ListMetadataSchemasResponse)
   634  	}
   635  }
   636  
   637  func ExampleMetadataClient_ListMetadataStores() {
   638  	ctx := context.Background()
   639  	// This snippet has been automatically generated and should be regarded as a code template only.
   640  	// It will require modifications to work:
   641  	// - It may require correct/in-range values for request initialization.
   642  	// - It may require specifying regional endpoints when creating the service client as shown in:
   643  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   644  	c, err := aiplatform.NewMetadataClient(ctx)
   645  	if err != nil {
   646  		// TODO: Handle error.
   647  	}
   648  	defer c.Close()
   649  
   650  	req := &aiplatformpb.ListMetadataStoresRequest{
   651  		// TODO: Fill request struct fields.
   652  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListMetadataStoresRequest.
   653  	}
   654  	it := c.ListMetadataStores(ctx, req)
   655  	for {
   656  		resp, err := it.Next()
   657  		if err == iterator.Done {
   658  			break
   659  		}
   660  		if err != nil {
   661  			// TODO: Handle error.
   662  		}
   663  		// TODO: Use resp.
   664  		_ = resp
   665  
   666  		// If you need to access the underlying RPC response,
   667  		// you can do so by casting the `Response` as below.
   668  		// Otherwise, remove this line. Only populated after
   669  		// first call to Next(). Not safe for concurrent access.
   670  		_ = it.Response.(*aiplatformpb.ListMetadataStoresResponse)
   671  	}
   672  }
   673  
   674  func ExampleMetadataClient_PurgeArtifacts() {
   675  	ctx := context.Background()
   676  	// This snippet has been automatically generated and should be regarded as a code template only.
   677  	// It will require modifications to work:
   678  	// - It may require correct/in-range values for request initialization.
   679  	// - It may require specifying regional endpoints when creating the service client as shown in:
   680  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   681  	c, err := aiplatform.NewMetadataClient(ctx)
   682  	if err != nil {
   683  		// TODO: Handle error.
   684  	}
   685  	defer c.Close()
   686  
   687  	req := &aiplatformpb.PurgeArtifactsRequest{
   688  		// TODO: Fill request struct fields.
   689  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#PurgeArtifactsRequest.
   690  	}
   691  	op, err := c.PurgeArtifacts(ctx, req)
   692  	if err != nil {
   693  		// TODO: Handle error.
   694  	}
   695  
   696  	resp, err := op.Wait(ctx)
   697  	if err != nil {
   698  		// TODO: Handle error.
   699  	}
   700  	// TODO: Use resp.
   701  	_ = resp
   702  }
   703  
   704  func ExampleMetadataClient_PurgeContexts() {
   705  	ctx := context.Background()
   706  	// This snippet has been automatically generated and should be regarded as a code template only.
   707  	// It will require modifications to work:
   708  	// - It may require correct/in-range values for request initialization.
   709  	// - It may require specifying regional endpoints when creating the service client as shown in:
   710  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   711  	c, err := aiplatform.NewMetadataClient(ctx)
   712  	if err != nil {
   713  		// TODO: Handle error.
   714  	}
   715  	defer c.Close()
   716  
   717  	req := &aiplatformpb.PurgeContextsRequest{
   718  		// TODO: Fill request struct fields.
   719  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#PurgeContextsRequest.
   720  	}
   721  	op, err := c.PurgeContexts(ctx, req)
   722  	if err != nil {
   723  		// TODO: Handle error.
   724  	}
   725  
   726  	resp, err := op.Wait(ctx)
   727  	if err != nil {
   728  		// TODO: Handle error.
   729  	}
   730  	// TODO: Use resp.
   731  	_ = resp
   732  }
   733  
   734  func ExampleMetadataClient_PurgeExecutions() {
   735  	ctx := context.Background()
   736  	// This snippet has been automatically generated and should be regarded as a code template only.
   737  	// It will require modifications to work:
   738  	// - It may require correct/in-range values for request initialization.
   739  	// - It may require specifying regional endpoints when creating the service client as shown in:
   740  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   741  	c, err := aiplatform.NewMetadataClient(ctx)
   742  	if err != nil {
   743  		// TODO: Handle error.
   744  	}
   745  	defer c.Close()
   746  
   747  	req := &aiplatformpb.PurgeExecutionsRequest{
   748  		// TODO: Fill request struct fields.
   749  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#PurgeExecutionsRequest.
   750  	}
   751  	op, err := c.PurgeExecutions(ctx, req)
   752  	if err != nil {
   753  		// TODO: Handle error.
   754  	}
   755  
   756  	resp, err := op.Wait(ctx)
   757  	if err != nil {
   758  		// TODO: Handle error.
   759  	}
   760  	// TODO: Use resp.
   761  	_ = resp
   762  }
   763  
   764  func ExampleMetadataClient_QueryArtifactLineageSubgraph() {
   765  	ctx := context.Background()
   766  	// This snippet has been automatically generated and should be regarded as a code template only.
   767  	// It will require modifications to work:
   768  	// - It may require correct/in-range values for request initialization.
   769  	// - It may require specifying regional endpoints when creating the service client as shown in:
   770  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   771  	c, err := aiplatform.NewMetadataClient(ctx)
   772  	if err != nil {
   773  		// TODO: Handle error.
   774  	}
   775  	defer c.Close()
   776  
   777  	req := &aiplatformpb.QueryArtifactLineageSubgraphRequest{
   778  		// TODO: Fill request struct fields.
   779  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#QueryArtifactLineageSubgraphRequest.
   780  	}
   781  	resp, err := c.QueryArtifactLineageSubgraph(ctx, req)
   782  	if err != nil {
   783  		// TODO: Handle error.
   784  	}
   785  	// TODO: Use resp.
   786  	_ = resp
   787  }
   788  
   789  func ExampleMetadataClient_QueryContextLineageSubgraph() {
   790  	ctx := context.Background()
   791  	// This snippet has been automatically generated and should be regarded as a code template only.
   792  	// It will require modifications to work:
   793  	// - It may require correct/in-range values for request initialization.
   794  	// - It may require specifying regional endpoints when creating the service client as shown in:
   795  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   796  	c, err := aiplatform.NewMetadataClient(ctx)
   797  	if err != nil {
   798  		// TODO: Handle error.
   799  	}
   800  	defer c.Close()
   801  
   802  	req := &aiplatformpb.QueryContextLineageSubgraphRequest{
   803  		// TODO: Fill request struct fields.
   804  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#QueryContextLineageSubgraphRequest.
   805  	}
   806  	resp, err := c.QueryContextLineageSubgraph(ctx, req)
   807  	if err != nil {
   808  		// TODO: Handle error.
   809  	}
   810  	// TODO: Use resp.
   811  	_ = resp
   812  }
   813  
   814  func ExampleMetadataClient_QueryExecutionInputsAndOutputs() {
   815  	ctx := context.Background()
   816  	// This snippet has been automatically generated and should be regarded as a code template only.
   817  	// It will require modifications to work:
   818  	// - It may require correct/in-range values for request initialization.
   819  	// - It may require specifying regional endpoints when creating the service client as shown in:
   820  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   821  	c, err := aiplatform.NewMetadataClient(ctx)
   822  	if err != nil {
   823  		// TODO: Handle error.
   824  	}
   825  	defer c.Close()
   826  
   827  	req := &aiplatformpb.QueryExecutionInputsAndOutputsRequest{
   828  		// TODO: Fill request struct fields.
   829  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#QueryExecutionInputsAndOutputsRequest.
   830  	}
   831  	resp, err := c.QueryExecutionInputsAndOutputs(ctx, req)
   832  	if err != nil {
   833  		// TODO: Handle error.
   834  	}
   835  	// TODO: Use resp.
   836  	_ = resp
   837  }
   838  
   839  func ExampleMetadataClient_RemoveContextChildren() {
   840  	ctx := context.Background()
   841  	// This snippet has been automatically generated and should be regarded as a code template only.
   842  	// It will require modifications to work:
   843  	// - It may require correct/in-range values for request initialization.
   844  	// - It may require specifying regional endpoints when creating the service client as shown in:
   845  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   846  	c, err := aiplatform.NewMetadataClient(ctx)
   847  	if err != nil {
   848  		// TODO: Handle error.
   849  	}
   850  	defer c.Close()
   851  
   852  	req := &aiplatformpb.RemoveContextChildrenRequest{
   853  		// TODO: Fill request struct fields.
   854  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#RemoveContextChildrenRequest.
   855  	}
   856  	resp, err := c.RemoveContextChildren(ctx, req)
   857  	if err != nil {
   858  		// TODO: Handle error.
   859  	}
   860  	// TODO: Use resp.
   861  	_ = resp
   862  }
   863  
   864  func ExampleMetadataClient_UpdateArtifact() {
   865  	ctx := context.Background()
   866  	// This snippet has been automatically generated and should be regarded as a code template only.
   867  	// It will require modifications to work:
   868  	// - It may require correct/in-range values for request initialization.
   869  	// - It may require specifying regional endpoints when creating the service client as shown in:
   870  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   871  	c, err := aiplatform.NewMetadataClient(ctx)
   872  	if err != nil {
   873  		// TODO: Handle error.
   874  	}
   875  	defer c.Close()
   876  
   877  	req := &aiplatformpb.UpdateArtifactRequest{
   878  		// TODO: Fill request struct fields.
   879  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#UpdateArtifactRequest.
   880  	}
   881  	resp, err := c.UpdateArtifact(ctx, req)
   882  	if err != nil {
   883  		// TODO: Handle error.
   884  	}
   885  	// TODO: Use resp.
   886  	_ = resp
   887  }
   888  
   889  func ExampleMetadataClient_UpdateContext() {
   890  	ctx := context.Background()
   891  	// This snippet has been automatically generated and should be regarded as a code template only.
   892  	// It will require modifications to work:
   893  	// - It may require correct/in-range values for request initialization.
   894  	// - It may require specifying regional endpoints when creating the service client as shown in:
   895  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   896  	c, err := aiplatform.NewMetadataClient(ctx)
   897  	if err != nil {
   898  		// TODO: Handle error.
   899  	}
   900  	defer c.Close()
   901  
   902  	req := &aiplatformpb.UpdateContextRequest{
   903  		// TODO: Fill request struct fields.
   904  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#UpdateContextRequest.
   905  	}
   906  	resp, err := c.UpdateContext(ctx, req)
   907  	if err != nil {
   908  		// TODO: Handle error.
   909  	}
   910  	// TODO: Use resp.
   911  	_ = resp
   912  }
   913  
   914  func ExampleMetadataClient_UpdateExecution() {
   915  	ctx := context.Background()
   916  	// This snippet has been automatically generated and should be regarded as a code template only.
   917  	// It will require modifications to work:
   918  	// - It may require correct/in-range values for request initialization.
   919  	// - It may require specifying regional endpoints when creating the service client as shown in:
   920  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   921  	c, err := aiplatform.NewMetadataClient(ctx)
   922  	if err != nil {
   923  		// TODO: Handle error.
   924  	}
   925  	defer c.Close()
   926  
   927  	req := &aiplatformpb.UpdateExecutionRequest{
   928  		// TODO: Fill request struct fields.
   929  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#UpdateExecutionRequest.
   930  	}
   931  	resp, err := c.UpdateExecution(ctx, req)
   932  	if err != nil {
   933  		// TODO: Handle error.
   934  	}
   935  	// TODO: Use resp.
   936  	_ = resp
   937  }
   938  
   939  func ExampleMetadataClient_GetLocation() {
   940  	ctx := context.Background()
   941  	// This snippet has been automatically generated and should be regarded as a code template only.
   942  	// It will require modifications to work:
   943  	// - It may require correct/in-range values for request initialization.
   944  	// - It may require specifying regional endpoints when creating the service client as shown in:
   945  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   946  	c, err := aiplatform.NewMetadataClient(ctx)
   947  	if err != nil {
   948  		// TODO: Handle error.
   949  	}
   950  	defer c.Close()
   951  
   952  	req := &locationpb.GetLocationRequest{
   953  		// TODO: Fill request struct fields.
   954  		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
   955  	}
   956  	resp, err := c.GetLocation(ctx, req)
   957  	if err != nil {
   958  		// TODO: Handle error.
   959  	}
   960  	// TODO: Use resp.
   961  	_ = resp
   962  }
   963  
   964  func ExampleMetadataClient_ListLocations() {
   965  	ctx := context.Background()
   966  	// This snippet has been automatically generated and should be regarded as a code template only.
   967  	// It will require modifications to work:
   968  	// - It may require correct/in-range values for request initialization.
   969  	// - It may require specifying regional endpoints when creating the service client as shown in:
   970  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   971  	c, err := aiplatform.NewMetadataClient(ctx)
   972  	if err != nil {
   973  		// TODO: Handle error.
   974  	}
   975  	defer c.Close()
   976  
   977  	req := &locationpb.ListLocationsRequest{
   978  		// TODO: Fill request struct fields.
   979  		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
   980  	}
   981  	it := c.ListLocations(ctx, req)
   982  	for {
   983  		resp, err := it.Next()
   984  		if err == iterator.Done {
   985  			break
   986  		}
   987  		if err != nil {
   988  			// TODO: Handle error.
   989  		}
   990  		// TODO: Use resp.
   991  		_ = resp
   992  
   993  		// If you need to access the underlying RPC response,
   994  		// you can do so by casting the `Response` as below.
   995  		// Otherwise, remove this line. Only populated after
   996  		// first call to Next(). Not safe for concurrent access.
   997  		_ = it.Response.(*locationpb.ListLocationsResponse)
   998  	}
   999  }
  1000  
  1001  func ExampleMetadataClient_GetIamPolicy() {
  1002  	ctx := context.Background()
  1003  	// This snippet has been automatically generated and should be regarded as a code template only.
  1004  	// It will require modifications to work:
  1005  	// - It may require correct/in-range values for request initialization.
  1006  	// - It may require specifying regional endpoints when creating the service client as shown in:
  1007  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
  1008  	c, err := aiplatform.NewMetadataClient(ctx)
  1009  	if err != nil {
  1010  		// TODO: Handle error.
  1011  	}
  1012  	defer c.Close()
  1013  
  1014  	req := &iampb.GetIamPolicyRequest{
  1015  		// TODO: Fill request struct fields.
  1016  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
  1017  	}
  1018  	resp, err := c.GetIamPolicy(ctx, req)
  1019  	if err != nil {
  1020  		// TODO: Handle error.
  1021  	}
  1022  	// TODO: Use resp.
  1023  	_ = resp
  1024  }
  1025  
  1026  func ExampleMetadataClient_SetIamPolicy() {
  1027  	ctx := context.Background()
  1028  	// This snippet has been automatically generated and should be regarded as a code template only.
  1029  	// It will require modifications to work:
  1030  	// - It may require correct/in-range values for request initialization.
  1031  	// - It may require specifying regional endpoints when creating the service client as shown in:
  1032  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
  1033  	c, err := aiplatform.NewMetadataClient(ctx)
  1034  	if err != nil {
  1035  		// TODO: Handle error.
  1036  	}
  1037  	defer c.Close()
  1038  
  1039  	req := &iampb.SetIamPolicyRequest{
  1040  		// TODO: Fill request struct fields.
  1041  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
  1042  	}
  1043  	resp, err := c.SetIamPolicy(ctx, req)
  1044  	if err != nil {
  1045  		// TODO: Handle error.
  1046  	}
  1047  	// TODO: Use resp.
  1048  	_ = resp
  1049  }
  1050  
  1051  func ExampleMetadataClient_TestIamPermissions() {
  1052  	ctx := context.Background()
  1053  	// This snippet has been automatically generated and should be regarded as a code template only.
  1054  	// It will require modifications to work:
  1055  	// - It may require correct/in-range values for request initialization.
  1056  	// - It may require specifying regional endpoints when creating the service client as shown in:
  1057  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
  1058  	c, err := aiplatform.NewMetadataClient(ctx)
  1059  	if err != nil {
  1060  		// TODO: Handle error.
  1061  	}
  1062  	defer c.Close()
  1063  
  1064  	req := &iampb.TestIamPermissionsRequest{
  1065  		// TODO: Fill request struct fields.
  1066  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
  1067  	}
  1068  	resp, err := c.TestIamPermissions(ctx, req)
  1069  	if err != nil {
  1070  		// TODO: Handle error.
  1071  	}
  1072  	// TODO: Use resp.
  1073  	_ = resp
  1074  }
  1075  
  1076  func ExampleMetadataClient_CancelOperation() {
  1077  	ctx := context.Background()
  1078  	// This snippet has been automatically generated and should be regarded as a code template only.
  1079  	// It will require modifications to work:
  1080  	// - It may require correct/in-range values for request initialization.
  1081  	// - It may require specifying regional endpoints when creating the service client as shown in:
  1082  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
  1083  	c, err := aiplatform.NewMetadataClient(ctx)
  1084  	if err != nil {
  1085  		// TODO: Handle error.
  1086  	}
  1087  	defer c.Close()
  1088  
  1089  	req := &longrunningpb.CancelOperationRequest{
  1090  		// TODO: Fill request struct fields.
  1091  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
  1092  	}
  1093  	err = c.CancelOperation(ctx, req)
  1094  	if err != nil {
  1095  		// TODO: Handle error.
  1096  	}
  1097  }
  1098  
  1099  func ExampleMetadataClient_DeleteOperation() {
  1100  	ctx := context.Background()
  1101  	// This snippet has been automatically generated and should be regarded as a code template only.
  1102  	// It will require modifications to work:
  1103  	// - It may require correct/in-range values for request initialization.
  1104  	// - It may require specifying regional endpoints when creating the service client as shown in:
  1105  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
  1106  	c, err := aiplatform.NewMetadataClient(ctx)
  1107  	if err != nil {
  1108  		// TODO: Handle error.
  1109  	}
  1110  	defer c.Close()
  1111  
  1112  	req := &longrunningpb.DeleteOperationRequest{
  1113  		// TODO: Fill request struct fields.
  1114  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
  1115  	}
  1116  	err = c.DeleteOperation(ctx, req)
  1117  	if err != nil {
  1118  		// TODO: Handle error.
  1119  	}
  1120  }
  1121  
  1122  func ExampleMetadataClient_GetOperation() {
  1123  	ctx := context.Background()
  1124  	// This snippet has been automatically generated and should be regarded as a code template only.
  1125  	// It will require modifications to work:
  1126  	// - It may require correct/in-range values for request initialization.
  1127  	// - It may require specifying regional endpoints when creating the service client as shown in:
  1128  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
  1129  	c, err := aiplatform.NewMetadataClient(ctx)
  1130  	if err != nil {
  1131  		// TODO: Handle error.
  1132  	}
  1133  	defer c.Close()
  1134  
  1135  	req := &longrunningpb.GetOperationRequest{
  1136  		// TODO: Fill request struct fields.
  1137  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
  1138  	}
  1139  	resp, err := c.GetOperation(ctx, req)
  1140  	if err != nil {
  1141  		// TODO: Handle error.
  1142  	}
  1143  	// TODO: Use resp.
  1144  	_ = resp
  1145  }
  1146  
  1147  func ExampleMetadataClient_ListOperations() {
  1148  	ctx := context.Background()
  1149  	// This snippet has been automatically generated and should be regarded as a code template only.
  1150  	// It will require modifications to work:
  1151  	// - It may require correct/in-range values for request initialization.
  1152  	// - It may require specifying regional endpoints when creating the service client as shown in:
  1153  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
  1154  	c, err := aiplatform.NewMetadataClient(ctx)
  1155  	if err != nil {
  1156  		// TODO: Handle error.
  1157  	}
  1158  	defer c.Close()
  1159  
  1160  	req := &longrunningpb.ListOperationsRequest{
  1161  		// TODO: Fill request struct fields.
  1162  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
  1163  	}
  1164  	it := c.ListOperations(ctx, req)
  1165  	for {
  1166  		resp, err := it.Next()
  1167  		if err == iterator.Done {
  1168  			break
  1169  		}
  1170  		if err != nil {
  1171  			// TODO: Handle error.
  1172  		}
  1173  		// TODO: Use resp.
  1174  		_ = resp
  1175  
  1176  		// If you need to access the underlying RPC response,
  1177  		// you can do so by casting the `Response` as below.
  1178  		// Otherwise, remove this line. Only populated after
  1179  		// first call to Next(). Not safe for concurrent access.
  1180  		_ = it.Response.(*longrunningpb.ListOperationsResponse)
  1181  	}
  1182  }
  1183  
  1184  func ExampleMetadataClient_WaitOperation() {
  1185  	ctx := context.Background()
  1186  	// This snippet has been automatically generated and should be regarded as a code template only.
  1187  	// It will require modifications to work:
  1188  	// - It may require correct/in-range values for request initialization.
  1189  	// - It may require specifying regional endpoints when creating the service client as shown in:
  1190  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
  1191  	c, err := aiplatform.NewMetadataClient(ctx)
  1192  	if err != nil {
  1193  		// TODO: Handle error.
  1194  	}
  1195  	defer c.Close()
  1196  
  1197  	req := &longrunningpb.WaitOperationRequest{
  1198  		// TODO: Fill request struct fields.
  1199  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest.
  1200  	}
  1201  	resp, err := c.WaitOperation(ctx, req)
  1202  	if err != nil {
  1203  		// TODO: Handle error.
  1204  	}
  1205  	// TODO: Use resp.
  1206  	_ = resp
  1207  }