Class ManagedNotebookServiceClient (1.3.0)

public class ManagedNotebookServiceClient implements BackgroundResource

Service Description: API v1 service for Managed Notebooks.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   RuntimeName name = RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]");
   Runtime response = managedNotebookServiceClient.getRuntime(name);
 }
 

Note: close() needs to be called on the ManagedNotebookServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of ManagedNotebookServiceSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ManagedNotebookServiceSettings managedNotebookServiceSettings =
     ManagedNotebookServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create(managedNotebookServiceSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ManagedNotebookServiceSettings managedNotebookServiceSettings =
     ManagedNotebookServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create(managedNotebookServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > ManagedNotebookServiceClient

Implements

BackgroundResource

Static Methods

create()

public static final ManagedNotebookServiceClient create()

Constructs an instance of ManagedNotebookServiceClient with default settings.

Returns
Type Description
ManagedNotebookServiceClient
Exceptions
Type Description
IOException

create(ManagedNotebookServiceSettings settings)

public static final ManagedNotebookServiceClient create(ManagedNotebookServiceSettings settings)

Constructs an instance of ManagedNotebookServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings ManagedNotebookServiceSettings
Returns
Type Description
ManagedNotebookServiceClient
Exceptions
Type Description
IOException

create(ManagedNotebookServiceStub stub)

public static final ManagedNotebookServiceClient create(ManagedNotebookServiceStub stub)

Constructs an instance of ManagedNotebookServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ManagedNotebookServiceSettings).

Parameter
Name Description
stub ManagedNotebookServiceStub
Returns
Type Description
ManagedNotebookServiceClient

Constructors

ManagedNotebookServiceClient(ManagedNotebookServiceSettings settings)

protected ManagedNotebookServiceClient(ManagedNotebookServiceSettings settings)

Constructs an instance of ManagedNotebookServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
Name Description
settings ManagedNotebookServiceSettings

ManagedNotebookServiceClient(ManagedNotebookServiceStub stub)

protected ManagedNotebookServiceClient(ManagedNotebookServiceStub stub)
Parameter
Name Description
stub ManagedNotebookServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

createRuntimeAsync(CreateRuntimeRequest request)

public final OperationFuture<Runtime,OperationMetadata> createRuntimeAsync(CreateRuntimeRequest request)

Creates a new Runtime in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   CreateRuntimeRequest request =
       CreateRuntimeRequest.newBuilder()
           .setParent(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
           .setRuntimeId("runtimeId121455379")
           .setRuntime(Runtime.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Runtime response = managedNotebookServiceClient.createRuntimeAsync(request).get();
 }
 
Parameter
Name Description
request CreateRuntimeRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Runtime,OperationMetadata>

createRuntimeAsync(RuntimeName parent, String runtimeId, Runtime runtime)

public final OperationFuture<Runtime,OperationMetadata> createRuntimeAsync(RuntimeName parent, String runtimeId, Runtime runtime)

Creates a new Runtime in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   RuntimeName parent = RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]");
   String runtimeId = "runtimeId121455379";
   Runtime runtime = Runtime.newBuilder().build();
   Runtime response =
       managedNotebookServiceClient.createRuntimeAsync(parent, runtimeId, runtime).get();
 }
 
Parameters
Name Description
parent RuntimeName

Required. Format: parent=projects/{project_id}/locations/{location}

runtimeId String

Required. User-defined unique ID of this Runtime.

runtime Runtime

Required. The Runtime to be created.

Returns
Type Description
OperationFuture<Runtime,OperationMetadata>

createRuntimeAsync(String parent, String runtimeId, Runtime runtime)

public final OperationFuture<Runtime,OperationMetadata> createRuntimeAsync(String parent, String runtimeId, Runtime runtime)

Creates a new Runtime in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   String parent = RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString();
   String runtimeId = "runtimeId121455379";
   Runtime runtime = Runtime.newBuilder().build();
   Runtime response =
       managedNotebookServiceClient.createRuntimeAsync(parent, runtimeId, runtime).get();
 }
 
Parameters
Name Description
parent String

Required. Format: parent=projects/{project_id}/locations/{location}

runtimeId String

Required. User-defined unique ID of this Runtime.

runtime Runtime

Required. The Runtime to be created.

Returns
Type Description
OperationFuture<Runtime,OperationMetadata>

createRuntimeCallable()

public final UnaryCallable<CreateRuntimeRequest,Operation> createRuntimeCallable()

