@Generated(value="by gapic-generator-java") public class NotebookServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
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().
The surface of this class includes several types of Java methods for each of the API's methods:
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
NotebookServiceClient.ListInstancesFixedSizeCollection |
static class |
NotebookServiceClient.ListInstancesPage |
static class |
NotebookServiceClient.ListInstancesPagedResponse |
static class |
NotebookServiceClient.ListLocationsFixedSizeCollection |
static class |
NotebookServiceClient.ListLocationsPage |
static class |
NotebookServiceClient.ListLocationsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
NotebookServiceClient(NotebookServiceSettings settings)
Constructs an instance of NotebookServiceClient, using the given settings.
|
protected |
NotebookServiceClient(NotebookServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
CheckInstanceUpgradabilityResponse |
checkInstanceUpgradability(CheckInstanceUpgradabilityRequest request)
Checks whether a notebook instance is upgradable.
|
com.google.api.gax.rpc.UnaryCallable<CheckInstanceUpgradabilityRequest,CheckInstanceUpgradabilityResponse> |
checkInstanceUpgradabilityCallable()
Checks whether a notebook instance is upgradable.
|
void |
close() |
static NotebookServiceClient |
create()
Constructs an instance of NotebookServiceClient with default settings.
|
static NotebookServiceClient |
create(NotebookServiceSettings settings)
Constructs an instance of NotebookServiceClient, using the given settings.
|
static NotebookServiceClient |
create(NotebookServiceStub stub)
Constructs an instance of NotebookServiceClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
createInstanceAsync(CreateInstanceRequest request)
Creates a new Instance in a given project and location.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
createInstanceAsync(LocationName parent,
Instance instance,
String instanceId)
Creates a new Instance in a given project and location.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
createInstanceAsync(String parent,
Instance instance,
String instanceId)
Creates a new Instance in a given project and location.
|
com.google.api.gax.rpc.UnaryCallable<CreateInstanceRequest,com.google.longrunning.Operation> |
createInstanceCallable()
Creates a new Instance in a given project and location.
|
com.google.api.gax.rpc.OperationCallable<CreateInstanceRequest,Instance,OperationMetadata> |
createInstanceOperationCallable()
Creates a new Instance in a given project and location.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteInstanceAsync(DeleteInstanceRequest request)
Deletes a single Instance.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteInstanceAsync(InstanceName name)
Deletes a single Instance.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteInstanceAsync(String name)
Deletes a single Instance.
|
com.google.api.gax.rpc.UnaryCallable<DeleteInstanceRequest,com.google.longrunning.Operation> |
deleteInstanceCallable()
Deletes a single Instance.
|
com.google.api.gax.rpc.OperationCallable<DeleteInstanceRequest,com.google.protobuf.Empty,OperationMetadata> |
deleteInstanceOperationCallable()
Deletes a single Instance.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
diagnoseInstanceAsync(DiagnoseInstanceRequest request)
Creates a Diagnostic File and runs Diagnostic Tool given an Instance.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
diagnoseInstanceAsync(InstanceName name,
DiagnosticConfig diagnosticConfig)
Creates a Diagnostic File and runs Diagnostic Tool given an Instance.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
diagnoseInstanceAsync(String name,
DiagnosticConfig diagnosticConfig)
Creates a Diagnostic File and runs Diagnostic Tool given an Instance.
|
com.google.api.gax.rpc.UnaryCallable<DiagnoseInstanceRequest,com.google.longrunning.Operation> |
diagnoseInstanceCallable()
Creates a Diagnostic File and runs Diagnostic Tool given an Instance.
|
com.google.api.gax.rpc.OperationCallable<DiagnoseInstanceRequest,Instance,OperationMetadata> |
diagnoseInstanceOperationCallable()
Creates a Diagnostic File and runs Diagnostic Tool given an Instance.
|
com.google.api.gax.httpjson.longrunning.OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
com.google.iam.v1.Policy |
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getIamPolicyCallable()
Gets the access control policy for a resource.
|
Instance |
getInstance(GetInstanceRequest request)
Gets details of a single Instance.
|
Instance |
getInstance(InstanceName name)
Gets details of a single Instance.
|
Instance |
getInstance(String name)
Gets details of a single Instance.
|
com.google.api.gax.rpc.UnaryCallable<GetInstanceRequest,Instance> |
getInstanceCallable()
Gets details of a single Instance.
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
NotebookServiceSettings |
getSettings() |
NotebookServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
NotebookServiceClient.ListInstancesPagedResponse |
listInstances(ListInstancesRequest request)
Lists instances in a given project and location.
|
NotebookServiceClient.ListInstancesPagedResponse |
listInstances(LocationName parent)
Lists instances in a given project and location.
|
NotebookServiceClient.ListInstancesPagedResponse |
listInstances(String parent)
Lists instances in a given project and location.
|
com.google.api.gax.rpc.UnaryCallable<ListInstancesRequest,ListInstancesResponse> |
listInstancesCallable()
Lists instances in a given project and location.
|
com.google.api.gax.rpc.UnaryCallable<ListInstancesRequest,NotebookServiceClient.ListInstancesPagedResponse> |
listInstancesPagedCallable()
Lists instances in a given project and location.
|
NotebookServiceClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,NotebookServiceClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
resetInstanceAsync(ResetInstanceRequest request)
Resets a notebook instance.
|
com.google.api.gax.rpc.UnaryCallable<ResetInstanceRequest,com.google.longrunning.Operation> |
resetInstanceCallable()
Resets a notebook instance.
|
com.google.api.gax.rpc.OperationCallable<ResetInstanceRequest,Instance,OperationMetadata> |
resetInstanceOperationCallable()
Resets a notebook instance.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
rollbackInstanceAsync(RollbackInstanceRequest request)
Rollbacks a notebook instance to the previous version.
|
com.google.api.gax.rpc.UnaryCallable<RollbackInstanceRequest,com.google.longrunning.Operation> |
rollbackInstanceCallable()
Rollbacks a notebook instance to the previous version.
|
com.google.api.gax.rpc.OperationCallable<RollbackInstanceRequest,Instance,OperationMetadata> |
rollbackInstanceOperationCallable()
Rollbacks a notebook instance to the previous version.
|
com.google.iam.v1.Policy |
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
setIamPolicyCallable()
Sets the access control policy on the specified resource.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
startInstanceAsync(StartInstanceRequest request)
Starts a notebook instance.
|
com.google.api.gax.rpc.UnaryCallable<StartInstanceRequest,com.google.longrunning.Operation> |
startInstanceCallable()
Starts a notebook instance.
|
com.google.api.gax.rpc.OperationCallable<StartInstanceRequest,Instance,OperationMetadata> |
startInstanceOperationCallable()
Starts a notebook instance.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
stopInstanceAsync(StopInstanceRequest request)
Stops a notebook instance.
|
com.google.api.gax.rpc.UnaryCallable<StopInstanceRequest,com.google.longrunning.Operation> |
stopInstanceCallable()
Stops a notebook instance.
|
com.google.api.gax.rpc.OperationCallable<StopInstanceRequest,Instance,OperationMetadata> |
stopInstanceOperationCallable()
Stops a notebook instance.
|
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
testIamPermissionsCallable()
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
updateInstanceAsync(Instance instance,
com.google.protobuf.FieldMask updateMask)
UpdateInstance updates an Instance.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
updateInstanceAsync(UpdateInstanceRequest request)
UpdateInstance updates an Instance.
|
com.google.api.gax.rpc.UnaryCallable<UpdateInstanceRequest,com.google.longrunning.Operation> |
updateInstanceCallable()
UpdateInstance updates an Instance.
|
com.google.api.gax.rpc.OperationCallable<UpdateInstanceRequest,Instance,OperationMetadata> |
updateInstanceOperationCallable()
UpdateInstance updates an Instance.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
upgradeInstanceAsync(UpgradeInstanceRequest request)
Upgrades a notebook instance to the latest version.
|
com.google.api.gax.rpc.UnaryCallable<UpgradeInstanceRequest,com.google.longrunning.Operation> |
upgradeInstanceCallable()
Upgrades a notebook instance to the latest version.
|
com.google.api.gax.rpc.OperationCallable<UpgradeInstanceRequest,Instance,OperationMetadata> |
upgradeInstanceOperationCallable()
Upgrades a notebook instance to the latest version.
|
protected NotebookServiceClient(NotebookServiceSettings settings) throws IOException
IOExceptionprotected NotebookServiceClient(NotebookServiceStub stub)
public static final NotebookServiceClient create() throws IOException
IOExceptionpublic static final NotebookServiceClient create(NotebookServiceSettings settings) throws IOException
IOExceptionpublic static final NotebookServiceClient create(NotebookServiceStub stub)
public final NotebookServiceSettings getSettings()
public NotebookServiceStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
public final NotebookServiceClient.ListInstancesPagedResponse listInstances(LocationName parent)
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);
}
}
parent - Required. Format: `parent=projects/{project_id}/locations/{location}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final NotebookServiceClient.ListInstancesPagedResponse listInstances(String parent)
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);
}
}
parent - Required. Format: `parent=projects/{project_id}/locations/{location}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final NotebookServiceClient.ListInstancesPagedResponse listInstances(ListInstancesRequest request)
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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListInstancesRequest,NotebookServiceClient.ListInstancesPagedResponse> listInstancesPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListInstancesRequest,ListInstancesResponse> listInstancesCallable()
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;
}
}
}
public final Instance getInstance(InstanceName name)
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);
}
name - Required. Format:
`projects/{project_id}/locations/{location}/instances/{instance_id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final Instance getInstance(String name)
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);
}
name - Required. Format:
`projects/{project_id}/locations/{location}/instances/{instance_id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final Instance getInstance(GetInstanceRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetInstanceRequest,Instance> getInstanceCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> createInstanceAsync(LocationName parent, Instance instance, String instanceId)
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();
}
parent - Required. Format: `parent=projects/{project_id}/locations/{location}`instance - Required. The instance to be created.instanceId - Required. User-defined unique ID of this instance.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> createInstanceAsync(String parent, Instance instance, String instanceId)
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();
}
parent - Required. Format: `parent=projects/{project_id}/locations/{location}`instance - Required. The instance to be created.instanceId - Required. User-defined unique ID of this instance.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> createInstanceAsync(CreateInstanceRequest request)
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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateInstanceRequest,Instance,OperationMetadata> createInstanceOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateInstanceRequest,com.google.longrunning.Operation> createInstanceCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> updateInstanceAsync(Instance instance, com.google.protobuf.FieldMask updateMask)
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();
}
instance - Required. A representation of an instance.updateMask - Required. Mask used to update an instancecom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> updateInstanceAsync(UpdateInstanceRequest request)
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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdateInstanceRequest,Instance,OperationMetadata> updateInstanceOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateInstanceRequest,com.google.longrunning.Operation> updateInstanceCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteInstanceAsync(InstanceName name)
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();
}
name - Required. Format:
`projects/{project_id}/locations/{location}/instances/{instance_id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteInstanceAsync(String name)
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();
}
name - Required. Format:
`projects/{project_id}/locations/{location}/instances/{instance_id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteInstanceAsync(DeleteInstanceRequest request)
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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteInstanceRequest,com.google.protobuf.Empty,OperationMetadata> deleteInstanceOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteInstanceRequest,com.google.longrunning.Operation> deleteInstanceCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> startInstanceAsync(StartInstanceRequest request)
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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<StartInstanceRequest,Instance,OperationMetadata> startInstanceOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<StartInstanceRequest,com.google.longrunning.Operation> startInstanceCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> stopInstanceAsync(StopInstanceRequest request)
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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<StopInstanceRequest,Instance,OperationMetadata> stopInstanceOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<StopInstanceRequest,com.google.longrunning.Operation> stopInstanceCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> resetInstanceAsync(ResetInstanceRequest request)
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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<ResetInstanceRequest,Instance,OperationMetadata> resetInstanceOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<ResetInstanceRequest,com.google.longrunning.Operation> resetInstanceCallable()
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();
}
public final CheckInstanceUpgradabilityResponse checkInstanceUpgradability(CheckInstanceUpgradabilityRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CheckInstanceUpgradabilityRequest,CheckInstanceUpgradabilityResponse> checkInstanceUpgradabilityCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> upgradeInstanceAsync(UpgradeInstanceRequest request)
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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpgradeInstanceRequest,Instance,OperationMetadata> upgradeInstanceOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<UpgradeInstanceRequest,com.google.longrunning.Operation> upgradeInstanceCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> rollbackInstanceAsync(RollbackInstanceRequest request)
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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<RollbackInstanceRequest,Instance,OperationMetadata> rollbackInstanceOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<RollbackInstanceRequest,com.google.longrunning.Operation> rollbackInstanceCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> diagnoseInstanceAsync(InstanceName name, DiagnosticConfig diagnosticConfig)
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();
}
name - Required. Format:
`projects/{project_id}/locations/{location}/instances/{instance_id}`diagnosticConfig - Required. Defines flags that are used to run the diagnostic toolcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> diagnoseInstanceAsync(String name, DiagnosticConfig diagnosticConfig)
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();
}
name - Required. Format:
`projects/{project_id}/locations/{location}/instances/{instance_id}`diagnosticConfig - Required. Defines flags that are used to run the diagnostic toolcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> diagnoseInstanceAsync(DiagnoseInstanceRequest request)
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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DiagnoseInstanceRequest,Instance,OperationMetadata> diagnoseInstanceOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<DiagnoseInstanceRequest,com.google.longrunning.Operation> diagnoseInstanceCallable()
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();
}
public final NotebookServiceClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,NotebookServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
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;
}
}
}
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
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();
}
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
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();
}
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
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();
}
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
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();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2023 Google LLC. All rights reserved.