Class NotebookServiceClient

public class NotebookServiceClient implements BackgroundResource

Service Description: API v1beta1 service for Cloud AI Platform 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:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   GetInstanceRequest request = GetInstanceRequest.newBuilder().setName("name3373707").build();
   Instance response = notebookServiceClient.getInstance(request);
 }
 

Note: close() needs to be called on the NotebookServiceClient 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 NotebookServiceSettings to create(). For example:

To customize credentials:


 NotebookServiceSettings notebookServiceSettings =
     NotebookServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 NotebookServiceClient notebookServiceClient =
     NotebookServiceClient.create(notebookServiceSettings);
 

To customize the endpoint:


 NotebookServiceSettings notebookServiceSettings =
     NotebookServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 NotebookServiceClient notebookServiceClient =
     NotebookServiceClient.create(notebookServiceSettings);
 

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

Inheritance

java.lang.Object > NotebookServiceClient

Implements

BackgroundResource

Constructors

NotebookServiceClient(NotebookServiceSettings settings)

protected NotebookServiceClient(NotebookServiceSettings settings)

Constructs an instance of NotebookServiceClient, 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
NameDescription
settingsNotebookServiceSettings

NotebookServiceClient(NotebookServiceStub stub)

protected NotebookServiceClient(NotebookServiceStub stub)
Parameter
NameDescription
stubNotebookServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

create()

public static final NotebookServiceClient create()

Constructs an instance of NotebookServiceClient with default settings.

Returns
TypeDescription
NotebookServiceClient
Exceptions
TypeDescription
IOException

create(NotebookServiceSettings settings)

public static final NotebookServiceClient create(NotebookServiceSettings settings)

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

Parameter
NameDescription
settingsNotebookServiceSettings
Returns
TypeDescription
NotebookServiceClient
Exceptions
TypeDescription
IOException

create(NotebookServiceStub stub)

public static final NotebookServiceClient create(NotebookServiceStub stub)

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

Parameter
NameDescription
stubNotebookServiceStub
Returns
TypeDescription
NotebookServiceClient

createEnvironmentAsync(CreateEnvironmentRequest request)

public final OperationFuture<Environment,OperationMetadata> createEnvironmentAsync(CreateEnvironmentRequest request)

Creates a new Environment.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   CreateEnvironmentRequest request =
       CreateEnvironmentRequest.newBuilder()
           .setParent("parent-995424086")
           .setEnvironmentId("environmentId-950205810")
           .setEnvironment(Environment.newBuilder().build())
           .build();
   Environment response = notebookServiceClient.createEnvironmentAsync(request).get();
 }
 
Parameter
NameDescription
requestCreateEnvironmentRequest

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

Returns
TypeDescription
OperationFuture<Environment,OperationMetadata>

createEnvironmentCallable()

public final UnaryCallable<CreateEnvironmentRequest,Operation> createEnvironmentCallable()

Creates a new Environment.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   CreateEnvironmentRequest request =
       CreateEnvironmentRequest.newBuilder()
           .setParent("parent-995424086")
           .setEnvironmentId("environmentId-950205810")
           .setEnvironment(Environment.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       notebookServiceClient.createEnvironmentCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateEnvironmentRequest,Operation>

createEnvironmentOperationCallable()

public final OperationCallable<CreateEnvironmentRequest,Environment,OperationMetadata> createEnvironmentOperationCallable()

Creates a new Environment.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   CreateEnvironmentRequest request =
       CreateEnvironmentRequest.newBuilder()
           .setParent("parent-995424086")
           .setEnvironmentId("environmentId-950205810")
           .setEnvironment(Environment.newBuilder().build())
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<CreateEnvironmentRequest,Environment,OperationMetadata>

createInstanceAsync(CreateInstanceRequest request)

public final OperationFuture<Instance,OperationMetadata> createInstanceAsync(CreateInstanceRequest request)

Creates a new Instance in a given project and location.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   CreateInstanceRequest request =
       CreateInstanceRequest.newBuilder()
           .setParent("parent-995424086")
           .setInstanceId("instanceId902024336")
           .setInstance(Instance.newBuilder().build())
           .build();
   Instance response = notebookServiceClient.createInstanceAsync(request).get();
 }
 
