cloud.google.com/go/aiplatform@v1.106.0/apiv1/notebook_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 ExampleNewNotebookClient() {
    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.NewNotebookClient(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 ExampleNotebookClient_AssignNotebookRuntime() {
    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.NewNotebookClient(ctx)
    55  	if err != nil {
    56  		// TODO: Handle error.
    57  	}
    58  	defer c.Close()
    59  
    60  	req := &aiplatformpb.AssignNotebookRuntimeRequest{
    61  		// TODO: Fill request struct fields.
    62  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#AssignNotebookRuntimeRequest.
    63  	}
    64  	op, err := c.AssignNotebookRuntime(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 ExampleNotebookClient_CreateNotebookExecutionJob() {
    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.NewNotebookClient(ctx)
    85  	if err != nil {
    86  		// TODO: Handle error.
    87  	}
    88  	defer c.Close()
    89  
    90  	req := &aiplatformpb.CreateNotebookExecutionJobRequest{
    91  		// TODO: Fill request struct fields.
    92  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateNotebookExecutionJobRequest.
    93  	}
    94  	op, err := c.CreateNotebookExecutionJob(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 ExampleNotebookClient_CreateNotebookRuntimeTemplate() {
   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.NewNotebookClient(ctx)
   115  	if err != nil {
   116  		// TODO: Handle error.
   117  	}
   118  	defer c.Close()
   119  
   120  	req := &aiplatformpb.CreateNotebookRuntimeTemplateRequest{
   121  		// TODO: Fill request struct fields.
   122  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#CreateNotebookRuntimeTemplateRequest.
   123  	}
   124  	op, err := c.CreateNotebookRuntimeTemplate(ctx, req)
   125  	if err != nil {
   126  		// TODO: Handle error.
   127  	}
   128  
   129  	resp, err := op.Wait(ctx)
   130  	if err != nil {
   131  		// TODO: Handle error.
   132  	}
   133  	// TODO: Use resp.
   134  	_ = resp
   135  }
   136  
   137  func ExampleNotebookClient_DeleteNotebookExecutionJob() {
   138  	ctx := context.Background()
   139  	// This snippet has been automatically generated and should be regarded as a code template only.
   140  	// It will require modifications to work:
   141  	// - It may require correct/in-range values for request initialization.
   142  	// - It may require specifying regional endpoints when creating the service client as shown in:
   143  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   144  	c, err := aiplatform.NewNotebookClient(ctx)
   145  	if err != nil {
   146  		// TODO: Handle error.
   147  	}
   148  	defer c.Close()
   149  
   150  	req := &aiplatformpb.DeleteNotebookExecutionJobRequest{
   151  		// TODO: Fill request struct fields.
   152  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteNotebookExecutionJobRequest.
   153  	}
   154  	op, err := c.DeleteNotebookExecutionJob(ctx, req)
   155  	if err != nil {
   156  		// TODO: Handle error.
   157  	}
   158  
   159  	err = op.Wait(ctx)
   160  	if err != nil {
   161  		// TODO: Handle error.
   162  	}
   163  }
   164  
   165  func ExampleNotebookClient_DeleteNotebookRuntime() {
   166  	ctx := context.Background()
   167  	// This snippet has been automatically generated and should be regarded as a code template only.
   168  	// It will require modifications to work:
   169  	// - It may require correct/in-range values for request initialization.
   170  	// - It may require specifying regional endpoints when creating the service client as shown in:
   171  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   172  	c, err := aiplatform.NewNotebookClient(ctx)
   173  	if err != nil {
   174  		// TODO: Handle error.
   175  	}
   176  	defer c.Close()
   177  
   178  	req := &aiplatformpb.DeleteNotebookRuntimeRequest{
   179  		// TODO: Fill request struct fields.
   180  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteNotebookRuntimeRequest.
   181  	}
   182  	op, err := c.DeleteNotebookRuntime(ctx, req)
   183  	if err != nil {
   184  		// TODO: Handle error.
   185  	}
   186  
   187  	err = op.Wait(ctx)
   188  	if err != nil {
   189  		// TODO: Handle error.
   190  	}
   191  }
   192  
   193  func ExampleNotebookClient_DeleteNotebookRuntimeTemplate() {
   194  	ctx := context.Background()
   195  	// This snippet has been automatically generated and should be regarded as a code template only.
   196  	// It will require modifications to work:
   197  	// - It may require correct/in-range values for request initialization.
   198  	// - It may require specifying regional endpoints when creating the service client as shown in:
   199  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   200  	c, err := aiplatform.NewNotebookClient(ctx)
   201  	if err != nil {
   202  		// TODO: Handle error.
   203  	}
   204  	defer c.Close()
   205  
   206  	req := &aiplatformpb.DeleteNotebookRuntimeTemplateRequest{
   207  		// TODO: Fill request struct fields.
   208  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#DeleteNotebookRuntimeTemplateRequest.
   209  	}
   210  	op, err := c.DeleteNotebookRuntimeTemplate(ctx, req)
   211  	if err != nil {
   212  		// TODO: Handle error.
   213  	}
   214  
   215  	err = op.Wait(ctx)
   216  	if err != nil {
   217  		// TODO: Handle error.
   218  	}
   219  }
   220  
   221  func ExampleNotebookClient_GetNotebookExecutionJob() {
   222  	ctx := context.Background()
   223  	// This snippet has been automatically generated and should be regarded as a code template only.
   224  	// It will require modifications to work:
   225  	// - It may require correct/in-range values for request initialization.
   226  	// - It may require specifying regional endpoints when creating the service client as shown in:
   227  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   228  	c, err := aiplatform.NewNotebookClient(ctx)
   229  	if err != nil {
   230  		// TODO: Handle error.
   231  	}
   232  	defer c.Close()
   233  
   234  	req := &aiplatformpb.GetNotebookExecutionJobRequest{
   235  		// TODO: Fill request struct fields.
   236  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetNotebookExecutionJobRequest.
   237  	}
   238  	resp, err := c.GetNotebookExecutionJob(ctx, req)
   239  	if err != nil {
   240  		// TODO: Handle error.
   241  	}
   242  	// TODO: Use resp.
   243  	_ = resp
   244  }
   245  
   246  func ExampleNotebookClient_GetNotebookRuntime() {
   247  	ctx := context.Background()
   248  	// This snippet has been automatically generated and should be regarded as a code template only.
   249  	// It will require modifications to work:
   250  	// - It may require correct/in-range values for request initialization.
   251  	// - It may require specifying regional endpoints when creating the service client as shown in:
   252  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   253  	c, err := aiplatform.NewNotebookClient(ctx)
   254  	if err != nil {
   255  		// TODO: Handle error.
   256  	}
   257  	defer c.Close()
   258  
   259  	req := &aiplatformpb.GetNotebookRuntimeRequest{
   260  		// TODO: Fill request struct fields.
   261  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetNotebookRuntimeRequest.
   262  	}
   263  	resp, err := c.GetNotebookRuntime(ctx, req)
   264  	if err != nil {
   265  		// TODO: Handle error.
   266  	}
   267  	// TODO: Use resp.
   268  	_ = resp
   269  }
   270  
   271  func ExampleNotebookClient_GetNotebookRuntimeTemplate() {
   272  	ctx := context.Background()
   273  	// This snippet has been automatically generated and should be regarded as a code template only.
   274  	// It will require modifications to work:
   275  	// - It may require correct/in-range values for request initialization.
   276  	// - It may require specifying regional endpoints when creating the service client as shown in:
   277  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   278  	c, err := aiplatform.NewNotebookClient(ctx)
   279  	if err != nil {
   280  		// TODO: Handle error.
   281  	}
   282  	defer c.Close()
   283  
   284  	req := &aiplatformpb.GetNotebookRuntimeTemplateRequest{
   285  		// TODO: Fill request struct fields.
   286  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#GetNotebookRuntimeTemplateRequest.
   287  	}
   288  	resp, err := c.GetNotebookRuntimeTemplate(ctx, req)
   289  	if err != nil {
   290  		// TODO: Handle error.
   291  	}
   292  	// TODO: Use resp.
   293  	_ = resp
   294  }
   295  
   296  func ExampleNotebookClient_ListNotebookExecutionJobs() {
   297  	ctx := context.Background()
   298  	// This snippet has been automatically generated and should be regarded as a code template only.
   299  	// It will require modifications to work:
   300  	// - It may require correct/in-range values for request initialization.
   301  	// - It may require specifying regional endpoints when creating the service client as shown in:
   302  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   303  	c, err := aiplatform.NewNotebookClient(ctx)
   304  	if err != nil {
   305  		// TODO: Handle error.
   306  	}
   307  	defer c.Close()
   308  
   309  	req := &aiplatformpb.ListNotebookExecutionJobsRequest{
   310  		// TODO: Fill request struct fields.
   311  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListNotebookExecutionJobsRequest.
   312  	}
   313  	it := c.ListNotebookExecutionJobs(ctx, req)
   314  	for {
   315  		resp, err := it.Next()
   316  		if err == iterator.Done {
   317  			break
   318  		}
   319  		if err != nil {
   320  			// TODO: Handle error.
   321  		}
   322  		// TODO: Use resp.
   323  		_ = resp
   324  
   325  		// If you need to access the underlying RPC response,
   326  		// you can do so by casting the `Response` as below.
   327  		// Otherwise, remove this line. Only populated after
   328  		// first call to Next(). Not safe for concurrent access.
   329  		_ = it.Response.(*aiplatformpb.ListNotebookExecutionJobsResponse)
   330  	}
   331  }
   332  
   333  func ExampleNotebookClient_ListNotebookRuntimeTemplates() {
   334  	ctx := context.Background()
   335  	// This snippet has been automatically generated and should be regarded as a code template only.
   336  	// It will require modifications to work:
   337  	// - It may require correct/in-range values for request initialization.
   338  	// - It may require specifying regional endpoints when creating the service client as shown in:
   339  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   340  	c, err := aiplatform.NewNotebookClient(ctx)
   341  	if err != nil {
   342  		// TODO: Handle error.
   343  	}
   344  	defer c.Close()
   345  
   346  	req := &aiplatformpb.ListNotebookRuntimeTemplatesRequest{
   347  		// TODO: Fill request struct fields.
   348  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListNotebookRuntimeTemplatesRequest.
   349  	}
   350  	it := c.ListNotebookRuntimeTemplates(ctx, req)
   351  	for {
   352  		resp, err := it.Next()
   353  		if err == iterator.Done {
   354  			break
   355  		}
   356  		if err != nil {
   357  			// TODO: Handle error.
   358  		}
   359  		// TODO: Use resp.
   360  		_ = resp
   361  
   362  		// If you need to access the underlying RPC response,
   363  		// you can do so by casting the `Response` as below.
   364  		// Otherwise, remove this line. Only populated after
   365  		// first call to Next(). Not safe for concurrent access.
   366  		_ = it.Response.(*aiplatformpb.ListNotebookRuntimeTemplatesResponse)
   367  	}
   368  }
   369  
   370  func ExampleNotebookClient_ListNotebookRuntimes() {
   371  	ctx := context.Background()
   372  	// This snippet has been automatically generated and should be regarded as a code template only.
   373  	// It will require modifications to work:
   374  	// - It may require correct/in-range values for request initialization.
   375  	// - It may require specifying regional endpoints when creating the service client as shown in:
   376  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   377  	c, err := aiplatform.NewNotebookClient(ctx)
   378  	if err != nil {
   379  		// TODO: Handle error.
   380  	}
   381  	defer c.Close()
   382  
   383  	req := &aiplatformpb.ListNotebookRuntimesRequest{
   384  		// TODO: Fill request struct fields.
   385  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#ListNotebookRuntimesRequest.
   386  	}
   387  	it := c.ListNotebookRuntimes(ctx, req)
   388  	for {
   389  		resp, err := it.Next()
   390  		if err == iterator.Done {
   391  			break
   392  		}
   393  		if err != nil {
   394  			// TODO: Handle error.
   395  		}
   396  		// TODO: Use resp.
   397  		_ = resp
   398  
   399  		// If you need to access the underlying RPC response,
   400  		// you can do so by casting the `Response` as below.
   401  		// Otherwise, remove this line. Only populated after
   402  		// first call to Next(). Not safe for concurrent access.
   403  		_ = it.Response.(*aiplatformpb.ListNotebookRuntimesResponse)
   404  	}
   405  }
   406  
   407  func ExampleNotebookClient_StartNotebookRuntime() {
   408  	ctx := context.Background()
   409  	// This snippet has been automatically generated and should be regarded as a code template only.
   410  	// It will require modifications to work:
   411  	// - It may require correct/in-range values for request initialization.
   412  	// - It may require specifying regional endpoints when creating the service client as shown in:
   413  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   414  	c, err := aiplatform.NewNotebookClient(ctx)
   415  	if err != nil {
   416  		// TODO: Handle error.
   417  	}
   418  	defer c.Close()
   419  
   420  	req := &aiplatformpb.StartNotebookRuntimeRequest{
   421  		// TODO: Fill request struct fields.
   422  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#StartNotebookRuntimeRequest.
   423  	}
   424  	op, err := c.StartNotebookRuntime(ctx, req)
   425  	if err != nil {
   426  		// TODO: Handle error.
   427  	}
   428  
   429  	resp, err := op.Wait(ctx)
   430  	if err != nil {
   431  		// TODO: Handle error.
   432  	}
   433  	// TODO: Use resp.
   434  	_ = resp
   435  }
   436  
   437  func ExampleNotebookClient_StopNotebookRuntime() {
   438  	ctx := context.Background()
   439  	// This snippet has been automatically generated and should be regarded as a code template only.
   440  	// It will require modifications to work:
   441  	// - It may require correct/in-range values for request initialization.
   442  	// - It may require specifying regional endpoints when creating the service client as shown in:
   443  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   444  	c, err := aiplatform.NewNotebookClient(ctx)
   445  	if err != nil {
   446  		// TODO: Handle error.
   447  	}
   448  	defer c.Close()
   449  
   450  	req := &aiplatformpb.StopNotebookRuntimeRequest{
   451  		// TODO: Fill request struct fields.
   452  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#StopNotebookRuntimeRequest.
   453  	}
   454  	op, err := c.StopNotebookRuntime(ctx, req)
   455  	if err != nil {
   456  		// TODO: Handle error.
   457  	}
   458  
   459  	resp, err := op.Wait(ctx)
   460  	if err != nil {
   461  		// TODO: Handle error.
   462  	}
   463  	// TODO: Use resp.
   464  	_ = resp
   465  }
   466  
   467  func ExampleNotebookClient_UpdateNotebookRuntimeTemplate() {
   468  	ctx := context.Background()
   469  	// This snippet has been automatically generated and should be regarded as a code template only.
   470  	// It will require modifications to work:
   471  	// - It may require correct/in-range values for request initialization.
   472  	// - It may require specifying regional endpoints when creating the service client as shown in:
   473  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   474  	c, err := aiplatform.NewNotebookClient(ctx)
   475  	if err != nil {
   476  		// TODO: Handle error.
   477  	}
   478  	defer c.Close()
   479  
   480  	req := &aiplatformpb.UpdateNotebookRuntimeTemplateRequest{
   481  		// TODO: Fill request struct fields.
   482  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#UpdateNotebookRuntimeTemplateRequest.
   483  	}
   484  	resp, err := c.UpdateNotebookRuntimeTemplate(ctx, req)
   485  	if err != nil {
   486  		// TODO: Handle error.
   487  	}
   488  	// TODO: Use resp.
   489  	_ = resp
   490  }
   491  
   492  func ExampleNotebookClient_UpgradeNotebookRuntime() {
   493  	ctx := context.Background()
   494  	// This snippet has been automatically generated and should be regarded as a code template only.
   495  	// It will require modifications to work:
   496  	// - It may require correct/in-range values for request initialization.
   497  	// - It may require specifying regional endpoints when creating the service client as shown in:
   498  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   499  	c, err := aiplatform.NewNotebookClient(ctx)
   500  	if err != nil {
   501  		// TODO: Handle error.
   502  	}
   503  	defer c.Close()
   504  
   505  	req := &aiplatformpb.UpgradeNotebookRuntimeRequest{
   506  		// TODO: Fill request struct fields.
   507  		// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1/aiplatformpb#UpgradeNotebookRuntimeRequest.
   508  	}
   509  	op, err := c.UpgradeNotebookRuntime(ctx, req)
   510  	if err != nil {
   511  		// TODO: Handle error.
   512  	}
   513  
   514  	resp, err := op.Wait(ctx)
   515  	if err != nil {
   516  		// TODO: Handle error.
   517  	}
   518  	// TODO: Use resp.
   519  	_ = resp
   520  }
   521  
   522  func ExampleNotebookClient_GetLocation() {
   523  	ctx := context.Background()
   524  	// This snippet has been automatically generated and should be regarded as a code template only.
   525  	// It will require modifications to work:
   526  	// - It may require correct/in-range values for request initialization.
   527  	// - It may require specifying regional endpoints when creating the service client as shown in:
   528  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   529  	c, err := aiplatform.NewNotebookClient(ctx)
   530  	if err != nil {
   531  		// TODO: Handle error.
   532  	}
   533  	defer c.Close()
   534  
   535  	req := &locationpb.GetLocationRequest{
   536  		// TODO: Fill request struct fields.
   537  		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
   538  	}
   539  	resp, err := c.GetLocation(ctx, req)
   540  	if err != nil {
   541  		// TODO: Handle error.
   542  	}
   543  	// TODO: Use resp.
   544  	_ = resp
   545  }
   546  
   547  func ExampleNotebookClient_ListLocations() {
   548  	ctx := context.Background()
   549  	// This snippet has been automatically generated and should be regarded as a code template only.
   550  	// It will require modifications to work:
   551  	// - It may require correct/in-range values for request initialization.
   552  	// - It may require specifying regional endpoints when creating the service client as shown in:
   553  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   554  	c, err := aiplatform.NewNotebookClient(ctx)
   555  	if err != nil {
   556  		// TODO: Handle error.
   557  	}
   558  	defer c.Close()
   559  
   560  	req := &locationpb.ListLocationsRequest{
   561  		// TODO: Fill request struct fields.
   562  		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
   563  	}
   564  	it := c.ListLocations(ctx, req)
   565  	for {
   566  		resp, err := it.Next()
   567  		if err == iterator.Done {
   568  			break
   569  		}
   570  		if err != nil {
   571  			// TODO: Handle error.
   572  		}
   573  		// TODO: Use resp.
   574  		_ = resp
   575  
   576  		// If you need to access the underlying RPC response,
   577  		// you can do so by casting the `Response` as below.
   578  		// Otherwise, remove this line. Only populated after
   579  		// first call to Next(). Not safe for concurrent access.
   580  		_ = it.Response.(*locationpb.ListLocationsResponse)
   581  	}
   582  }
   583  
   584  func ExampleNotebookClient_GetIamPolicy() {
   585  	ctx := context.Background()
   586  	// This snippet has been automatically generated and should be regarded as a code template only.
   587  	// It will require modifications to work:
   588  	// - It may require correct/in-range values for request initialization.
   589  	// - It may require specifying regional endpoints when creating the service client as shown in:
   590  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   591  	c, err := aiplatform.NewNotebookClient(ctx)
   592  	if err != nil {
   593  		// TODO: Handle error.
   594  	}
   595  	defer c.Close()
   596  
   597  	req := &iampb.GetIamPolicyRequest{
   598  		// TODO: Fill request struct fields.
   599  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
   600  	}
   601  	resp, err := c.GetIamPolicy(ctx, req)
   602  	if err != nil {
   603  		// TODO: Handle error.
   604  	}
   605  	// TODO: Use resp.
   606  	_ = resp
   607  }
   608  
   609  func ExampleNotebookClient_SetIamPolicy() {
   610  	ctx := context.Background()
   611  	// This snippet has been automatically generated and should be regarded as a code template only.
   612  	// It will require modifications to work:
   613  	// - It may require correct/in-range values for request initialization.
   614  	// - It may require specifying regional endpoints when creating the service client as shown in:
   615  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   616  	c, err := aiplatform.NewNotebookClient(ctx)
   617  	if err != nil {
   618  		// TODO: Handle error.
   619  	}
   620  	defer c.Close()
   621  
   622  	req := &iampb.SetIamPolicyRequest{
   623  		// TODO: Fill request struct fields.
   624  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
   625  	}
   626  	resp, err := c.SetIamPolicy(ctx, req)
   627  	if err != nil {
   628  		// TODO: Handle error.
   629  	}
   630  	// TODO: Use resp.
   631  	_ = resp
   632  }
   633  
   634  func ExampleNotebookClient_TestIamPermissions() {
   635  	ctx := context.Background()
   636  	// This snippet has been automatically generated and should be regarded as a code template only.
   637  	// It will require modifications to work:
   638  	// - It may require correct/in-range values for request initialization.
   639  	// - It may require specifying regional endpoints when creating the service client as shown in:
   640  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   641  	c, err := aiplatform.NewNotebookClient(ctx)
   642  	if err != nil {
   643  		// TODO: Handle error.
   644  	}
   645  	defer c.Close()
   646  
   647  	req := &iampb.TestIamPermissionsRequest{
   648  		// TODO: Fill request struct fields.
   649  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
   650  	}
   651  	resp, err := c.TestIamPermissions(ctx, req)
   652  	if err != nil {
   653  		// TODO: Handle error.
   654  	}
   655  	// TODO: Use resp.
   656  	_ = resp
   657  }
   658  
   659  func ExampleNotebookClient_CancelOperation() {
   660  	ctx := context.Background()
   661  	// This snippet has been automatically generated and should be regarded as a code template only.
   662  	// It will require modifications to work:
   663  	// - It may require correct/in-range values for request initialization.
   664  	// - It may require specifying regional endpoints when creating the service client as shown in:
   665  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   666  	c, err := aiplatform.NewNotebookClient(ctx)
   667  	if err != nil {
   668  		// TODO: Handle error.
   669  	}
   670  	defer c.Close()
   671  
   672  	req := &longrunningpb.CancelOperationRequest{
   673  		// TODO: Fill request struct fields.
   674  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
   675  	}
   676  	err = c.CancelOperation(ctx, req)
   677  	if err != nil {
   678  		// TODO: Handle error.
   679  	}
   680  }
   681  
   682  func ExampleNotebookClient_DeleteOperation() {
   683  	ctx := context.Background()
   684  	// This snippet has been automatically generated and should be regarded as a code template only.
   685  	// It will require modifications to work:
   686  	// - It may require correct/in-range values for request initialization.
   687  	// - It may require specifying regional endpoints when creating the service client as shown in:
   688  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   689  	c, err := aiplatform.NewNotebookClient(ctx)
   690  	if err != nil {
   691  		// TODO: Handle error.
   692  	}
   693  	defer c.Close()
   694  
   695  	req := &longrunningpb.DeleteOperationRequest{
   696  		// TODO: Fill request struct fields.
   697  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
   698  	}
   699  	err = c.DeleteOperation(ctx, req)
   700  	if err != nil {
   701  		// TODO: Handle error.
   702  	}
   703  }
   704  
   705  func ExampleNotebookClient_GetOperation() {
   706  	ctx := context.Background()
   707  	// This snippet has been automatically generated and should be regarded as a code template only.
   708  	// It will require modifications to work:
   709  	// - It may require correct/in-range values for request initialization.
   710  	// - It may require specifying regional endpoints when creating the service client as shown in:
   711  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   712  	c, err := aiplatform.NewNotebookClient(ctx)
   713  	if err != nil {
   714  		// TODO: Handle error.
   715  	}
   716  	defer c.Close()
   717  
   718  	req := &longrunningpb.GetOperationRequest{
   719  		// TODO: Fill request struct fields.
   720  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
   721  	}
   722  	resp, err := c.GetOperation(ctx, req)
   723  	if err != nil {
   724  		// TODO: Handle error.
   725  	}
   726  	// TODO: Use resp.
   727  	_ = resp
   728  }
   729  
   730  func ExampleNotebookClient_ListOperations() {
   731  	ctx := context.Background()
   732  	// This snippet has been automatically generated and should be regarded as a code template only.
   733  	// It will require modifications to work:
   734  	// - It may require correct/in-range values for request initialization.
   735  	// - It may require specifying regional endpoints when creating the service client as shown in:
   736  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   737  	c, err := aiplatform.NewNotebookClient(ctx)
   738  	if err != nil {
   739  		// TODO: Handle error.
   740  	}
   741  	defer c.Close()
   742  
   743  	req := &longrunningpb.ListOperationsRequest{
   744  		// TODO: Fill request struct fields.
   745  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
   746  	}
   747  	it := c.ListOperations(ctx, req)
   748  	for {
   749  		resp, err := it.Next()
   750  		if err == iterator.Done {
   751  			break
   752  		}
   753  		if err != nil {
   754  			// TODO: Handle error.
   755  		}
   756  		// TODO: Use resp.
   757  		_ = resp
   758  
   759  		// If you need to access the underlying RPC response,
   760  		// you can do so by casting the `Response` as below.
   761  		// Otherwise, remove this line. Only populated after
   762  		// first call to Next(). Not safe for concurrent access.
   763  		_ = it.Response.(*longrunningpb.ListOperationsResponse)
   764  	}
   765  }
   766  
   767  func ExampleNotebookClient_WaitOperation() {
   768  	ctx := context.Background()
   769  	// This snippet has been automatically generated and should be regarded as a code template only.
   770  	// It will require modifications to work:
   771  	// - It may require correct/in-range values for request initialization.
   772  	// - It may require specifying regional endpoints when creating the service client as shown in:
   773  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   774  	c, err := aiplatform.NewNotebookClient(ctx)
   775  	if err != nil {
   776  		// TODO: Handle error.
   777  	}
   778  	defer c.Close()
   779  
   780  	req := &longrunningpb.WaitOperationRequest{
   781  		// TODO: Fill request struct fields.
   782  		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest.
   783  	}
   784  	resp, err := c.WaitOperation(ctx, req)
   785  	if err != nil {
   786  		// TODO: Handle error.
   787  	}
   788  	// TODO: Use resp.
   789  	_ = resp
   790  }