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