Parameter
NameDescription
requestCreateInstanceRequest

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

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

createInstanceCallable()

public final UnaryCallable<CreateInstanceRequest,Operation> createInstanceCallable()

Creates a new Instance in a given project and location.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   CreateInstanceRequest request =
       CreateInstanceRequest.newBuilder()
           .setParent("parent-995424086")
           .setInstanceId("instanceId902024336")
           .setInstance(Instance.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       notebookServiceClient.createInstanceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateInstanceRequest,Operation>

createInstanceOperationCallable()

public final OperationCallable<CreateInstanceRequest,Instance,OperationMetadata> createInstanceOperationCallable()

Creates a new Instance in a given project and location.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   CreateInstanceRequest request =
       CreateInstanceRequest.newBuilder()
           .setParent("parent-995424086")
           .setInstanceId("instanceId902024336")
           .setInstance(Instance.newBuilder().build())
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<CreateInstanceRequest,Instance,OperationMetadata>

deleteEnvironmentAsync(DeleteEnvironmentRequest request)

public final OperationFuture<Empty,OperationMetadata> deleteEnvironmentAsync(DeleteEnvironmentRequest request)

Deletes a single Environment.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   DeleteEnvironmentRequest request =
       DeleteEnvironmentRequest.newBuilder().setName("name3373707").build();
   notebookServiceClient.deleteEnvironmentAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteEnvironmentRequest

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

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteEnvironmentCallable()

public final UnaryCallable<DeleteEnvironmentRequest,Operation> deleteEnvironmentCallable()

Deletes a single Environment.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   DeleteEnvironmentRequest request =
       DeleteEnvironmentRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Operation> future =
       notebookServiceClient.deleteEnvironmentCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteEnvironmentRequest,Operation>

deleteEnvironmentOperationCallable()

public final OperationCallable<DeleteEnvironmentRequest,Empty,OperationMetadata> deleteEnvironmentOperationCallable()

Deletes a single Environment.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   DeleteEnvironmentRequest request =
       DeleteEnvironmentRequest.newBuilder().setName("name3373707").build();
   OperationFuture
Returns
TypeDescription
OperationCallable<DeleteEnvironmentRequest,Empty,OperationMetadata>

deleteInstanceAsync(DeleteInstanceRequest request)

public final OperationFuture<Empty,OperationMetadata> deleteInstanceAsync(DeleteInstanceRequest request)

Deletes a single Instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   DeleteInstanceRequest request =
       DeleteInstanceRequest.newBuilder().setName("name3373707").build();
   notebookServiceClient.deleteInstanceAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteInstanceRequest

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

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteInstanceCallable()

public final UnaryCallable<DeleteInstanceRequest,Operation> deleteInstanceCallable()

Deletes a single Instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   DeleteInstanceRequest request =
       DeleteInstanceRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Operation> future =
       notebookServiceClient.deleteInstanceCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteInstanceRequest,Operation>

deleteInstanceOperationCallable()

public final OperationCallable<DeleteInstanceRequest,Empty,OperationMetadata> deleteInstanceOperationCallable()

Deletes a single Instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   DeleteInstanceRequest request =
       DeleteInstanceRequest.newBuilder().setName("name3373707").build();
   OperationFuture
Returns
TypeDescription
OperationCallable<DeleteInstanceRequest,Empty,OperationMetadata>

getEnvironment(GetEnvironmentRequest request)

public final Environment getEnvironment(GetEnvironmentRequest request)

Gets details of a single Environment.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   GetEnvironmentRequest request =
       GetEnvironmentRequest.newBuilder().setName("name3373707").build();
   Environment response = notebookServiceClient.getEnvironment(request);
 }
 
Parameter
NameDescription
requestGetEnvironmentRequest

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

Returns
TypeDescription
Environment

getEnvironmentCallable()

public final UnaryCallable<GetEnvironmentRequest,Environment> getEnvironmentCallable()