Creates a new Runtime in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   CreateRuntimeRequest request =
       CreateRuntimeRequest.newBuilder()
           .setParent(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
           .setRuntimeId("runtimeId121455379")
           .setRuntime(Runtime.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       managedNotebookServiceClient.createRuntimeCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateRuntimeRequest,Operation>

createRuntimeOperationCallable()

public final OperationCallable<CreateRuntimeRequest,Runtime,OperationMetadata> createRuntimeOperationCallable()

Creates a new Runtime in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   CreateRuntimeRequest request =
       CreateRuntimeRequest.newBuilder()
           .setParent(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
           .setRuntimeId("runtimeId121455379")
           .setRuntime(Runtime.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Runtime, OperationMetadata> future =
       managedNotebookServiceClient.createRuntimeOperationCallable().futureCall(request);
   // Do something.
   Runtime response = future.get();
 }
 
Returns
Type Description
OperationCallable<CreateRuntimeRequest,Runtime,OperationMetadata>

deleteRuntimeAsync(DeleteRuntimeRequest request)

public final OperationFuture<Empty,OperationMetadata> deleteRuntimeAsync(DeleteRuntimeRequest request)

Deletes a single Runtime.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   DeleteRuntimeRequest request =
       DeleteRuntimeRequest.newBuilder()
           .setName(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
           .setRequestId("requestId693933066")
           .build();
   managedNotebookServiceClient.deleteRuntimeAsync(request).get();
 }
 
Parameter
Name Description
request DeleteRuntimeRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteRuntimeAsync(RuntimeName name)

public final OperationFuture<Empty,OperationMetadata> deleteRuntimeAsync(RuntimeName name)

Deletes a single Runtime.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   RuntimeName name = RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]");
   managedNotebookServiceClient.deleteRuntimeAsync(name).get();
 }
 
Parameter
Name Description
name RuntimeName

Required. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteRuntimeAsync(String name)

public final OperationFuture<Empty,OperationMetadata> deleteRuntimeAsync(String name)

Deletes a single Runtime.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   String name = RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString();
   managedNotebookServiceClient.deleteRuntimeAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteRuntimeCallable()

public final UnaryCallable<DeleteRuntimeRequest,Operation> deleteRuntimeCallable()

Deletes a single Runtime.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   DeleteRuntimeRequest request =
       DeleteRuntimeRequest.newBuilder()
           .setName(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       managedNotebookServiceClient.deleteRuntimeCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteRuntimeRequest,Operation>

deleteRuntimeOperationCallable()

public final OperationCallable<DeleteRuntimeRequest,Empty,OperationMetadata> deleteRuntimeOperationCallable()

Deletes a single Runtime.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   DeleteRuntimeRequest request =
       DeleteRuntimeRequest.newBuilder()
           .setName(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Empty, OperationMetadata> future =
       managedNotebookServiceClient.deleteRuntimeOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
OperationCallable<DeleteRuntimeRequest,Empty,OperationMetadata>

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getRuntime(GetRuntimeRequest request)

public final Runtime getRuntime(GetRuntimeRequest request)

Gets details of a single Runtime. The location must be a regional endpoint rather than zonal.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   GetRuntimeRequest request =
       GetRuntimeRequest.newBuilder()
           .setName(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
           .build();
   Runtime response = managedNotebookServiceClient.getRuntime(request);
 }
 
Parameter
Name Description
request GetRuntimeRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Runtime

getRuntime(RuntimeName name)

public final Runtime getRuntime(RuntimeName name)

Gets details of a single Runtime. The location must be a regional endpoint rather than zonal.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   RuntimeName name = RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]");
   Runtime response = managedNotebookServiceClient.getRuntime(name);
 }
 
Parameter
Name Description
name RuntimeName

Required. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}

Returns
Type Description
Runtime

getRuntime(String name)

public final Runtime getRuntime(String name)

Gets details of a single Runtime. The location must be a regional endpoint rather than zonal.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   String name = RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString();
   Runtime response = managedNotebookServiceClient.getRuntime(name);
 }
 
Parameter
Name Description
name String

Required. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}

Returns
Type Description
Runtime

getRuntimeCallable()

public final UnaryCallable<GetRuntimeRequest,Runtime> getRuntimeCallable()

