Skip to content

Commit

Permalink
feat: added UpdateRuntime, UpgradeRuntime, DiagnoseRuntime, DiagnoseI…
Browse files Browse the repository at this point in the history
…nstance to v1 API

feat: add Instance.reservation_affinity, nic_type, can_ip_forward to v1beta1 API
feat: add IsInstanceUpgradeableResponse.upgrade_image to v1beta1 API
feat: added Location and IAM methods
fix: deprecate AcceleratorType.NVIDIA_TESLA_K80

PiperOrigin-RevId: 489032946
  • Loading branch information
Google APIs authored and Copybara-Service committed Nov 16, 2022
1 parent 8f503d7 commit 1d21a86
Show file tree
Hide file tree
Showing 12 changed files with 451 additions and 125 deletions.
27 changes: 17 additions & 10 deletions google/cloud/notebooks/v1/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
proto_library(
name = "notebooks_proto",
srcs = [
"diagnostic_config.proto",
"environment.proto",
"event.proto",
"execution.proto",
Expand All @@ -37,6 +38,7 @@ proto_library(
"//google/api:field_behavior_proto",
"//google/api:resource_proto",
"//google/longrunning:operations_proto",
"@com_google_protobuf//:field_mask_proto",
"@com_google_protobuf//:timestamp_proto",
],
)
Expand All @@ -47,6 +49,7 @@ proto_library_with_info(
":notebooks_proto",
"//google/cloud:common_resources_proto",
"//google/cloud/location:location_proto",
"//google/iam/v1:iam_policy_proto",
],
)

Expand Down Expand Up @@ -83,13 +86,14 @@ java_gapic_library(
test_deps = [
":notebooks_java_grpc",
"//google/cloud/location:location_java_grpc",
"//google/iam/v1:iam_java_grpc",
],
transport = "grpc",
deps = [
":notebooks_java_proto",
"//google/api:api_java_proto",
"//google/cloud/location:location_java_grpc",
"//google/cloud/location:location_java_proto",
"//google/iam/v1:iam_java_proto",
],
)