Gets details of a single Environment.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   GetEnvironmentRequest request =
       GetEnvironmentRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Environment> future =
       notebookServiceClient.getEnvironmentCallable().futureCall(request);
   // Do something.
   Environment response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetEnvironmentRequest,Environment>

getInstance(GetInstanceRequest request)

public final Instance getInstance(GetInstanceRequest request)

Gets details of a single Instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   GetInstanceRequest request = GetInstanceRequest.newBuilder().setName("name3373707").build();
   Instance response = notebookServiceClient.getInstance(request);
 }
 
Parameter
NameDescription
requestGetInstanceRequest

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

Returns
TypeDescription
Instance

getInstanceCallable()

public final UnaryCallable<GetInstanceRequest,Instance> getInstanceCallable()

Gets details of a single Instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   GetInstanceRequest request = GetInstanceRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Instance> future = notebookServiceClient.getInstanceCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetInstanceRequest,Instance>

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
TypeDescription
OperationsClient

getSettings()

public final NotebookServiceSettings getSettings()
Returns
TypeDescription
NotebookServiceSettings

getStub()

public NotebookServiceStub getStub()
Returns
TypeDescription
NotebookServiceStub

isInstanceUpgradeable(IsInstanceUpgradeableRequest request)

public final IsInstanceUpgradeableResponse isInstanceUpgradeable(IsInstanceUpgradeableRequest request)

Check if a notebook instance is upgradable.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   IsInstanceUpgradeableRequest request =
       IsInstanceUpgradeableRequest.newBuilder()
           .setNotebookInstance("notebookInstance-544239728")
           .build();
   IsInstanceUpgradeableResponse response = notebookServiceClient.isInstanceUpgradeable(request);
 }
 
Parameter
NameDescription
requestIsInstanceUpgradeableRequest

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

Returns
TypeDescription
IsInstanceUpgradeableResponse

isInstanceUpgradeableCallable()

public final UnaryCallable<IsInstanceUpgradeableRequest,IsInstanceUpgradeableResponse> isInstanceUpgradeableCallable()

Check if a notebook instance is upgradable.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   IsInstanceUpgradeableRequest request =
       IsInstanceUpgradeableRequest.newBuilder()
           .setNotebookInstance("notebookInstance-544239728")
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<IsInstanceUpgradeableRequest,IsInstanceUpgradeableResponse>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listEnvironments(ListEnvironmentsRequest request)

public final NotebookServiceClient.ListEnvironmentsPagedResponse listEnvironments(ListEnvironmentsRequest request)