Gets details of a single Runtime. The location must be a regional endpoint rather than zonal.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   GetRuntimeRequest request =
       GetRuntimeRequest.newBuilder()
           .setName(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
           .build();
   ApiFuture<Runtime> future =
       managedNotebookServiceClient.getRuntimeCallable().futureCall(request);
   // Do something.
   Runtime response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetRuntimeRequest,Runtime>

getSettings()

public final ManagedNotebookServiceSettings getSettings()
Returns
Type Description
ManagedNotebookServiceSettings

getStub()

public ManagedNotebookServiceStub getStub()
Returns
Type Description
ManagedNotebookServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listRuntimes(ListRuntimesRequest request)

public final ManagedNotebookServiceClient.ListRuntimesPagedResponse listRuntimes(ListRuntimesRequest request)

Lists Runtimes in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   ListRuntimesRequest request =
       ListRuntimesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Runtime element : managedNotebookServiceClient.listRuntimes(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListRuntimesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ManagedNotebookServiceClient.ListRuntimesPagedResponse

listRuntimes(LocationName parent)

public final ManagedNotebookServiceClient.ListRuntimesPagedResponse listRuntimes(LocationName parent)

Lists Runtimes in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (Runtime element : managedNotebookServiceClient.listRuntimes(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent LocationName

Required. Format: parent=projects/{project_id}/locations/{location}

Returns
Type Description
ManagedNotebookServiceClient.ListRuntimesPagedResponse

listRuntimes(String parent)

public final ManagedNotebookServiceClient.ListRuntimesPagedResponse listRuntimes(String parent)

Lists Runtimes in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (Runtime element : managedNotebookServiceClient.listRuntimes(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. Format: parent=projects/{project_id}/locations/{location}

Returns
Type Description
ManagedNotebookServiceClient.ListRuntimesPagedResponse

listRuntimesCallable()

public final UnaryCallable<ListRuntimesRequest,ListRuntimesResponse> listRuntimesCallable()

Lists Runtimes in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   ListRuntimesRequest request =
       ListRuntimesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListRuntimesResponse response =
         managedNotebookServiceClient.listRuntimesCallable().call(request);
     for (Runtime element : response.getRuntimesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListRuntimesRequest,ListRuntimesResponse>

listRuntimesPagedCallable()

public final UnaryCallable<ListRuntimesRequest,ManagedNotebookServiceClient.ListRuntimesPagedResponse> listRuntimesPagedCallable()

Lists Runtimes in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   ListRuntimesRequest request =
       ListRuntimesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Runtime> future =
       managedNotebookServiceClient.listRuntimesPagedCallable().futureCall(request);
   // Do something.
   for (Runtime element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListRuntimesRequest,ListRuntimesPagedResponse>

refreshRuntimeTokenInternal(RefreshRuntimeTokenInternalRequest request)

public final RefreshRuntimeTokenInternalResponse refreshRuntimeTokenInternal(RefreshRuntimeTokenInternalRequest request)

Gets an access token for the consumer service account that the customer attached to the runtime. Only accessible from the tenant instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   RefreshRuntimeTokenInternalRequest request =
       RefreshRuntimeTokenInternalRequest.newBuilder()
           .setName(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
           .setVmId("vmId3622450")
           .build();
   RefreshRuntimeTokenInternalResponse response =
       managedNotebookServiceClient.refreshRuntimeTokenInternal(request);
 }
 
Parameter
Name Description
request RefreshRuntimeTokenInternalRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
RefreshRuntimeTokenInternalResponse

refreshRuntimeTokenInternal(RuntimeName name, String vmId)

public final RefreshRuntimeTokenInternalResponse refreshRuntimeTokenInternal(RuntimeName name, String vmId)

Gets an access token for the consumer service account that the customer attached to the runtime. Only accessible from the tenant instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   RuntimeName name = RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]");
   String vmId = "vmId3622450";
   RefreshRuntimeTokenInternalResponse response =
       managedNotebookServiceClient.refreshRuntimeTokenInternal(name, vmId);
 }
 
Parameters
Name Description
name RuntimeName

Required. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}

vmId String

Required. The VM hardware token for authenticating the VM. https://cloud.google.com/compute/docs/instances/verifying-instance-identity

Returns
Type Description
RefreshRuntimeTokenInternalResponse

refreshRuntimeTokenInternal(String name, String vmId)

public final RefreshRuntimeTokenInternalResponse refreshRuntimeTokenInternal(String name, String vmId)

Gets an access token for the consumer service account that the customer attached to the runtime. Only accessible from the tenant instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   String name = RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString();
   String vmId = "vmId3622450";
   RefreshRuntimeTokenInternalResponse response =
       managedNotebookServiceClient.refreshRuntimeTokenInternal(name, vmId);
 }
 
Parameters
Name Description
name String

Required. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}

vmId String

Required. The VM hardware token for authenticating the VM. https://cloud.google.com/compute/docs/instances/verifying-instance-identity

Returns
Type Description
RefreshRuntimeTokenInternalResponse

refreshRuntimeTokenInternalCallable()

public final UnaryCallable<RefreshRuntimeTokenInternalRequest,RefreshRuntimeTokenInternalResponse> refreshRuntimeTokenInternalCallable()

Gets an access token for the consumer service account that the customer attached to the runtime. Only accessible from the tenant instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   RefreshRuntimeTokenInternalRequest request =
       RefreshRuntimeTokenInternalRequest.newBuilder()
           .setName(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
           .setVmId("vmId3622450")
           .build();
   ApiFuture<RefreshRuntimeTokenInternalResponse> future =
       managedNotebookServiceClient.refreshRuntimeTokenInternalCallable().futureCall(request);
   // Do something.
   RefreshRuntimeTokenInternalResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<RefreshRuntimeTokenInternalRequest,RefreshRuntimeTokenInternalResponse>

reportRuntimeEventAsync(ReportRuntimeEventRequest request)

public final OperationFuture<Runtime,OperationMetadata> reportRuntimeEventAsync(ReportRuntimeEventRequest request)

Report and process a runtime event.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   ReportRuntimeEventRequest request =
       ReportRuntimeEventRequest.newBuilder()
           .setName(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
           .setVmId("vmId3622450")
           .setEvent(Event.newBuilder().build())
           .build();
   Runtime response = managedNotebookServiceClient.reportRuntimeEventAsync(request).get();
 }
 
Parameter
Name Description
request ReportRuntimeEventRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Runtime,OperationMetadata>

reportRuntimeEventAsync(RuntimeName name)

public final OperationFuture<Runtime,OperationMetadata> reportRuntimeEventAsync(RuntimeName name)

Report and process a runtime event.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   RuntimeName name = RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]");
   Runtime response = managedNotebookServiceClient.reportRuntimeEventAsync(name).get();
 }
 
Parameter
Name Description
name RuntimeName

Required. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}

Returns
Type Description
OperationFuture<Runtime,OperationMetadata>

reportRuntimeEventAsync(String name)

public final OperationFuture<Runtime,OperationMetadata> reportRuntimeEventAsync(String name)

Report and process a runtime event.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   String name = RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString();
   Runtime response = managedNotebookServiceClient.reportRuntimeEventAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}

