Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

feat: Update Notebooks API for clients libraries #372

Merged
merged 2 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ public final OperationFuture<Runtime, OperationMetadata> createRuntimeAsync(
* .setParent(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
* .setRuntimeId("runtimeId121455379")
* .setRuntime(Runtime.newBuilder().build())
* .setRequestId("requestId693933066")
* .build();
* Runtime response = managedNotebookServiceClient.createRuntimeAsync(request).get();
* }
Expand Down Expand Up @@ -512,6 +513,7 @@ public final OperationFuture<Runtime, OperationMetadata> createRuntimeAsync(
* .setParent(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
* .setRuntimeId("runtimeId121455379")
* .setRuntime(Runtime.newBuilder().build())
* .setRequestId("requestId693933066")
* .build();
* OperationFuture<Runtime, OperationMetadata> future =
* managedNotebookServiceClient.createRuntimeOperationCallable().futureCall(request);
Expand Down Expand Up @@ -539,6 +541,7 @@ public final OperationFuture<Runtime, OperationMetadata> createRuntimeAsync(
* .setParent(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
* .setRuntimeId("runtimeId121455379")
* .setRuntime(Runtime.newBuilder().build())
* .setRequestId("requestId693933066")
* .build();
* ApiFuture<Operation> future =
* managedNotebookServiceClient.createRuntimeCallable().futureCall(request);
Expand Down Expand Up @@ -610,6 +613,7 @@ public final OperationFuture<Empty, OperationMetadata> deleteRuntimeAsync(String
* DeleteRuntimeRequest request =
* DeleteRuntimeRequest.newBuilder()
* .setName(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
* .setRequestId("requestId693933066")
* .build();
* managedNotebookServiceClient.deleteRuntimeAsync(request).get();
* }
Expand All @@ -635,6 +639,7 @@ public final OperationFuture<Empty, OperationMetadata> deleteRuntimeAsync(
* DeleteRuntimeRequest request =
* DeleteRuntimeRequest.newBuilder()
* .setName(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
* .setRequestId("requestId693933066")
* .build();
* OperationFuture<Empty, OperationMetadata> future =
* managedNotebookServiceClient.deleteRuntimeOperationCallable().futureCall(request);
Expand All @@ -660,6 +665,7 @@ public final OperationFuture<Empty, OperationMetadata> deleteRuntimeAsync(
* DeleteRuntimeRequest request =
* DeleteRuntimeRequest.newBuilder()
* .setName(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
* .setRequestId("requestId693933066")
* .build();
* ApiFuture<Operation> future =
* managedNotebookServiceClient.deleteRuntimeCallable().futureCall(request);
Expand Down Expand Up @@ -708,7 +714,11 @@ public final OperationFuture<Runtime, OperationMetadata> startRuntimeAsync(Strin
* <pre>{@code
* try (ManagedNotebookServiceClient managedNotebookServiceClient =
* ManagedNotebookServiceClient.create()) {
* StartRuntimeRequest request = StartRuntimeRequest.newBuilder().setName("name3373707").build();
* StartRuntimeRequest request =
* StartRuntimeRequest.newBuilder()
* .setName("name3373707")
* .setRequestId("requestId693933066")
* .build();
* Runtime response = managedNotebookServiceClient.startRuntimeAsync(request).get();
* }
* }</pre>
Expand All @@ -732,7 +742,11 @@ public final OperationFuture<Runtime, OperationMetadata> startRuntimeAsync(
* <pre>{@code
* try (ManagedNotebookServiceClient managedNotebookServiceClient =
* ManagedNotebookServiceClient.create()) {
* StartRuntimeRequest request = StartRuntimeRequest.newBuilder().setName("name3373707").build();
* StartRuntimeRequest request =
* StartRuntimeRequest.newBuilder()
* .setName("name3373707")
* .setRequestId("requestId693933066")
* .build();
* OperationFuture<Runtime, OperationMetadata> future =
* managedNotebookServiceClient.startRuntimeOperationCallable().futureCall(request);
* // Do something.
Expand All @@ -756,7 +770,11 @@ public final OperationFuture<Runtime, OperationMetadata> startRuntimeAsync(
* <pre>{@code
* try (ManagedNotebookServiceClient managedNotebookServiceClient =
* ManagedNotebookServiceClient.create()) {
* StartRuntimeRequest request = StartRuntimeRequest.newBuilder().setName("name3373707").build();
* StartRuntimeRequest request =
* StartRuntimeRequest.newBuilder()
* .setName("name3373707")
* .setRequestId("requestId693933066")
* .build();
* ApiFuture<Operation> future =
* managedNotebookServiceClient.startRuntimeCallable().futureCall(request);
* // Do something.
Expand Down Expand Up @@ -804,7 +822,11 @@ public final OperationFuture<Runtime, OperationMetadata> stopRuntimeAsync(String
* <pre>{@code
* try (ManagedNotebookServiceClient managedNotebookServiceClient =
* ManagedNotebookServiceClient.create()) {
* StopRuntimeRequest request = StopRuntimeRequest.newBuilder().setName("name3373707").build();
* StopRuntimeRequest request =
* StopRuntimeRequest.newBuilder()
* .setName("name3373707")
* .setRequestId("requestId693933066")
* .build();
* Runtime response = managedNotebookServiceClient.stopRuntimeAsync(request).get();
* }
* }</pre>
Expand All @@ -828,7 +850,11 @@ public final OperationFuture<Runtime, OperationMetadata> stopRuntimeAsync(
* <pre>{@code
* try (ManagedNotebookServiceClient managedNotebookServiceClient =
* ManagedNotebookServiceClient.create()) {
* StopRuntimeRequest request = StopRuntimeRequest.newBuilder().setName("name3373707").build();
* StopRuntimeRequest request =
* StopRuntimeRequest.newBuilder()
* .setName("name3373707")
* .setRequestId("requestId693933066")
* .build();
* OperationFuture<Runtime, OperationMetadata> future =
* managedNotebookServiceClient.stopRuntimeOperationCallable().futureCall(request);
* // Do something.
Expand All @@ -852,7 +878,11 @@ public final OperationFuture<Runtime, OperationMetadata> stopRuntimeAsync(
* <pre>{@code
* try (ManagedNotebookServiceClient managedNotebookServiceClient =
* ManagedNotebookServiceClient.create()) {
* StopRuntimeRequest request = StopRuntimeRequest.newBuilder().setName("name3373707").build();
* StopRuntimeRequest request =
* StopRuntimeRequest.newBuilder()
* .setName("name3373707")
* .setRequestId("requestId693933066")
* .build();
* ApiFuture<Operation> future =
* managedNotebookServiceClient.stopRuntimeCallable().futureCall(request);
* // Do something.
Expand Down Expand Up @@ -901,6 +931,7 @@ public final OperationFuture<Runtime, OperationMetadata> switchRuntimeAsync(Stri
* .setName("name3373707")
* .setMachineType("machineType-218117087")
* .setAcceleratorConfig(RuntimeAcceleratorConfig.newBuilder().build())
* .setRequestId("requestId693933066")
* .build();
* Runtime response = managedNotebookServiceClient.switchRuntimeAsync(request).get();
* }
Expand Down Expand Up @@ -928,6 +959,7 @@ public final OperationFuture<Runtime, OperationMetadata> switchRuntimeAsync(
* .setName("name3373707")
* .setMachineType("machineType-218117087")
* .setAcceleratorConfig(RuntimeAcceleratorConfig.newBuilder().build())
* .setRequestId("requestId693933066")
* .build();
* OperationFuture<Runtime, OperationMetadata> future =
* managedNotebookServiceClient.switchRuntimeOperationCallable().futureCall(request);
Expand Down Expand Up @@ -955,6 +987,7 @@ public final OperationFuture<Runtime, OperationMetadata> switchRuntimeAsync(
* .setName("name3373707")
* .setMachineType("machineType-218117087")
* .setAcceleratorConfig(RuntimeAcceleratorConfig.newBuilder().build())
* .setRequestId("requestId693933066")
* .build();
* ApiFuture<Operation> future =
* managedNotebookServiceClient.switchRuntimeCallable().futureCall(request);
Expand Down Expand Up @@ -999,7 +1032,11 @@ public final OperationFuture<Runtime, OperationMetadata> resetRuntimeAsync(Strin
* <pre>{@code
* try (ManagedNotebookServiceClient managedNotebookServiceClient =
* ManagedNotebookServiceClient.create()) {
* ResetRuntimeRequest request = ResetRuntimeRequest.newBuilder().setName("name3373707").build();
* ResetRuntimeRequest request =
* ResetRuntimeRequest.newBuilder()
* .setName("name3373707")
* .setRequestId("requestId693933066")
* .build();
* Runtime response = managedNotebookServiceClient.resetRuntimeAsync(request).get();
* }
* }</pre>
Expand All @@ -1021,7 +1058,11 @@ public final OperationFuture<Runtime, OperationMetadata> resetRuntimeAsync(
* <pre>{@code
* try (ManagedNotebookServiceClient managedNotebookServiceClient =
* ManagedNotebookServiceClient.create()) {
* ResetRuntimeRequest request = ResetRuntimeRequest.newBuilder().setName("name3373707").build();
* ResetRuntimeRequest request =
* ResetRuntimeRequest.newBuilder()
* .setName("name3373707")
* .setRequestId("requestId693933066")
* .build();
* OperationFuture<Runtime, OperationMetadata> future =
* managedNotebookServiceClient.resetRuntimeOperationCallable().futureCall(request);
* // Do something.
Expand All @@ -1043,7 +1084,11 @@ public final OperationFuture<Runtime, OperationMetadata> resetRuntimeAsync(
* <pre>{@code
* try (ManagedNotebookServiceClient managedNotebookServiceClient =
* ManagedNotebookServiceClient.create()) {
* ResetRuntimeRequest request = ResetRuntimeRequest.newBuilder().setName("name3373707").build();
* ResetRuntimeRequest request =
* ResetRuntimeRequest.newBuilder()
* .setName("name3373707")
* .setRequestId("requestId693933066")
* .build();
* ApiFuture<Operation> future =
* managedNotebookServiceClient.resetRuntimeCallable().futureCall(request);
* // Do something.
Expand Down Expand Up @@ -1186,6 +1231,125 @@ public final UnaryCallable<ReportRuntimeEventRequest, Operation> reportRuntimeEv
return stub.reportRuntimeEventCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets an access token for the consumer service account that the customer attached to the
* runtime. Only accessible from the tenant instance.
*
* <p>Sample code:
*
* <pre>{@code
* try (ManagedNotebookServiceClient managedNotebookServiceClient =
* ManagedNotebookServiceClient.create()) {
* RuntimeName name = RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]");
* String vmId = "vmId3622450";
* RefreshRuntimeTokenInternalResponse response =
* managedNotebookServiceClient.refreshRuntimeTokenInternal(name, vmId);
* }
* }</pre>
*
* @param name Required. Format:
* `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
* @param vmId Required. The VM hardware token for authenticating the VM.
* https://cloud.google.com/compute/docs/instances/verifying-instance-identity
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final RefreshRuntimeTokenInternalResponse refreshRuntimeTokenInternal(
RuntimeName name, String vmId) {
RefreshRuntimeTokenInternalRequest request =
RefreshRuntimeTokenInternalRequest.newBuilder()
.setName(name == null ? null : name.toString())
.setVmId(vmId)
.build();
return refreshRuntimeTokenInternal(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets an access token for the consumer service account that the customer attached to the
* runtime. Only accessible from the tenant instance.
*
* <p>Sample code:
*
* <pre>{@code
* try (ManagedNotebookServiceClient managedNotebookServiceClient =
* ManagedNotebookServiceClient.create()) {
* String name = RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString();
* String vmId = "vmId3622450";
* RefreshRuntimeTokenInternalResponse response =
* managedNotebookServiceClient.refreshRuntimeTokenInternal(name, vmId);
* }
* }</pre>
*
* @param name Required. Format:
* `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
* @param vmId Required. The VM hardware token for authenticating the VM.
* https://cloud.google.com/compute/docs/instances/verifying-instance-identity
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final RefreshRuntimeTokenInternalResponse refreshRuntimeTokenInternal(
String name, String vmId) {
RefreshRuntimeTokenInternalRequest request =
RefreshRuntimeTokenInternalRequest.newBuilder().setName(name).setVmId(vmId).build();
return refreshRuntimeTokenInternal(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets an access token for the consumer service account that the customer attached to the
* runtime. Only accessible from the tenant instance.
*
* <p>Sample code:
*
* <pre>{@code
* try (ManagedNotebookServiceClient managedNotebookServiceClient =
* ManagedNotebookServiceClient.create()) {
* RefreshRuntimeTokenInternalRequest request =
* RefreshRuntimeTokenInternalRequest.newBuilder()
* .setName(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
* .setVmId("vmId3622450")
* .build();
* RefreshRuntimeTokenInternalResponse response =
* managedNotebookServiceClient.refreshRuntimeTokenInternal(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final RefreshRuntimeTokenInternalResponse refreshRuntimeTokenInternal(
RefreshRuntimeTokenInternalRequest request) {
return refreshRuntimeTokenInternalCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets an access token for the consumer service account that the customer attached to the
* runtime. Only accessible from the tenant instance.
*
* <p>Sample code:
*
* <pre>{@code
* try (ManagedNotebookServiceClient managedNotebookServiceClient =
* ManagedNotebookServiceClient.create()) {
* RefreshRuntimeTokenInternalRequest request =
* RefreshRuntimeTokenInternalRequest.newBuilder()
* .setName(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
* .setVmId("vmId3622450")
* .build();
* ApiFuture<RefreshRuntimeTokenInternalResponse> future =
* managedNotebookServiceClient.refreshRuntimeTokenInternalCallable().futureCall(request);
* // Do something.
* RefreshRuntimeTokenInternalResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<
RefreshRuntimeTokenInternalRequest, RefreshRuntimeTokenInternalResponse>
refreshRuntimeTokenInternalCallable() {
return stub.refreshRuntimeTokenInternalCallable();
}

@Override
public final void close() {
stub.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ public UnaryCallSettings<ReportRuntimeEventRequest, Operation> reportRuntimeEven
.reportRuntimeEventOperationSettings();
}

/** Returns the object with the settings used for calls to refreshRuntimeTokenInternal. */
public UnaryCallSettings<RefreshRuntimeTokenInternalRequest, RefreshRuntimeTokenInternalResponse>
refreshRuntimeTokenInternalSettings() {
return ((ManagedNotebookServiceStubSettings) getStubSettings())
.refreshRuntimeTokenInternalSettings();
}

public static final ManagedNotebookServiceSettings create(ManagedNotebookServiceStubSettings stub)
throws IOException {
return new ManagedNotebookServiceSettings.Builder(stub.toBuilder()).build();
Expand Down Expand Up @@ -353,6 +360,13 @@ public UnaryCallSettings.Builder<ResetRuntimeRequest, Operation> resetRuntimeSet
return getStubSettingsBuilder().reportRuntimeEventOperationSettings();
}

/** Returns the builder for the settings used for calls to refreshRuntimeTokenInternal. */
public UnaryCallSettings.Builder<
RefreshRuntimeTokenInternalRequest, RefreshRuntimeTokenInternalResponse>
refreshRuntimeTokenInternalSettings() {
return getStubSettingsBuilder().refreshRuntimeTokenInternalSettings();
}

@Override
public ManagedNotebookServiceSettings build() throws IOException {
return new ManagedNotebookServiceSettings(this);
Expand Down
Loading