Lists environments in a project.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ListEnvironmentsRequest request =
       ListEnvironmentsRequest.newBuilder()
           .setParent("parent-995424086")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Environment element : notebookServiceClient.listEnvironments(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListEnvironmentsRequest

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

Returns
TypeDescription
NotebookServiceClient.ListEnvironmentsPagedResponse

listEnvironmentsCallable()

public final UnaryCallable<ListEnvironmentsRequest,ListEnvironmentsResponse> listEnvironmentsCallable()

Lists environments in a project.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ListEnvironmentsRequest request =
       ListEnvironmentsRequest.newBuilder()
           .setParent("parent-995424086")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListEnvironmentsResponse response =
         notebookServiceClient.listEnvironmentsCallable().call(request);
     for (Environment element : response.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListEnvironmentsRequest,ListEnvironmentsResponse>

listEnvironmentsPagedCallable()

public final UnaryCallable<ListEnvironmentsRequest,NotebookServiceClient.ListEnvironmentsPagedResponse> listEnvironmentsPagedCallable()

Lists environments in a project.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ListEnvironmentsRequest request =
       ListEnvironmentsRequest.newBuilder()
           .setParent("parent-995424086")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Environment> future =
       notebookServiceClient.listEnvironmentsPagedCallable().futureCall(request);
   // Do something.
   for (Environment element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListEnvironmentsRequest,ListEnvironmentsPagedResponse>

listInstances(ListInstancesRequest request)

public final NotebookServiceClient.ListInstancesPagedResponse listInstances(ListInstancesRequest request)

Lists instances in a given project and location.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ListInstancesRequest request =
       ListInstancesRequest.newBuilder()
           .setParent("parent-995424086")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Instance element : notebookServiceClient.listInstances(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListInstancesRequest

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

Returns
TypeDescription
NotebookServiceClient.ListInstancesPagedResponse

listInstancesCallable()

public final UnaryCallable<ListInstancesRequest,ListInstancesResponse> listInstancesCallable()

Lists instances in a given project and location.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ListInstancesRequest request =
       ListInstancesRequest.newBuilder()
           .setParent("parent-995424086")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListInstancesResponse response =
         notebookServiceClient.listInstancesCallable().call(request);
     for (Instance element : response.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListInstancesRequest,ListInstancesResponse>

listInstancesPagedCallable()

public final UnaryCallable<ListInstancesRequest,NotebookServiceClient.ListInstancesPagedResponse> listInstancesPagedCallable()

Lists instances in a given project and location.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ListInstancesRequest request =
       ListInstancesRequest.newBuilder()
           .setParent("parent-995424086")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Instance> future =
       notebookServiceClient.listInstancesPagedCallable().futureCall(request);
   // Do something.
   for (Instance element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListInstancesRequest,ListInstancesPagedResponse>

registerInstanceAsync(RegisterInstanceRequest request)

public final OperationFuture<Instance,OperationMetadata> registerInstanceAsync(RegisterInstanceRequest request)

Registers an existing legacy notebook instance to the Notebooks API server. Legacy instances are instances created with the legacy Compute Engine calls. They are not manageable by the Notebooks API out of the box. This call makes these instances manageable by the Notebooks API.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   RegisterInstanceRequest request =
       RegisterInstanceRequest.newBuilder()
           .setParent("parent-995424086")
           .setInstanceId("instanceId902024336")
           .build();
   Instance response = notebookServiceClient.registerInstanceAsync(request).get();
 }
 
Parameter
NameDescription
requestRegisterInstanceRequest

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

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

registerInstanceCallable()

public final UnaryCallable<RegisterInstanceRequest,Operation> registerInstanceCallable()

Registers an existing legacy notebook instance to the Notebooks API server. Legacy instances are instances created with the legacy Compute Engine calls. They are not manageable by the Notebooks API out of the box. This call makes these instances manageable by the Notebooks API.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   RegisterInstanceRequest request =
       RegisterInstanceRequest.newBuilder()
           .setParent("parent-995424086")
           .setInstanceId("instanceId902024336")
           .build();
   ApiFuture<Operation> future =
       notebookServiceClient.registerInstanceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<RegisterInstanceRequest,Operation>

registerInstanceOperationCallable()

public final OperationCallable<RegisterInstanceRequest,Instance,OperationMetadata> registerInstanceOperationCallable()

Registers an existing legacy notebook instance to the Notebooks API server. Legacy instances are instances created with the legacy Compute Engine calls. They are not manageable by the Notebooks API out of the box. This call makes these instances manageable by the Notebooks API.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   RegisterInstanceRequest request =
       RegisterInstanceRequest.newBuilder()
           .setParent("parent-995424086")
           .setInstanceId("instanceId902024336")
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<RegisterInstanceRequest,Instance,OperationMetadata>

reportInstanceInfoAsync(ReportInstanceInfoRequest request)

public final OperationFuture<Instance,OperationMetadata> reportInstanceInfoAsync(ReportInstanceInfoRequest request)

Allows notebook instances to report their latest instance information to the Notebooks API server. The server will merge the reported information to the instance metadata store. Do not use this method directly.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ReportInstanceInfoRequest request =
       ReportInstanceInfoRequest.newBuilder()
           .setName("name3373707")
           .setVmId("vmId3622450")
           .putAllMetadata(new HashMap
Parameter
NameDescription
requestReportInstanceInfoRequest

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

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

reportInstanceInfoCallable()

public final UnaryCallable<ReportInstanceInfoRequest,Operation> reportInstanceInfoCallable()

Allows notebook instances to report their latest instance information to the Notebooks API server. The server will merge the reported information to the instance metadata store. Do not use this method directly.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ReportInstanceInfoRequest request =
       ReportInstanceInfoRequest.newBuilder()
           .setName("name3373707")
           .setVmId("vmId3622450")
           .putAllMetadata(new HashMap
Returns
TypeDescription
UnaryCallable<ReportInstanceInfoRequest,Operation>

reportInstanceInfoOperationCallable()

public final OperationCallable<ReportInstanceInfoRequest,Instance,OperationMetadata> reportInstanceInfoOperationCallable()

Allows notebook instances to report their latest instance information to the Notebooks API server. The server will merge the reported information to the instance metadata store. Do not use this method directly.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ReportInstanceInfoRequest request =
       ReportInstanceInfoRequest.newBuilder()
           .setName("name3373707")
           .setVmId("vmId3622450")
           .putAllMetadata(new HashMap
Returns
TypeDescription
OperationCallable<ReportInstanceInfoRequest,Instance,OperationMetadata>

resetInstanceAsync(ResetInstanceRequest request)

public final OperationFuture<Instance,OperationMetadata> resetInstanceAsync(ResetInstanceRequest request)

Resets a notebook instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ResetInstanceRequest request =
       ResetInstanceRequest.newBuilder().setName("name3373707").build();
   Instance response = notebookServiceClient.resetInstanceAsync(request).get();
 }
 
Parameter
NameDescription
requestResetInstanceRequest

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

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

resetInstanceCallable()

public final UnaryCallable<ResetInstanceRequest,Operation> resetInstanceCallable()

Resets a notebook instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ResetInstanceRequest request =
       ResetInstanceRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Operation> future =
       notebookServiceClient.resetInstanceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<ResetInstanceRequest,Operation>

resetInstanceOperationCallable()

public final OperationCallable<ResetInstanceRequest,Instance,OperationMetadata> resetInstanceOperationCallable()

Resets a notebook instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ResetInstanceRequest request =
       ResetInstanceRequest.newBuilder().setName("name3373707").build();
   OperationFuture
Returns
TypeDescription
OperationCallable<ResetInstanceRequest,Instance,OperationMetadata>

setInstanceAcceleratorAsync(SetInstanceAcceleratorRequest request)

public final OperationFuture<Instance,OperationMetadata> setInstanceAcceleratorAsync(SetInstanceAcceleratorRequest request)

Updates the guest accelerators of a single Instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   SetInstanceAcceleratorRequest request =
       SetInstanceAcceleratorRequest.newBuilder()
           .setName("name3373707")
           .setCoreCount(-1963855761)
           .build();
   Instance response = notebookServiceClient.setInstanceAcceleratorAsync(request).get();
 }
 
Parameter
NameDescription
requestSetInstanceAcceleratorRequest

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

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

setInstanceAcceleratorCallable()

public final UnaryCallable<SetInstanceAcceleratorRequest,Operation> setInstanceAcceleratorCallable()

Updates the guest accelerators of a single Instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   SetInstanceAcceleratorRequest request =
       SetInstanceAcceleratorRequest.newBuilder()
           .setName("name3373707")
           .setCoreCount(-1963855761)
           .build();
   ApiFuture<Operation> future =
       notebookServiceClient.setInstanceAcceleratorCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetInstanceAcceleratorRequest,Operation>

setInstanceAcceleratorOperationCallable()

public final OperationCallable<SetInstanceAcceleratorRequest,Instance,OperationMetadata> setInstanceAcceleratorOperationCallable()

Updates the guest accelerators of a single Instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   SetInstanceAcceleratorRequest request =
       SetInstanceAcceleratorRequest.newBuilder()
           .setName("name3373707")
           .setCoreCount(-1963855761)
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<SetInstanceAcceleratorRequest,Instance,OperationMetadata>

setInstanceLabelsAsync(SetInstanceLabelsRequest request)

public final OperationFuture<Instance,OperationMetadata> setInstanceLabelsAsync(SetInstanceLabelsRequest request)

Updates the labels of an Instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   SetInstanceLabelsRequest request =
       SetInstanceLabelsRequest.newBuilder()
           .setName("name3373707")
           .putAllLabels(new HashMap
Parameter
NameDescription
requestSetInstanceLabelsRequest

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

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

setInstanceLabelsCallable()

public final UnaryCallable<SetInstanceLabelsRequest,Operation> setInstanceLabelsCallable()

Updates the labels of an Instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   SetInstanceLabelsRequest request =
       SetInstanceLabelsRequest.newBuilder()
           .setName("name3373707")
           .putAllLabels(new HashMap
Returns
TypeDescription
UnaryCallable<SetInstanceLabelsRequest,Operation>

setInstanceLabelsOperationCallable()

public final OperationCallable<SetInstanceLabelsRequest,Instance,OperationMetadata> setInstanceLabelsOperationCallable()

Updates the labels of an Instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   SetInstanceLabelsRequest request =
       SetInstanceLabelsRequest.newBuilder()
           .setName("name3373707")
           .putAllLabels(new HashMap
Returns
TypeDescription
OperationCallable<SetInstanceLabelsRequest,Instance,OperationMetadata>

setInstanceMachineTypeAsync(SetInstanceMachineTypeRequest request)

public final OperationFuture<Instance,OperationMetadata> setInstanceMachineTypeAsync(SetInstanceMachineTypeRequest request)

Updates the machine type of a single Instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   SetInstanceMachineTypeRequest request =
       SetInstanceMachineTypeRequest.newBuilder()
           .setName("name3373707")
           .setMachineType("machineType-218117087")
           .build();
   Instance response = notebookServiceClient.setInstanceMachineTypeAsync(request).get();
 }
 
Parameter
NameDescription
requestSetInstanceMachineTypeRequest

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

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

setInstanceMachineTypeCallable()

public final UnaryCallable<SetInstanceMachineTypeRequest,Operation> setInstanceMachineTypeCallable()

Updates the machine type of a single Instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   SetInstanceMachineTypeRequest request =
       SetInstanceMachineTypeRequest.newBuilder()
           .setName("name3373707")
           .setMachineType("machineType-218117087")
           .build();
   ApiFuture<Operation> future =
       notebookServiceClient.setInstanceMachineTypeCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetInstanceMachineTypeRequest,Operation>

setInstanceMachineTypeOperationCallable()

public final OperationCallable<SetInstanceMachineTypeRequest,Instance,OperationMetadata> setInstanceMachineTypeOperationCallable()

Updates the machine type of a single Instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   SetInstanceMachineTypeRequest request =
       SetInstanceMachineTypeRequest.newBuilder()
           .setName("name3373707")
           .setMachineType("machineType-218117087")
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<SetInstanceMachineTypeRequest,Instance,OperationMetadata>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

startInstanceAsync(StartInstanceRequest request)

public final OperationFuture<Instance,OperationMetadata> startInstanceAsync(StartInstanceRequest request)

Starts a notebook instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   StartInstanceRequest request =
       StartInstanceRequest.newBuilder().setName("name3373707").build();
   Instance response = notebookServiceClient.startInstanceAsync(request).get();
 }
 
Parameter
NameDescription
requestStartInstanceRequest

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

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

startInstanceCallable()

public final UnaryCallable<StartInstanceRequest,Operation> startInstanceCallable()

Starts a notebook instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   StartInstanceRequest request =
       StartInstanceRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Operation> future =
       notebookServiceClient.startInstanceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<StartInstanceRequest,Operation>

startInstanceOperationCallable()

public final OperationCallable<StartInstanceRequest,Instance,OperationMetadata> startInstanceOperationCallable()

Starts a notebook instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   StartInstanceRequest request =
       StartInstanceRequest.newBuilder().setName("name3373707").build();
   OperationFuture
Returns
TypeDescription
OperationCallable<StartInstanceRequest,Instance,OperationMetadata>

stopInstanceAsync(StopInstanceRequest request)

public final OperationFuture<Instance,OperationMetadata> stopInstanceAsync(StopInstanceRequest request)

Stops a notebook instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   StopInstanceRequest request = StopInstanceRequest.newBuilder().setName("name3373707").build();
   Instance response = notebookServiceClient.stopInstanceAsync(request).get();
 }
 
Parameter
NameDescription
requestStopInstanceRequest

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

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

stopInstanceCallable()

public final UnaryCallable<StopInstanceRequest,Operation> stopInstanceCallable()

Stops a notebook instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   StopInstanceRequest request = StopInstanceRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Operation> future =
       notebookServiceClient.stopInstanceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<StopInstanceRequest,Operation>

stopInstanceOperationCallable()

public final OperationCallable<StopInstanceRequest,Instance,OperationMetadata> stopInstanceOperationCallable()

Stops a notebook instance.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   StopInstanceRequest request = StopInstanceRequest.newBuilder().setName("name3373707").build();
   OperationFuture
Returns
TypeDescription
OperationCallable<StopInstanceRequest,Instance,OperationMetadata>

upgradeInstanceAsync(UpgradeInstanceRequest request)

public final OperationFuture<Instance,OperationMetadata> upgradeInstanceAsync(UpgradeInstanceRequest request)

Upgrades a notebook instance to the latest version.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   UpgradeInstanceRequest request =
       UpgradeInstanceRequest.newBuilder().setName("name3373707").build();
   Instance response = notebookServiceClient.upgradeInstanceAsync(request).get();
 }
 
Parameter
NameDescription
requestUpgradeInstanceRequest

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

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

upgradeInstanceCallable()

public final UnaryCallable<UpgradeInstanceRequest,Operation> upgradeInstanceCallable()

Upgrades a notebook instance to the latest version.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   UpgradeInstanceRequest request =
       UpgradeInstanceRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Operation> future =
       notebookServiceClient.upgradeInstanceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpgradeInstanceRequest,Operation>

upgradeInstanceInternalAsync(UpgradeInstanceInternalRequest request)

public final OperationFuture<Instance,OperationMetadata> upgradeInstanceInternalAsync(UpgradeInstanceInternalRequest request)

Allows notebook instances to call this endpoint to upgrade themselves. Do not use this method directly.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   UpgradeInstanceInternalRequest request =
       UpgradeInstanceInternalRequest.newBuilder()
           .setName("name3373707")
           .setVmId("vmId3622450")
           .build();
   Instance response = notebookServiceClient.upgradeInstanceInternalAsync(request).get();
 }
 
Parameter
NameDescription
requestUpgradeInstanceInternalRequest

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

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

upgradeInstanceInternalCallable()

public final UnaryCallable<UpgradeInstanceInternalRequest,Operation> upgradeInstanceInternalCallable()

Allows notebook instances to call this endpoint to upgrade themselves. Do not use this method directly.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   UpgradeInstanceInternalRequest request =
       UpgradeInstanceInternalRequest.newBuilder()
           .setName("name3373707")
           .setVmId("vmId3622450")
           .build();
   ApiFuture<Operation> future =
       notebookServiceClient.upgradeInstanceInternalCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpgradeInstanceInternalRequest,Operation>

upgradeInstanceInternalOperationCallable()

public final OperationCallable<UpgradeInstanceInternalRequest,Instance,OperationMetadata> upgradeInstanceInternalOperationCallable()

Allows notebook instances to call this endpoint to upgrade themselves. Do not use this method directly.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   UpgradeInstanceInternalRequest request =
       UpgradeInstanceInternalRequest.newBuilder()
           .setName("name3373707")
           .setVmId("vmId3622450")
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<UpgradeInstanceInternalRequest,Instance,OperationMetadata>

upgradeInstanceOperationCallable()

public final OperationCallable<UpgradeInstanceRequest,Instance,OperationMetadata> upgradeInstanceOperationCallable()

Upgrades a notebook instance to the latest version.

Sample code:


 try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   UpgradeInstanceRequest request =
       UpgradeInstanceRequest.newBuilder().setName("name3373707").build();
   OperationFuture
Returns
TypeDescription
OperationCallable<UpgradeInstanceRequest,Instance,OperationMetadata>