Returns
Type Description
OperationFuture<Runtime,OperationMetadata>

reportRuntimeEventCallable()

public final UnaryCallable<ReportRuntimeEventRequest,Operation> reportRuntimeEventCallable()

Report and process a runtime event.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   ReportRuntimeEventRequest request =
       ReportRuntimeEventRequest.newBuilder()
           .setName(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
           .setVmId("vmId3622450")
           .setEvent(Event.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       managedNotebookServiceClient.reportRuntimeEventCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<ReportRuntimeEventRequest,Operation>

reportRuntimeEventOperationCallable()

public final OperationCallable<ReportRuntimeEventRequest,Runtime,OperationMetadata> reportRuntimeEventOperationCallable()

Report and process a runtime event.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   ReportRuntimeEventRequest request =
       ReportRuntimeEventRequest.newBuilder()
           .setName(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
           .setVmId("vmId3622450")
           .setEvent(Event.newBuilder().build())
           .build();
   OperationFuture<Runtime, OperationMetadata> future =
       managedNotebookServiceClient.reportRuntimeEventOperationCallable().futureCall(request);
   // Do something.
   Runtime response = future.get();
 }
 
Returns
Type Description
OperationCallable<ReportRuntimeEventRequest,Runtime,OperationMetadata>

resetRuntimeAsync(ResetRuntimeRequest request)

public final OperationFuture<Runtime,OperationMetadata> resetRuntimeAsync(ResetRuntimeRequest request)

Resets a Managed Notebook Runtime.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   ResetRuntimeRequest request =
       ResetRuntimeRequest.newBuilder()
           .setName("name3373707")
           .setRequestId("requestId693933066")
           .build();
   Runtime response = managedNotebookServiceClient.resetRuntimeAsync(request).get();
 }
 
Parameter
Name Description
request ResetRuntimeRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Runtime,OperationMetadata>

resetRuntimeAsync(String name)

public final OperationFuture<Runtime,OperationMetadata> resetRuntimeAsync(String name)

Resets a Managed Notebook Runtime.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   String name = "name3373707";
   Runtime response = managedNotebookServiceClient.resetRuntimeAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}