Expand All @@ -106,15 +110,12 @@ java_gapic_test(
java_gapic_assembly_gradle_pkg(
name = "google-cloud-notebooks-v1-java",
include_samples = True,
transport = "grpc",
transport = "grpc+rest",
deps = [
":notebooks_java_gapic",
":notebooks_java_grpc",
":notebooks_java_proto",
":notebooks_proto",
"//google/cloud/location:location_java_grpc",
"//google/cloud/location:location_java_proto",
"//google/cloud/location:location_proto",
],
)

Expand All @@ -136,7 +137,6 @@ go_proto_library(
protos = [":notebooks_proto"],
deps = [
"//google/api:annotations_go_proto",
"//google/cloud/location:location_go_proto",
"//google/longrunning:longrunning_go_proto",
],
)
Expand All @@ -149,9 +149,11 @@ go_gapic_library(
metadata = True,
rest_numeric_enums = False,
service_yaml = "notebooks_v1.yaml",
transport = "grpc+rest",
deps = [
":notebooks_go_proto",
"//google/cloud/location:location_go_proto",
"//google/iam/v1:iam_go_proto",
"//google/longrunning:longrunning_go_proto",
"@com_google_cloud_go//longrunning:go_default_library",
"@com_google_cloud_go//longrunning/autogen:go_default_library",
Expand Down Expand Up @@ -191,7 +193,11 @@ py_gapic_library(
srcs = [":notebooks_proto"],
grpc_service_config = "notebooks_grpc_service_config.json",
rest_numeric_enums = False,
service_yaml = "notebooks_v1.yaml",
transport = "grpc",
deps = [
"//google/iam/v1:iam_policy_py_proto",
],
)

py_test(
Expand Down Expand Up @@ -311,18 +317,19 @@ ruby_grpc_library(

ruby_cloud_gapic_library(
name = "notebooks_ruby_gapic",
srcs = [":notebooks_proto"],
srcs = [":notebooks_proto_with_info"],
extra_protoc_parameters = [
"ruby-cloud-gem-name=google-cloud-notebooks-v1",
"ruby-cloud-env-prefix=NOTEBOOKS",
"ruby-cloud-product-url=https://cloud.google.com/ai-platform-notebooks",
"ruby-cloud-api-id=notebooks.googleapis.com",
"ruby-cloud-api-shortname=notebooks",
"ruby-cloud-env-prefix=NOTEBOOKS",
"ruby-cloud-gem-name=google-cloud-notebooks-v1",
"ruby-cloud-product-url=https://cloud.google.com/ai-platform-notebooks",
],
grpc_service_config = "notebooks_grpc_service_config.json",
rest_numeric_enums = False,
ruby_cloud_description = "AI Platform Notebooks makes it easy to manage JupyterLab instances through a protected, publicly available notebook instance URL. A JupyterLab instance is a Deep Learning virtual machine instance with the latest machine learning and data science libraries pre-installed.",
ruby_cloud_title = "AI Platform Notebooks V1",
service_yaml = "notebooks_v1.yaml",
deps = [
":notebooks_ruby_grpc",
":notebooks_ruby_proto",
Expand Down
57 changes: 57 additions & 0 deletions google/cloud/notebooks/v1/diagnostic_config.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.notebooks.v1;

import "google/api/field_behavior.proto";

option go_package = "google.golang.org/genproto/googleapis/cloud/notebooks/v1;notebooks";
option java_multiple_files = true;
option java_outer_classname = "DiagnosticConfigProto";
option java_package = "com.google.cloud.notebooks.v1";

// Defines flags that are used to run the diagnostic tool
message DiagnosticConfig {
// Required. User Cloud Storage bucket location (REQUIRED)
// ## Must be formatted with path prefix (gs://$GCS_BUCKET)
//
// Permissions:
// User Managed Notebooks:
// - storage.buckets.writer: Must be given to the project's service account
// attached to VM.
// Google Managed Notebooks:
// - storage.buckets.writer: Must be given to the project's service account or
// ## user credentials attached to VM depending on authentication mode.
//
// Cloud Storage bucket Log file will be written to
// gs://$GCS_BUCKET/$RELATIVE_PATH/$VM_DATE_$TIME.tar.gz
string gcs_bucket = 1 [(google.api.field_behavior) = REQUIRED];

// Optional. Defines the relative storage path in the Cloud Storage bucket where the
// diagnostic logs will be written: Default path will be the root directory of
// the Cloud Storage bucket (gs://$GCS_BUCKET/$DATE_$TIME.tar.gz) Example of
// full path where Log file will be written: gs://$GCS_BUCKET/$RELATIVE_PATH/
string relative_path = 2 [(google.api.field_behavior) = OPTIONAL];

// Optional. Enables flag to repair service for instance
bool repair_flag_enabled = 3 [(google.api.field_behavior) = OPTIONAL];

// Optional. Enables flag to capture packets from the instance for 30 seconds
bool packet_capture_flag_enabled = 4 [(google.api.field_behavior) = OPTIONAL];

// Optional. Enables flag to copy all `/home/jupyter` folder contents
bool copy_home_files_flag_enabled = 5 [(google.api.field_behavior) = OPTIONAL];
}
102 changes: 102 additions & 0 deletions google/cloud/notebooks/v1/managed_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/notebooks/v1/diagnostic_config.proto";
import "google/cloud/notebooks/v1/event.proto";
import "google/cloud/notebooks/v1/runtime.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.Notebooks.V1";
Expand Down Expand Up @@ -68,6 +70,19 @@ service ManagedNotebookService {
};
}

// Update Notebook Runtime configuration.
rpc UpdateRuntime(UpdateRuntimeRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
patch: "/v1/{runtime.name=projects/*/locations/*/runtimes/*}"
body: "runtime"
};
option (google.api.method_signature) = "runtime,update_mask";
option (google.longrunning.operation_info) = {
response_type: "Runtime"
metadata_type: "OperationMetadata"
};
}

// Deletes a single Runtime.
rpc DeleteRuntime(DeleteRuntimeRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
Expand Down Expand Up @@ -140,6 +155,19 @@ service ManagedNotebookService {
};
}

// Upgrades a Managed Notebook Runtime to the latest version.
rpc UpgradeRuntime(UpgradeRuntimeRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{name=projects/*/locations/*/runtimes/*}:upgrade"
body: "*"
};
option (google.api.method_signature) = "name";
option (google.longrunning.operation_info) = {
response_type: "Runtime"
metadata_type: "OperationMetadata"
};
}

// Report and process a runtime event.
rpc ReportRuntimeEvent(ReportRuntimeEventRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
Expand All @@ -162,6 +190,19 @@ service ManagedNotebookService {
};
option (google.api.method_signature) = "name,vm_id";
}

// Creates a Diagnostic File and runs Diagnostic Tool given a Runtime.
rpc DiagnoseRuntime(DiagnoseRuntimeRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{name=projects/*/locations/*/runtimes/*}:diagnose"
body: "*"
};
option (google.api.method_signature) = "name,diagnostic_config";
option (google.longrunning.operation_info) = {
response_type: "Runtime"
metadata_type: "OperationMetadata"
};
}
}

// Request for listing Managed Notebook Runtimes.
Expand Down Expand Up @@ -292,6 +333,18 @@ message ResetRuntimeRequest {
string request_id = 2;
}

// Request for upgrading a Managed Notebook Runtime to the latest version.
// option (google.api.message_visibility).restriction =
// "TRUSTED_TESTER,SPECIAL_TESTER";
message UpgradeRuntimeRequest {
// Required. Format:
// `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
string name = 1 [(google.api.field_behavior) = REQUIRED];

// Idempotent request UUID.
string request_id = 2;
}

// Request for reporting a Managed Notebook Event.
message ReportRuntimeEventRequest {
// Required. Format:
Expand All @@ -311,6 +364,40 @@ message ReportRuntimeEventRequest {
Event event = 3 [(google.api.field_behavior) = REQUIRED];
}

// Request for updating a Managed Notebook configuration.
message UpdateRuntimeRequest {
// Required. The Runtime to be updated.
Runtime runtime = 1 [(google.api.field_behavior) = REQUIRED];

// Required. Specifies the path, relative to `Runtime`, of
// the field to update. For example, to change the software configuration
// kernels, the `update_mask` parameter would be
// specified as `software_config.kernels`,
// and the `PATCH` request body would specify the new value, as follows:
//
// {
// "software_config":{
// "kernels": [{
// 'repository':
// 'gcr.io/deeplearning-platform-release/pytorch-gpu', 'tag':
// 'latest' }],
// }
// }
//
//
// Currently, only the following fields can be updated:
// - software_config.kernels
// - software_config.post_startup_script
// - software_config.custom_gpu_driver_path
// - software_config.idle_shutdown
// - software_config.idle_shutdown_timeout
// - software_config.disable_terminal
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];

// Idempotent request UUID.
string request_id = 3;
}

// Request for getting a new access token.
message RefreshRuntimeTokenInternalRequest {
// Required. Format:
Expand All @@ -335,3 +422,18 @@ message RefreshRuntimeTokenInternalResponse {
// Output only. Token expiration time.
google.protobuf.Timestamp expire_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for creating a notebook instance diagnostic file.
message DiagnoseRuntimeRequest {
// Required. Format:
// `projects/{project_id}/locations/{location}/runtimes/{runtimes_id}`
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "notebooks.googleapis.com/Runtime"
}
];

// Required. Defines flags that are used to run the diagnostic tool
DiagnosticConfig diagnostic_config = 2 [(google.api.field_behavior) = REQUIRED];
}
5 changes: 4 additions & 1 deletion google/cloud/notebooks/v1/notebooks_grpc_service_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
{ "service": "google.cloud.notebooks.v1.NotebookService", "method": "GetExecution" },
{ "service": "google.cloud.notebooks.v1.NotebookService", "method": "CreateExecution" },
{ "service": "google.cloud.notebooks.v1.NotebookService", "method": "DeleteExecution" },
{ "service": "google.cloud.notebooks.v1.NotebookService", "method": "DiagnoseInstance" },
{ "service": "google.cloud.notebooks.v1.ManagedNotebookService", "method": "ListRuntimes" },
{ "service": "google.cloud.notebooks.v1.ManagedNotebookService", "method": "GetRuntime" },
{ "service": "google.cloud.notebooks.v1.ManagedNotebookService", "method": "CreateRuntime" },
Expand All @@ -55,7 +56,9 @@
{ "service": "google.cloud.notebooks.v1.ManagedNotebookService", "method": "StopRuntime" },
{ "service": "google.cloud.notebooks.v1.ManagedNotebookService", "method": "SwitchRuntime" },
{ "service": "google.cloud.notebooks.v1.ManagedNotebookService", "method": "RollbackRuntime" },
{ "service": "google.cloud.notebooks.v1.ManagedNotebookService", "method": "ReportRuntimeEvent" }
{ "service": "google.cloud.notebooks.v1.ManagedNotebookService", "method": "ReportRuntimeEvent" },
{ "service": "google.cloud.notebooks.v1.ManagedNotebookService", "method": "UpdateRuntime" },
{ "service": "google.cloud.notebooks.v1.ManagedNotebookService", "method": "DiagnoseRuntime" }
],
"timeout": "60s"
},
Expand Down
3 changes: 3 additions & 0 deletions google/cloud/notebooks/v1/notebooks_v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ name: notebooks.googleapis.com
title: Notebooks API

apis:
- name: google.cloud.location.Locations
- name: google.cloud.notebooks.v1.ManagedNotebookService
- name: google.cloud.notebooks.v1.NotebookService
- name: google.iam.v1.IAMPolicy
- name: google.longrunning.Operations

types:
- name: google.cloud.notebooks.v1.OperationMetadata
Expand Down
Loading

0 comments on commit 1d21a86

Please sign in to comment.