Class NotebookServiceClient (1.32.0)

GitHub RepositoryProduct Reference

Service Description: API v2 service for Workbench Notebooks Instances.

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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
   Instance response = notebookServiceClient.getInstance(name);
 }
 

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().

Methods
MethodDescriptionMethod Variants

ListInstances

Lists instances in a given project and location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listInstances(ListInstancesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listInstances(LocationName parent)

  • listInstances(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listInstancesPagedCallable()

  • listInstancesCallable()

GetInstance

Gets details of a single Instance.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getInstance(GetInstanceRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getInstance(InstanceName name)

  • getInstance(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getInstanceCallable()

CreateInstance

Creates a new Instance in a given project and location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createInstanceAsync(CreateInstanceRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • createInstanceAsync(LocationName parent, Instance instance, String instanceId)

  • createInstanceAsync(String parent, Instance instance, String instanceId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createInstanceOperationCallable()

  • createInstanceCallable()

UpdateInstance

UpdateInstance updates an Instance.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateInstanceAsync(UpdateInstanceRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • updateInstanceAsync(Instance instance, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateInstanceOperationCallable()

  • updateInstanceCallable()

DeleteInstance

Deletes a single Instance.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteInstanceAsync(DeleteInstanceRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deleteInstanceAsync(InstanceName name)

  • deleteInstanceAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteInstanceOperationCallable()

  • deleteInstanceCallable()

StartInstance

Starts a notebook instance.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • startInstanceAsync(StartInstanceRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • startInstanceOperationCallable()

  • startInstanceCallable()

StopInstance

Stops a notebook instance.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • stopInstanceAsync(StopInstanceRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • stopInstanceOperationCallable()

  • stopInstanceCallable()

ResetInstance

Resets a notebook instance.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • resetInstanceAsync(ResetInstanceRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • resetInstanceOperationCallable()

  • resetInstanceCallable()

CheckInstanceUpgradability

Checks whether a notebook instance is upgradable.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • checkInstanceUpgradability(CheckInstanceUpgradabilityRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • checkInstanceUpgradabilityCallable()

UpgradeInstance

Upgrades a notebook instance to the latest version.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • upgradeInstanceAsync(UpgradeInstanceRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • upgradeInstanceOperationCallable()

  • upgradeInstanceCallable()

RollbackInstance

Rollbacks a notebook instance to the previous version.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • rollbackInstanceAsync(RollbackInstanceRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • rollbackInstanceOperationCallable()

  • rollbackInstanceCallable()

DiagnoseInstance

Creates a Diagnostic File and runs Diagnostic Tool given an Instance.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • diagnoseInstanceAsync(DiagnoseInstanceRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • diagnoseInstanceAsync(InstanceName name, DiagnosticConfig diagnosticConfig)

  • diagnoseInstanceAsync(String name, DiagnosticConfig diagnosticConfig)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • diagnoseInstanceOperationCallable()

  • diagnoseInstanceCallable()

ListLocations

Lists information about the supported locations for this service.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listLocations(ListLocationsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getLocation(GetLocationRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getLocationCallable()

SetIamPolicy

Sets the access control policy on the specified resource. Replacesany existing policy.

Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIEDerrors.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • setIamPolicy(SetIamPolicyRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • setIamPolicyCallable()

GetIamPolicy

Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getIamPolicy(GetIamPolicyRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getIamPolicyCallable()

TestIamPermissions

Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a NOT_FOUND error.

Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • testIamPermissions(TestIamPermissionsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • testIamPermissionsCallable()

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:


 // 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
 NotebookServiceSettings notebookServiceSettings =
     NotebookServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 NotebookServiceClient notebookServiceClient =
     NotebookServiceClient.create(notebookServiceSettings);
 

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
 NotebookServiceSettings notebookServiceSettings =
     NotebookServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 NotebookServiceClient notebookServiceClient =
     NotebookServiceClient.create(notebookServiceSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // 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
 NotebookServiceSettings notebookServiceSettings =
     NotebookServiceSettings.newHttpJsonBuilder().build();
 NotebookServiceClient notebookServiceClient =
     NotebookServiceClient.create(notebookServiceSettings);
 

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

Inheritance

java.lang.Object > NotebookServiceClient

Static Methods

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

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

checkInstanceUpgradability(CheckInstanceUpgradabilityRequest request)

public final CheckInstanceUpgradabilityResponse checkInstanceUpgradability(CheckInstanceUpgradabilityRequest request)

Checks whether a notebook instance is upgradable.

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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   CheckInstanceUpgradabilityRequest request =
       CheckInstanceUpgradabilityRequest.newBuilder()
           .setNotebookInstance("notebookInstance-544239728")
           .build();
   CheckInstanceUpgradabilityResponse response =
       notebookServiceClient.checkInstanceUpgradability(request);
 }
 
Parameter
NameDescription
requestCheckInstanceUpgradabilityRequest

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

Returns
TypeDescription
CheckInstanceUpgradabilityResponse

checkInstanceUpgradabilityCallable()

public final UnaryCallable<CheckInstanceUpgradabilityRequest,CheckInstanceUpgradabilityResponse> checkInstanceUpgradabilityCallable()

Checks whether a notebook instance is upgradable.

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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   CheckInstanceUpgradabilityRequest request =
       CheckInstanceUpgradabilityRequest.newBuilder()
           .setNotebookInstance("notebookInstance-544239728")
           .build();
   ApiFuture<CheckInstanceUpgradabilityResponse> future =
       notebookServiceClient.checkInstanceUpgradabilityCallable().futureCall(request);
   // Do something.
   CheckInstanceUpgradabilityResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CheckInstanceUpgradabilityRequest,CheckInstanceUpgradabilityResponse>

close()

public final void close()

createInstanceAsync(CreateInstanceRequest request)

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

Creates a new Instance 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   CreateInstanceRequest request =
       CreateInstanceRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setInstanceId("instanceId902024336")
           .setInstance(Instance.newBuilder().build())
           .setRequestId("requestId693933066")
           .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>

createInstanceAsync(LocationName parent, Instance instance, String instanceId)

public final OperationFuture<Instance,OperationMetadata> createInstanceAsync(LocationName parent, Instance instance, String instanceId)

Creates a new Instance 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   Instance instance = Instance.newBuilder().build();
   String instanceId = "instanceId902024336";
   Instance response =
       notebookServiceClient.createInstanceAsync(parent, instance, instanceId).get();
 }
 
Parameters
NameDescription
parentLocationName

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

instanceInstance

Required. The instance to be created.

instanceIdString

Required. User-defined unique ID of this instance.

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

createInstanceAsync(String parent, Instance instance, String instanceId)

public final OperationFuture<Instance,OperationMetadata> createInstanceAsync(String parent, Instance instance, String instanceId)

Creates a new Instance 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   Instance instance = Instance.newBuilder().build();
   String instanceId = "instanceId902024336";
   Instance response =
       notebookServiceClient.createInstanceAsync(parent, instance, instanceId).get();
 }
 
Parameters
NameDescription
parentString

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

instanceInstance

Required. The instance to be created.

instanceIdString

Required. User-defined unique ID of this instance.

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

createInstanceCallable()

public final UnaryCallable<CreateInstanceRequest,Operation> createInstanceCallable()

Creates a new Instance 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   CreateInstanceRequest request =
       CreateInstanceRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setInstanceId("instanceId902024336")
           .setInstance(Instance.newBuilder().build())
           .setRequestId("requestId693933066")
           .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:


 // 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   CreateInstanceRequest request =
       CreateInstanceRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setInstanceId("instanceId902024336")
           .setInstance(Instance.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Instance, OperationMetadata> future =
       notebookServiceClient.createInstanceOperationCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<CreateInstanceRequest,Instance,OperationMetadata>

deleteInstanceAsync(DeleteInstanceRequest request)

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

Deletes a single 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   DeleteInstanceRequest request =
       DeleteInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setRequestId("requestId693933066")
           .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>

deleteInstanceAsync(InstanceName name)

public final OperationFuture<Empty,OperationMetadata> deleteInstanceAsync(InstanceName name)

Deletes a single 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
   notebookServiceClient.deleteInstanceAsync(name).get();
 }
 
Parameter
NameDescription
nameInstanceName

Required. Format: projects/{project_id}/locations/{location}/instances/{instance_id}

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteInstanceAsync(String name)

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

Deletes a single 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
   notebookServiceClient.deleteInstanceAsync(name).get();
 }
 
Parameter
NameDescription
nameString

Required. Format: projects/{project_id}/locations/{location}/instances/{instance_id}

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteInstanceCallable()

public final UnaryCallable<DeleteInstanceRequest,Operation> deleteInstanceCallable()

Deletes a single 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   DeleteInstanceRequest request =
       DeleteInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setRequestId("requestId693933066")
           .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:


 // 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   DeleteInstanceRequest request =
       DeleteInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Empty, OperationMetadata> future =
       notebookServiceClient.deleteInstanceOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeleteInstanceRequest,Empty,OperationMetadata>

diagnoseInstanceAsync(DiagnoseInstanceRequest request)

public final OperationFuture<Instance,OperationMetadata> diagnoseInstanceAsync(DiagnoseInstanceRequest request)

Creates a Diagnostic File and runs Diagnostic Tool given an 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   DiagnoseInstanceRequest request =
       DiagnoseInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setDiagnosticConfig(DiagnosticConfig.newBuilder().build())
           .setTimeoutMinutes(571023361)
           .build();
   Instance response = notebookServiceClient.diagnoseInstanceAsync(request).get();
 }
 
Parameter
NameDescription
requestDiagnoseInstanceRequest

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

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

diagnoseInstanceAsync(InstanceName name, DiagnosticConfig diagnosticConfig)

public final OperationFuture<Instance,OperationMetadata> diagnoseInstanceAsync(InstanceName name, DiagnosticConfig diagnosticConfig)

Creates a Diagnostic File and runs Diagnostic Tool given an 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
   DiagnosticConfig diagnosticConfig = DiagnosticConfig.newBuilder().build();
   Instance response = notebookServiceClient.diagnoseInstanceAsync(name, diagnosticConfig).get();
 }
 
Parameters
NameDescription
nameInstanceName

Required. Format: projects/{project_id}/locations/{location}/instances/{instance_id}

diagnosticConfigDiagnosticConfig

Required. Defines flags that are used to run the diagnostic tool

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

diagnoseInstanceAsync(String name, DiagnosticConfig diagnosticConfig)

public final OperationFuture<Instance,OperationMetadata> diagnoseInstanceAsync(String name, DiagnosticConfig diagnosticConfig)

Creates a Diagnostic File and runs Diagnostic Tool given an 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
   DiagnosticConfig diagnosticConfig = DiagnosticConfig.newBuilder().build();
   Instance response = notebookServiceClient.diagnoseInstanceAsync(name, diagnosticConfig).get();
 }
 
Parameters
NameDescription
nameString

Required. Format: projects/{project_id}/locations/{location}/instances/{instance_id}

diagnosticConfigDiagnosticConfig

Required. Defines flags that are used to run the diagnostic tool

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

diagnoseInstanceCallable()

public final UnaryCallable<DiagnoseInstanceRequest,Operation> diagnoseInstanceCallable()

Creates a Diagnostic File and runs Diagnostic Tool given an 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   DiagnoseInstanceRequest request =
       DiagnoseInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setDiagnosticConfig(DiagnosticConfig.newBuilder().build())
           .setTimeoutMinutes(571023361)
           .build();
   ApiFuture<Operation> future =
       notebookServiceClient.diagnoseInstanceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DiagnoseInstanceRequest,Operation>

diagnoseInstanceOperationCallable()

public final OperationCallable<DiagnoseInstanceRequest,Instance,OperationMetadata> diagnoseInstanceOperationCallable()

Creates a Diagnostic File and runs Diagnostic Tool given an 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   DiagnoseInstanceRequest request =
       DiagnoseInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setDiagnosticConfig(DiagnosticConfig.newBuilder().build())
           .setTimeoutMinutes(571023361)
           .build();
   OperationFuture<Instance, OperationMetadata> future =
       notebookServiceClient.diagnoseInstanceOperationCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<DiagnoseInstanceRequest,Instance,OperationMetadata>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

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

getIamPolicy(GetIamPolicyRequest request)

public final Policy getIamPolicy(GetIamPolicyRequest request)

Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   GetIamPolicyRequest request =
       GetIamPolicyRequest.newBuilder()
           .setResource(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setOptions(GetPolicyOptions.newBuilder().build())
           .build();
   Policy response = notebookServiceClient.getIamPolicy(request);
 }
 
Parameter
NameDescription
requestcom.google.iam.v1.GetIamPolicyRequest

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

Returns
TypeDescription
com.google.iam.v1.Policy

getIamPolicyCallable()

public final UnaryCallable<GetIamPolicyRequest,Policy> getIamPolicyCallable()

Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   GetIamPolicyRequest request =
       GetIamPolicyRequest.newBuilder()
           .setResource(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setOptions(GetPolicyOptions.newBuilder().build())
           .build();
   ApiFuture<Policy> future = notebookServiceClient.getIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy>

getInstance(GetInstanceRequest request)

public final Instance getInstance(GetInstanceRequest request)

Gets details of a single 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   GetInstanceRequest request =
       GetInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .build();
   Instance response = notebookServiceClient.getInstance(request);
 }
 
Parameter
NameDescription
requestGetInstanceRequest

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

Returns
TypeDescription
Instance

getInstance(InstanceName name)

public final Instance getInstance(InstanceName name)

Gets details of a single 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
   Instance response = notebookServiceClient.getInstance(name);
 }
 
Parameter
NameDescription
nameInstanceName

Required. Format: projects/{project_id}/locations/{location}/instances/{instance_id}

Returns
TypeDescription
Instance

getInstance(String name)

public final Instance getInstance(String name)

Gets details of a single 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
   Instance response = notebookServiceClient.getInstance(name);
 }
 
Parameter
NameDescription
nameString

Required. Format: projects/{project_id}/locations/{location}/instances/{instance_id}

Returns
TypeDescription
Instance

getInstanceCallable()

public final UnaryCallable<GetInstanceRequest,Instance> getInstanceCallable()

Gets details of a single 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   GetInstanceRequest request =
       GetInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .build();
   ApiFuture<Instance> future = notebookServiceClient.getInstanceCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetInstanceRequest,Instance>

getLocation(GetLocationRequest request)

public final Location getLocation(GetLocationRequest request)

Gets information about a 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   Location response = notebookServiceClient.getLocation(request);
 }
 
Parameter
NameDescription
requestcom.google.cloud.location.GetLocationRequest

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

Returns
TypeDescription
com.google.cloud.location.Location

getLocationCallable()

public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()

Gets information about a 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Location> future = notebookServiceClient.getLocationCallable().futureCall(request);
   // Do something.
   Location response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

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

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listInstances(ListInstancesRequest request)

public final NotebookServiceClient.ListInstancesPagedResponse listInstances(ListInstancesRequest request)

Lists instances 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ListInstancesRequest request =
       ListInstancesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setOrderBy("orderBy-1207110587")
           .setFilter("filter-1274492040")
           .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

listInstances(LocationName parent)

public final NotebookServiceClient.ListInstancesPagedResponse listInstances(LocationName parent)

Lists instances 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (Instance element : notebookServiceClient.listInstances(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentLocationName

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

Returns
TypeDescription
NotebookServiceClient.ListInstancesPagedResponse

listInstances(String parent)

public final NotebookServiceClient.ListInstancesPagedResponse listInstances(String parent)

Lists instances 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (Instance element : notebookServiceClient.listInstances(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

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

Returns
TypeDescription
NotebookServiceClient.ListInstancesPagedResponse

listInstancesCallable()

public final UnaryCallable<ListInstancesRequest,ListInstancesResponse> listInstancesCallable()

Lists instances 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ListInstancesRequest request =
       ListInstancesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setOrderBy("orderBy-1207110587")
           .setFilter("filter-1274492040")
           .build();
   while (true) {
     ListInstancesResponse response =
         notebookServiceClient.listInstancesCallable().call(request);
     for (Instance element : response.getInstancesList()) {
       // 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:


 // 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ListInstancesRequest request =
       ListInstancesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setOrderBy("orderBy-1207110587")
           .setFilter("filter-1274492040")
           .build();
   ApiFuture<Instance> future =
       notebookServiceClient.listInstancesPagedCallable().futureCall(request);
   // Do something.
   for (Instance element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListInstancesRequest,ListInstancesPagedResponse>

listLocations(ListLocationsRequest request)

public final NotebookServiceClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)

Lists information about the supported locations for this service.

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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Location element : notebookServiceClient.listLocations(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestcom.google.cloud.location.ListLocationsRequest

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

Returns
TypeDescription
NotebookServiceClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()

Lists information about the supported locations for this service.

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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListLocationsResponse response =
         notebookServiceClient.listLocationsCallable().call(request);
     for (Location element : response.getLocationsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable<ListLocationsRequest,NotebookServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()

Lists information about the supported locations for this service.

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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Location> future =
       notebookServiceClient.listLocationsPagedCallable().futureCall(request);
   // Do something.
   for (Location element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

resetInstanceAsync(ResetInstanceRequest request)

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

Resets a notebook 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 (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:


 // 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 (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:


 // 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   ResetInstanceRequest request =
       ResetInstanceRequest.newBuilder().setName("name3373707").build();
   OperationFuture<Instance, OperationMetadata> future =
       notebookServiceClient.resetInstanceOperationCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<ResetInstanceRequest,Instance,OperationMetadata>

rollbackInstanceAsync(RollbackInstanceRequest request)

public final OperationFuture<Instance,OperationMetadata> rollbackInstanceAsync(RollbackInstanceRequest request)

Rollbacks a notebook instance to the previous version.

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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   RollbackInstanceRequest request =
       RollbackInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setTargetSnapshot("targetSnapshot-1307211147")
           .setRevisionId("revisionId-1507445162")
           .build();
   Instance response = notebookServiceClient.rollbackInstanceAsync(request).get();
 }
 
Parameter
NameDescription
requestRollbackInstanceRequest

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

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

rollbackInstanceCallable()

public final UnaryCallable<RollbackInstanceRequest,Operation> rollbackInstanceCallable()

Rollbacks a notebook instance to the previous version.

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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   RollbackInstanceRequest request =
       RollbackInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setTargetSnapshot("targetSnapshot-1307211147")
           .setRevisionId("revisionId-1507445162")
           .build();
   ApiFuture<Operation> future =
       notebookServiceClient.rollbackInstanceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<RollbackInstanceRequest,Operation>

rollbackInstanceOperationCallable()

public final OperationCallable<RollbackInstanceRequest,Instance,OperationMetadata> rollbackInstanceOperationCallable()

Rollbacks a notebook instance to the previous version.

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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   RollbackInstanceRequest request =
       RollbackInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setTargetSnapshot("targetSnapshot-1307211147")
           .setRevisionId("revisionId-1507445162")
           .build();
   OperationFuture<Instance, OperationMetadata> future =
       notebookServiceClient.rollbackInstanceOperationCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<RollbackInstanceRequest,Instance,OperationMetadata>

setIamPolicy(SetIamPolicyRequest request)

public final Policy setIamPolicy(SetIamPolicyRequest request)

Sets the access control policy on the specified resource. Replacesany existing policy.

Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIEDerrors.

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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   SetIamPolicyRequest request =
       SetIamPolicyRequest.newBuilder()
           .setResource(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setPolicy(Policy.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Policy response = notebookServiceClient.setIamPolicy(request);
 }
 
Parameter
NameDescription
requestcom.google.iam.v1.SetIamPolicyRequest

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

Returns
TypeDescription
com.google.iam.v1.Policy

setIamPolicyCallable()

public final UnaryCallable<SetIamPolicyRequest,Policy> setIamPolicyCallable()

Sets the access control policy on the specified resource. Replacesany existing policy.

Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIEDerrors.

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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   SetIamPolicyRequest request =
       SetIamPolicyRequest.newBuilder()
           .setResource(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setPolicy(Policy.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Policy> future = notebookServiceClient.setIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy>

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:


 // 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 (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:


 // 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 (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:


 // 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   StartInstanceRequest request =
       StartInstanceRequest.newBuilder().setName("name3373707").build();
   OperationFuture<Instance, OperationMetadata> future =
       notebookServiceClient.startInstanceOperationCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<StartInstanceRequest,Instance,OperationMetadata>

stopInstanceAsync(StopInstanceRequest request)

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

Stops a notebook 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 (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:


 // 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 (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:


 // 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   StopInstanceRequest request = StopInstanceRequest.newBuilder().setName("name3373707").build();
   OperationFuture<Instance, OperationMetadata> future =
       notebookServiceClient.stopInstanceOperationCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<StopInstanceRequest,Instance,OperationMetadata>

testIamPermissions(TestIamPermissionsRequest request)

public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request)

Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a NOT_FOUND error.

Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.

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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   TestIamPermissionsRequest request =
       TestIamPermissionsRequest.newBuilder()
           .setResource(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .addAllPermissions(new ArrayList<String>())
           .build();
   TestIamPermissionsResponse response = notebookServiceClient.testIamPermissions(request);
 }
 
Parameter
NameDescription
requestcom.google.iam.v1.TestIamPermissionsRequest

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

Returns
TypeDescription
com.google.iam.v1.TestIamPermissionsResponse

testIamPermissionsCallable()

public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()

Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a NOT_FOUND error.

Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.

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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   TestIamPermissionsRequest request =
       TestIamPermissionsRequest.newBuilder()
           .setResource(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .addAllPermissions(new ArrayList<String>())
           .build();
   ApiFuture<TestIamPermissionsResponse> future =
       notebookServiceClient.testIamPermissionsCallable().futureCall(request);
   // Do something.
   TestIamPermissionsResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse>

updateInstanceAsync(Instance instance, FieldMask updateMask)

public final OperationFuture<Instance,OperationMetadata> updateInstanceAsync(Instance instance, FieldMask updateMask)

UpdateInstance updates an 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   Instance instance = Instance.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Instance response = notebookServiceClient.updateInstanceAsync(instance, updateMask).get();
 }
 
Parameters
NameDescription
instanceInstance

Required. A representation of an instance.

updateMaskFieldMask

Required. Mask used to update an instance

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

updateInstanceAsync(UpdateInstanceRequest request)

public final OperationFuture<Instance,OperationMetadata> updateInstanceAsync(UpdateInstanceRequest request)

UpdateInstance updates an 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   UpdateInstanceRequest request =
       UpdateInstanceRequest.newBuilder()
           .setInstance(Instance.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Instance response = notebookServiceClient.updateInstanceAsync(request).get();
 }
 
Parameter
NameDescription
requestUpdateInstanceRequest

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

Returns
TypeDescription
OperationFuture<Instance,OperationMetadata>

updateInstanceCallable()

public final UnaryCallable<UpdateInstanceRequest,Operation> updateInstanceCallable()

UpdateInstance updates an 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   UpdateInstanceRequest request =
       UpdateInstanceRequest.newBuilder()
           .setInstance(Instance.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       notebookServiceClient.updateInstanceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateInstanceRequest,Operation>

updateInstanceOperationCallable()

public final OperationCallable<UpdateInstanceRequest,Instance,OperationMetadata> updateInstanceOperationCallable()

UpdateInstance updates an 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   UpdateInstanceRequest request =
       UpdateInstanceRequest.newBuilder()
           .setInstance(Instance.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Instance, OperationMetadata> future =
       notebookServiceClient.updateInstanceOperationCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<UpdateInstanceRequest,Instance,OperationMetadata>

upgradeInstanceAsync(UpgradeInstanceRequest request)

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

Upgrades a notebook instance to the latest version.

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 (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:


 // 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 (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>

upgradeInstanceOperationCallable()

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

Upgrades a notebook instance to the latest version.

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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
   UpgradeInstanceRequest request =
       UpgradeInstanceRequest.newBuilder().setName("name3373707").build();
   OperationFuture<Instance, OperationMetadata> future =
       notebookServiceClient.upgradeInstanceOperationCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<UpgradeInstanceRequest,Instance,OperationMetadata>