Returns
Type Description
OperationFuture<Runtime,OperationMetadata>

resetRuntimeCallable()

public final UnaryCallable<ResetRuntimeRequest,Operation> resetRuntimeCallable()

Resets a Managed Notebook Runtime.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   ResetRuntimeRequest request =
       ResetRuntimeRequest.newBuilder()
           .setName("name3373707")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       managedNotebookServiceClient.resetRuntimeCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<ResetRuntimeRequest,Operation>

resetRuntimeOperationCallable()

public final OperationCallable<ResetRuntimeRequest,Runtime,OperationMetadata> resetRuntimeOperationCallable()

Resets a Managed Notebook Runtime.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   ResetRuntimeRequest request =
       ResetRuntimeRequest.newBuilder()
           .setName("name3373707")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Runtime, OperationMetadata> future =
       managedNotebookServiceClient.resetRuntimeOperationCallable().futureCall(request);
   // Do something.
   Runtime response = future.get();
 }
 
Returns
Type Description
OperationCallable<ResetRuntimeRequest,Runtime,OperationMetadata>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

startRuntimeAsync(StartRuntimeRequest request)

public final OperationFuture<Runtime,OperationMetadata> startRuntimeAsync(StartRuntimeRequest request)

Starts a Managed Notebook Runtime. Perform "Start" on GPU instances; "Resume" on CPU instances See: https://cloud.google.com/compute/docs/instances/stop-start-instance https://cloud.google.com/compute/docs/instances/suspend-resume-instance

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   StartRuntimeRequest request =
       StartRuntimeRequest.newBuilder()
           .setName("name3373707")
           .setRequestId("requestId693933066")
           .build();
   Runtime response = managedNotebookServiceClient.startRuntimeAsync(request).get();
 }
 
Parameter
Name Description
request StartRuntimeRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Runtime,OperationMetadata>

startRuntimeAsync(String name)

public final OperationFuture<Runtime,OperationMetadata> startRuntimeAsync(String name)

Starts a Managed Notebook Runtime. Perform "Start" on GPU instances; "Resume" on CPU instances See: https://cloud.google.com/compute/docs/instances/stop-start-instance https://cloud.google.com/compute/docs/instances/suspend-resume-instance

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   String name = "name3373707";
   Runtime response = managedNotebookServiceClient.startRuntimeAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}

Returns
Type Description
OperationFuture<Runtime,OperationMetadata>

startRuntimeCallable()

public final UnaryCallable<StartRuntimeRequest,Operation> startRuntimeCallable()

Starts a Managed Notebook Runtime. Perform "Start" on GPU instances; "Resume" on CPU instances See: https://cloud.google.com/compute/docs/instances/stop-start-instance https://cloud.google.com/compute/docs/instances/suspend-resume-instance

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   StartRuntimeRequest request =
       StartRuntimeRequest.newBuilder()
           .setName("name3373707")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       managedNotebookServiceClient.startRuntimeCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<StartRuntimeRequest,Operation>

startRuntimeOperationCallable()

public final OperationCallable<StartRuntimeRequest,Runtime,OperationMetadata> startRuntimeOperationCallable()

Starts a Managed Notebook Runtime. Perform "Start" on GPU instances; "Resume" on CPU instances See: https://cloud.google.com/compute/docs/instances/stop-start-instance https://cloud.google.com/compute/docs/instances/suspend-resume-instance

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   StartRuntimeRequest request =
       StartRuntimeRequest.newBuilder()
           .setName("name3373707")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Runtime, OperationMetadata> future =
       managedNotebookServiceClient.startRuntimeOperationCallable().futureCall(request);
   // Do something.
   Runtime response = future.get();
 }
 
Returns
Type Description
OperationCallable<StartRuntimeRequest,Runtime,OperationMetadata>

stopRuntimeAsync(StopRuntimeRequest request)

public final OperationFuture<Runtime,OperationMetadata> stopRuntimeAsync(StopRuntimeRequest request)

Stops a Managed Notebook Runtime. Perform "Stop" on GPU instances; "Suspend" on CPU instances See: https://cloud.google.com/compute/docs/instances/stop-start-instance https://cloud.google.com/compute/docs/instances/suspend-resume-instance

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   StopRuntimeRequest request =
       StopRuntimeRequest.newBuilder()
           .setName("name3373707")
           .setRequestId("requestId693933066")
           .build();
   Runtime response = managedNotebookServiceClient.stopRuntimeAsync(request).get();
 }
 
Parameter
Name Description
request StopRuntimeRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Runtime,OperationMetadata>

stopRuntimeAsync(String name)

public final OperationFuture<Runtime,OperationMetadata> stopRuntimeAsync(String name)

Stops a Managed Notebook Runtime. Perform "Stop" on GPU instances; "Suspend" on CPU instances See: https://cloud.google.com/compute/docs/instances/stop-start-instance https://cloud.google.com/compute/docs/instances/suspend-resume-instance

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   String name = "name3373707";
   Runtime response = managedNotebookServiceClient.stopRuntimeAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}

Returns
Type Description
OperationFuture<Runtime,OperationMetadata>

stopRuntimeCallable()

public final UnaryCallable<StopRuntimeRequest,Operation> stopRuntimeCallable()

Stops a Managed Notebook Runtime. Perform "Stop" on GPU instances; "Suspend" on CPU instances See: https://cloud.google.com/compute/docs/instances/stop-start-instance https://cloud.google.com/compute/docs/instances/suspend-resume-instance

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   StopRuntimeRequest request =
       StopRuntimeRequest.newBuilder()
           .setName("name3373707")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       managedNotebookServiceClient.stopRuntimeCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<StopRuntimeRequest,Operation>

stopRuntimeOperationCallable()

public final OperationCallable<StopRuntimeRequest,Runtime,OperationMetadata> stopRuntimeOperationCallable()

Stops a Managed Notebook Runtime. Perform "Stop" on GPU instances; "Suspend" on CPU instances See: https://cloud.google.com/compute/docs/instances/stop-start-instance https://cloud.google.com/compute/docs/instances/suspend-resume-instance

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   StopRuntimeRequest request =
       StopRuntimeRequest.newBuilder()
           .setName("name3373707")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Runtime, OperationMetadata> future =
       managedNotebookServiceClient.stopRuntimeOperationCallable().futureCall(request);
   // Do something.
   Runtime response = future.get();
 }
 
Returns
Type Description
OperationCallable<StopRuntimeRequest,Runtime,OperationMetadata>

switchRuntimeAsync(SwitchRuntimeRequest request)

public final OperationFuture<Runtime,OperationMetadata> switchRuntimeAsync(SwitchRuntimeRequest request)

Switch a Managed Notebook Runtime.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   SwitchRuntimeRequest request =
       SwitchRuntimeRequest.newBuilder()
           .setName("name3373707")
           .setMachineType("machineType-218117087")
           .setAcceleratorConfig(RuntimeAcceleratorConfig.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Runtime response = managedNotebookServiceClient.switchRuntimeAsync(request).get();
 }
 
Parameter
Name Description
request SwitchRuntimeRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Runtime,OperationMetadata>

switchRuntimeAsync(String name)

public final OperationFuture<Runtime,OperationMetadata> switchRuntimeAsync(String name)

Switch a Managed Notebook Runtime.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   String name = "name3373707";
   Runtime response = managedNotebookServiceClient.switchRuntimeAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}

Returns
Type Description
OperationFuture<Runtime,OperationMetadata>

switchRuntimeCallable()

public final UnaryCallable<SwitchRuntimeRequest,Operation> switchRuntimeCallable()

Switch a Managed Notebook Runtime.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   SwitchRuntimeRequest request =
       SwitchRuntimeRequest.newBuilder()
           .setName("name3373707")
           .setMachineType("machineType-218117087")
           .setAcceleratorConfig(RuntimeAcceleratorConfig.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       managedNotebookServiceClient.switchRuntimeCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<SwitchRuntimeRequest,Operation>

switchRuntimeOperationCallable()

public final OperationCallable<SwitchRuntimeRequest,Runtime,OperationMetadata> switchRuntimeOperationCallable()

Switch a Managed Notebook Runtime.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedNotebookServiceClient managedNotebookServiceClient =
     ManagedNotebookServiceClient.create()) {
   SwitchRuntimeRequest request =
       SwitchRuntimeRequest.newBuilder()
           .setName("name3373707")
           .setMachineType("machineType-218117087")
           .setAcceleratorConfig(RuntimeAcceleratorConfig.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Runtime, OperationMetadata> future =
       managedNotebookServiceClient.switchRuntimeOperationCallable().futureCall(request);
   // Do something.
   Runtime response = future.get();
 }
 
Returns
Type Description
OperationCallable<SwitchRuntimeRequest,Runtime,OperationMetadata>