From 1fcc1d72eea2bce7ea72a95fd7facef32016be78 Mon Sep 17 00:00:00 2001 From: Google APIs Date: Fri, 11 Aug 2023 13:54:36 -0700 Subject: [PATCH] feat: clients for Notebooks API V2 docs: supports Workbench Instances https://cloud.google.com/vertex-ai/docs/workbench/reference/rest PiperOrigin-RevId: 556078727 --- google/cloud/notebooks/logging/v1/BUILD.bazel | 18 +- google/cloud/notebooks/v1/BUILD.bazel | 10 +- google/cloud/notebooks/v1beta1/BUILD.bazel | 11 +- google/cloud/notebooks/v2/BUILD.bazel | 391 +++++++++++++++++ .../notebooks/v2/diagnostic_config.proto | 61 +++ google/cloud/notebooks/v2/event.proto | 70 +++ google/cloud/notebooks/v2/gce_setup.proto | 340 +++++++++++++++ google/cloud/notebooks/v2/instance.proto | 231 ++++++++++ .../v2/notebooks_grpc_service_config.json | 65 +++ google/cloud/notebooks/v2/notebooks_v2.yaml | 107 +++++ google/cloud/notebooks/v2/service.proto | 406 ++++++++++++++++++ 11 files changed, 1699 insertions(+), 11 deletions(-) create mode 100644 google/cloud/notebooks/v2/BUILD.bazel create mode 100644 google/cloud/notebooks/v2/diagnostic_config.proto create mode 100644 google/cloud/notebooks/v2/event.proto create mode 100644 google/cloud/notebooks/v2/gce_setup.proto create mode 100644 google/cloud/notebooks/v2/instance.proto create mode 100644 google/cloud/notebooks/v2/notebooks_grpc_service_config.json create mode 100644 google/cloud/notebooks/v2/notebooks_v2.yaml create mode 100644 google/cloud/notebooks/v2/service.proto diff --git a/google/cloud/notebooks/logging/v1/BUILD.bazel b/google/cloud/notebooks/logging/v1/BUILD.bazel index c0a2babbde..a3858790bd 100644 --- a/google/cloud/notebooks/logging/v1/BUILD.bazel +++ b/google/cloud/notebooks/logging/v1/BUILD.bazel @@ -44,6 +44,7 @@ java_grpc_library( load( "@com_google_googleapis_imports//:imports.bzl", "go_proto_library", + "go_gapic_assembly_pkg", ) go_proto_library( @@ -56,6 +57,13 @@ go_proto_library( ], ) +go_gapic_assembly_pkg( + name = "logging-v1-go", + deps = [ + ":logging_go_proto", + ], +) + ############################################################################## # Python ############################################################################## @@ -90,6 +98,7 @@ py_grpc_library( ############################################################################## load( "@com_google_googleapis_imports//:imports.bzl", + "php_gapic_assembly_pkg", "php_proto_library", ) @@ -98,9 +107,12 @@ php_proto_library( deps = [":logging_proto"], ) -############################################################################## -# Node.js -############################################################################## +php_gapic_assembly_pkg( + name = "logging-v1-php", + deps = [ + ":logging_php_proto", + ], +) ############################################################################## # Ruby diff --git a/google/cloud/notebooks/v1/BUILD.bazel b/google/cloud/notebooks/v1/BUILD.bazel index 79dcd86524..98072aaa18 100644 --- a/google/cloud/notebooks/v1/BUILD.bazel +++ b/google/cloud/notebooks/v1/BUILD.bazel @@ -38,7 +38,6 @@ proto_library( "//google/api:field_behavior_proto", "//google/api:resource_proto", "//google/longrunning:operations_proto", - "@com_google_protobuf//:empty_proto", "@com_google_protobuf//:field_mask_proto", "@com_google_protobuf//:timestamp_proto", ], @@ -85,9 +84,9 @@ java_gapic_library( rest_numeric_enums = True, service_yaml = "notebooks_v1.yaml", test_deps = [ - ":notebooks_java_grpc", "//google/cloud/location:location_java_grpc", "//google/iam/v1:iam_java_grpc", + ":notebooks_java_grpc", ], transport = "grpc", deps = [ @@ -111,7 +110,7 @@ java_gapic_test( java_gapic_assembly_gradle_pkg( name = "google-cloud-notebooks-v1-java", include_samples = True, - transport = "grpc+rest", + transport = "grpc", deps = [ ":notebooks_java_gapic", ":notebooks_java_grpc", @@ -236,7 +235,9 @@ php_gapic_library( rest_numeric_enums = True, service_yaml = "notebooks_v1.yaml", transport = "grpc+rest", - deps = [":notebooks_php_proto"], + deps = [ + ":notebooks_php_proto", + ], ) # Open Source Packages @@ -345,6 +346,7 @@ load( csharp_proto_library( name = "notebooks_csharp_proto", + extra_opts = [], deps = [":notebooks_proto"], ) diff --git a/google/cloud/notebooks/v1beta1/BUILD.bazel b/google/cloud/notebooks/v1beta1/BUILD.bazel index 37b772f6c0..893304e4e5 100644 --- a/google/cloud/notebooks/v1beta1/BUILD.bazel +++ b/google/cloud/notebooks/v1beta1/BUILD.bazel @@ -31,7 +31,6 @@ proto_library( "//google/api:field_behavior_proto", "//google/api:resource_proto", "//google/longrunning:operations_proto", - "@com_google_protobuf//:empty_proto", "@com_google_protobuf//:timestamp_proto", ], ) @@ -77,9 +76,9 @@ java_gapic_library( rest_numeric_enums = True, service_yaml = "notebooks_v1beta1.yaml", test_deps = [ - ":notebooks_java_grpc", "//google/cloud/location:location_java_grpc", "//google/iam/v1:iam_java_grpc", + ":notebooks_java_grpc", ], transport = "grpc", deps = [ @@ -102,7 +101,7 @@ java_gapic_test( java_gapic_assembly_gradle_pkg( name = "google-cloud-notebooks-v1beta1-java", include_samples = True, - transport = "grpc+rest", + transport = "grpc", deps = [ ":notebooks_java_gapic", ":notebooks_java_grpc", @@ -223,10 +222,13 @@ php_gapic_library( name = "notebooks_php_gapic", srcs = [":notebooks_proto_with_info"], grpc_service_config = "notebooks_grpc_service_config.json", + migration_mode = "PRE_MIGRATION_SURFACE_ONLY", rest_numeric_enums = True, service_yaml = "notebooks_v1beta1.yaml", transport = "grpc+rest", - deps = [":notebooks_php_proto"], + deps = [ + ":notebooks_php_proto", + ], ) # Open Source Packages @@ -335,6 +337,7 @@ load( csharp_proto_library( name = "notebooks_csharp_proto", + extra_opts = [], deps = [":notebooks_proto"], ) diff --git a/google/cloud/notebooks/v2/BUILD.bazel b/google/cloud/notebooks/v2/BUILD.bazel new file mode 100644 index 0000000000..d70ed8ab38 --- /dev/null +++ b/google/cloud/notebooks/v2/BUILD.bazel @@ -0,0 +1,391 @@ +# This file was automatically generated by BuildFileGenerator +# https://github.com/googleapis/rules_gapic/tree/master/bazel + +# Most of the manual changes to this file will be overwritten. +# It's **only** allowed to change the following rule attribute values: +# - names of *_gapic_assembly_* rules +# - certain parameters of *_gapic_library rules, including but not limited to: +# * extra_protoc_parameters +# * extra_protoc_file_parameters +# The complete list of preserved parameters can be found in the source code. + +# This is an API workspace, having public visibility by default makes perfect sense. +package(default_visibility = ["//visibility:public"]) + +############################################################################## +# Common +############################################################################## +load("@rules_proto//proto:defs.bzl", "proto_library") +load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info") + +proto_library( + name = "notebooks_proto", + srcs = [ + "diagnostic_config.proto", + "event.proto", + "gce_setup.proto", + "instance.proto", + "service.proto", + ], + deps = [ + "//google/api:annotations_proto", + "//google/api:client_proto", + "//google/api:field_behavior_proto", + "//google/api:resource_proto", + "//google/longrunning:operations_proto", + "@com_google_protobuf//:empty_proto", + "@com_google_protobuf//:field_mask_proto", + "@com_google_protobuf//:timestamp_proto", + ], +) + +proto_library_with_info( + name = "notebooks_proto_with_info", + deps = [ + ":notebooks_proto", + "//google/cloud/location:location_proto", + "//google/cloud:common_resources_proto", + "//google/iam/v1:iam_policy_proto", + ], +) + +############################################################################## +# Java +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "java_gapic_assembly_gradle_pkg", + "java_gapic_library", + "java_gapic_test", + "java_grpc_library", + "java_proto_library", +) + +java_proto_library( + name = "notebooks_java_proto", + deps = [":notebooks_proto"], +) + +java_grpc_library( + name = "notebooks_java_grpc", + srcs = [":notebooks_proto"], + deps = [":notebooks_java_proto"], +) + +java_gapic_library( + name = "notebooks_java_gapic", + srcs = [":notebooks_proto_with_info"], + gapic_yaml = None, + grpc_service_config = "notebooks_grpc_service_config.json", + rest_numeric_enums = True, + service_yaml = "notebooks_v2.yaml", + test_deps = [ + "//google/cloud/location:location_java_grpc", + "//google/iam/v1:iam_java_grpc", + ":notebooks_java_grpc", + ], + transport = "grpc+rest", + deps = [ + ":notebooks_java_proto", + "//google/api:api_java_proto", + "//google/cloud/location:location_java_proto", + "//google/iam/v1:iam_java_proto", + ], +) + +java_gapic_test( + name = "notebooks_java_gapic_test_suite", + test_classes = [ + "com.google.cloud.notebooks.v2.NotebookServiceClientHttpJsonTest", + "com.google.cloud.notebooks.v2.NotebookServiceClientTest", + ], + runtime_deps = [":notebooks_java_gapic_test"], +) + +# Open Source Packages +java_gapic_assembly_gradle_pkg( + name = "google-cloud-notebooks-v2-java", + transport = "grpc+rest", + deps = [ + ":notebooks_java_gapic", + ":notebooks_java_grpc", + ":notebooks_java_proto", + ":notebooks_proto", + ], + include_samples = True, +) + +############################################################################## +# Go +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "go_gapic_assembly_pkg", + "go_gapic_library", + "go_proto_library", +) + +go_proto_library( + name = "notebooks_go_proto", + compilers = ["@io_bazel_rules_go//proto:go_grpc"], + importpath = "cloud.google.com/go/notebooks/apiv2/notebookspb", + protos = [":notebooks_proto"], + deps = [ + "//google/api:annotations_go_proto", + "//google/longrunning:longrunning_go_proto", + ], +) + +go_gapic_library( + name = "notebooks_go_gapic", + srcs = [":notebooks_proto_with_info"], + grpc_service_config = "notebooks_grpc_service_config.json", + importpath = "cloud.google.com/go/notebooks/apiv2;notebooks", + metadata = True, + release_level = "beta", + rest_numeric_enums = True, + service_yaml = "notebooks_v2.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", + ], +) + +# Open Source Packages +go_gapic_assembly_pkg( + name = "gapi-cloud-notebooks-v2-go", + deps = [ + ":notebooks_go_gapic", + ":notebooks_go_gapic_srcjar-test.srcjar", + ":notebooks_go_gapic_srcjar-metadata.srcjar", + ":notebooks_go_gapic_srcjar-snippets.srcjar", + ":notebooks_go_proto", + ], +) + +############################################################################## +# Python +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "py_gapic_assembly_pkg", + "py_gapic_library", + "py_test", +) + +py_gapic_library( + name = "notebooks_py_gapic", + srcs = [":notebooks_proto"], + grpc_service_config = "notebooks_grpc_service_config.json", + rest_numeric_enums = True, + service_yaml = "notebooks_v2.yaml", + transport = "grpc+rest", + deps = [ + "//google/iam/v1:iam_policy_py_proto", + ], +) + +py_test( + name = "notebooks_py_gapic_test", + srcs = [ + "notebooks_py_gapic_pytest.py", + "notebooks_py_gapic_test.py", + ], + legacy_create_init = False, + deps = [":notebooks_py_gapic"], +) + +# Open Source Packages +py_gapic_assembly_pkg( + name = "notebooks-v2-py", + deps = [ + ":notebooks_py_gapic", + ], +) + +############################################################################## +# PHP +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "php_gapic_assembly_pkg", + "php_gapic_library", + "php_proto_library", +) + +php_proto_library( + name = "notebooks_php_proto", + deps = [":notebooks_proto"], +) + +php_gapic_library( + name = "notebooks_php_gapic", + srcs = [":notebooks_proto_with_info"], + grpc_service_config = "notebooks_grpc_service_config.json", + rest_numeric_enums = True, + migration_mode = "NEW_SURFACE_ONLY", + service_yaml = "notebooks_v2.yaml", + transport = "grpc+rest", + deps = [ + ":notebooks_php_proto", + ], +) + +# Open Source Packages +php_gapic_assembly_pkg( + name = "google-cloud-notebooks-v2-php", + deps = [ + ":notebooks_php_gapic", + ":notebooks_php_proto", + ], +) + +############################################################################## +# Node.js +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "nodejs_gapic_assembly_pkg", + "nodejs_gapic_library", +) + +nodejs_gapic_library( + name = "notebooks_nodejs_gapic", + package_name = "@google-cloud/notebooks", + src = ":notebooks_proto_with_info", + extra_protoc_parameters = ["metadata"], + grpc_service_config = "notebooks_grpc_service_config.json", + package = "google.cloud.notebooks.v2", + rest_numeric_enums = True, + service_yaml = "notebooks_v2.yaml", + transport = "grpc+rest", + deps = [], +) + +nodejs_gapic_assembly_pkg( + name = "notebooks-v2-nodejs", + deps = [ + ":notebooks_nodejs_gapic", + ":notebooks_proto", + ], +) + +############################################################################## +# Ruby +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "ruby_gapic_assembly_pkg", + "ruby_cloud_gapic_library", + "ruby_grpc_library", + "ruby_proto_library", +) + +ruby_proto_library( + name = "notebooks_ruby_proto", + deps = [":notebooks_proto"], +) + +ruby_grpc_library( + name = "notebooks_ruby_grpc", + srcs = [":notebooks_proto"], + deps = [":notebooks_ruby_proto"], +) + +ruby_cloud_gapic_library( + name = "notebooks_ruby_gapic", + srcs = [":notebooks_proto_with_info"], + extra_protoc_parameters = [ + "ruby-cloud-gem-name=google-cloud-notebooks-v2", + ], + grpc_service_config = "notebooks_grpc_service_config.json", + rest_numeric_enums = True, + service_yaml = "notebooks_v2.yaml", + transport = "grpc+rest", + deps = [ + ":notebooks_ruby_grpc", + ":notebooks_ruby_proto", + ], +) + +# Open Source Packages +ruby_gapic_assembly_pkg( + name = "google-cloud-notebooks-v2-ruby", + deps = [ + ":notebooks_ruby_gapic", + ":notebooks_ruby_grpc", + ":notebooks_ruby_proto", + ], +) + +############################################################################## +# C# +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "csharp_gapic_assembly_pkg", + "csharp_gapic_library", + "csharp_grpc_library", + "csharp_proto_library", +) + +csharp_proto_library( + name = "notebooks_csharp_proto", + extra_opts = [], + deps = [":notebooks_proto"], +) + +csharp_grpc_library( + name = "notebooks_csharp_grpc", + srcs = [":notebooks_proto"], + deps = [":notebooks_csharp_proto"], +) + +csharp_gapic_library( + name = "notebooks_csharp_gapic", + srcs = [":notebooks_proto_with_info"], + common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json", + grpc_service_config = "notebooks_grpc_service_config.json", + rest_numeric_enums = True, + service_yaml = "notebooks_v2.yaml", + deps = [ + ":notebooks_csharp_grpc", + ":notebooks_csharp_proto", + ], +) + +# Open Source Packages +csharp_gapic_assembly_pkg( + name = "google-cloud-notebooks-v2-csharp", + deps = [ + ":notebooks_csharp_gapic", + ":notebooks_csharp_grpc", + ":notebooks_csharp_proto", + ], +) + +############################################################################## +# C++ +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "cc_grpc_library", + "cc_proto_library", +) + +cc_proto_library( + name = "notebooks_cc_proto", + deps = [":notebooks_proto"], +) + +cc_grpc_library( + name = "notebooks_cc_grpc", + srcs = [":notebooks_proto"], + grpc_only = True, + deps = [":notebooks_cc_proto"], +) diff --git a/google/cloud/notebooks/v2/diagnostic_config.proto b/google/cloud/notebooks/v2/diagnostic_config.proto new file mode 100644 index 0000000000..ccd60acd05 --- /dev/null +++ b/google/cloud/notebooks/v2/diagnostic_config.proto @@ -0,0 +1,61 @@ +// Copyright 2023 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.v2; + +import "google/api/field_behavior.proto"; + +option csharp_namespace = "Google.Cloud.Notebooks.V2"; +option go_package = "cloud.google.com/go/notebooks/apiv2/notebookspb;notebookspb"; +option java_multiple_files = true; +option java_outer_classname = "DiagnosticConfigProto"; +option java_package = "com.google.cloud.notebooks.v2"; +option php_namespace = "Google\\Cloud\\Notebooks\\V2"; +option ruby_package = "Google::Cloud::Notebooks::V2"; + +// 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 enable_repair_flag = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Enables flag to capture packets from the instance for 30 seconds + bool enable_packet_capture_flag = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Enables flag to copy all `/home/jupyter` folder contents + bool enable_copy_home_files_flag = 5 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/google/cloud/notebooks/v2/event.proto b/google/cloud/notebooks/v2/event.proto new file mode 100644 index 0000000000..1480bbc3e4 --- /dev/null +++ b/google/cloud/notebooks/v2/event.proto @@ -0,0 +1,70 @@ +// Copyright 2023 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.v2; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Notebooks.V2"; +option go_package = "cloud.google.com/go/notebooks/apiv2/notebookspb;notebookspb"; +option java_multiple_files = true; +option java_outer_classname = "EventProto"; +option java_package = "com.google.cloud.notebooks.v2"; +option php_namespace = "Google\\Cloud\\Notebooks\\V2"; +option ruby_package = "Google::Cloud::Notebooks::V2"; + +// The definition of an Event for a managed / semi-managed notebook instance. +message Event { + // The definition of the event types. + enum EventType { + // Event is not specified. + EVENT_TYPE_UNSPECIFIED = 0; + + // The instance / runtime is idle + IDLE = 1; + + // The instance / runtime is available. + // This event indicates that instance / runtime underlying compute is + // operational. + HEARTBEAT = 2; + + // The instance / runtime health is available. + // This event indicates that instance / runtime health information. + HEALTH = 3; + + // The instance / runtime is available. + // This event allows instance / runtime to send Host maintenance + // information to Control Plane. + // https://cloud.google.com/compute/docs/gpus/gpu-host-maintenance + MAINTENANCE = 4; + + // The instance / runtime is available. + // This event indicates that the instance had metadata that needs to be + // modified. + METADATA_CHANGE = 5; + } + + // Optional. Event report time. + google.protobuf.Timestamp report_time = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Event type. + EventType type = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Event details. This field is used to pass event information. + map details = 3 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/google/cloud/notebooks/v2/gce_setup.proto b/google/cloud/notebooks/v2/gce_setup.proto new file mode 100644 index 0000000000..e3fb8b18d6 --- /dev/null +++ b/google/cloud/notebooks/v2/gce_setup.proto @@ -0,0 +1,340 @@ +// Copyright 2023 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.v2; + +import "google/api/field_behavior.proto"; + +option csharp_namespace = "Google.Cloud.Notebooks.V2"; +option go_package = "cloud.google.com/go/notebooks/apiv2/notebookspb;notebookspb"; +option java_multiple_files = true; +option java_outer_classname = "GceSetupProto"; +option java_package = "com.google.cloud.notebooks.v2"; +option php_namespace = "Google\\Cloud\\Notebooks\\V2"; +option ruby_package = "Google::Cloud::Notebooks::V2"; + +// The definition of a network interface resource attached to a VM. +message NetworkInterface { + // The type of vNIC driver. + // Default should be NIC_TYPE_UNSPECIFIED. + enum NicType { + // No type specified. + NIC_TYPE_UNSPECIFIED = 0; + + // VIRTIO + VIRTIO_NET = 1; + + // GVNIC + GVNIC = 2; + } + + // Optional. The name of the VPC that this VM instance is in. + // Format: + // `projects/{project_id}/global/networks/{network_id}` + string network = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the subnet that this VM instance is in. + // Format: + // `projects/{project_id}/regions/{region}/subnetworks/{subnetwork_id}` + string subnet = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The type of vNIC to be used on this interface. This may be gVNIC + // or VirtioNet. + NicType nic_type = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Definition of a custom Compute Engine virtual machine image for starting a +// notebook instance with the environment installed directly on the VM. +message VmImage { + // Required. The name of the Google Cloud project that this VM image belongs + // to. Format: `{project_id}` + string project = 1 [(google.api.field_behavior) = REQUIRED]; + + // The reference to an external Compute Engine VM image. + oneof image { + // Optional. Use VM image name to find the image. + string name = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Use this VM image family to find the image; the newest image in + // this family will be used. + string family = 3 [(google.api.field_behavior) = OPTIONAL]; + } +} + +// Definition of a container image for starting a notebook instance with the +// environment installed in a container. +message ContainerImage { + // Required. The path to the container image repository. For example: + // `gcr.io/{project_id}/{image_name}` + string repository = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The tag of the container image. If not specified, this defaults + // to the latest tag. + string tag = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// An accelerator configuration for a VM instance +// Definition of a hardware accelerator. Note that there is no check on `type` +// and `core_count` combinations. TPUs are not supported. +// See [GPUs on Compute +// Engine](https://cloud.google.com/compute/docs/gpus/#gpus-list) to find a +// valid combination. +message AcceleratorConfig { + // Definition of the types of hardware accelerators that can be used on + // this instance. + enum AcceleratorType { + // Accelerator type is not specified. + ACCELERATOR_TYPE_UNSPECIFIED = 0; + + // Accelerator type is Nvidia Tesla P100. + NVIDIA_TESLA_P100 = 2; + + // Accelerator type is Nvidia Tesla V100. + NVIDIA_TESLA_V100 = 3; + + // Accelerator type is Nvidia Tesla P4. + NVIDIA_TESLA_P4 = 4; + + // Accelerator type is Nvidia Tesla T4. + NVIDIA_TESLA_T4 = 5; + + // Accelerator type is Nvidia Tesla A100 - 40GB. + NVIDIA_TESLA_A100 = 11; + + // Accelerator type is Nvidia Tesla A100 - 80GB. + NVIDIA_A100_80GB = 12; + + // Accelerator type is Nvidia Tesla L4. + NVIDIA_L4 = 13; + + // Accelerator type is NVIDIA Tesla T4 Virtual Workstations. + NVIDIA_TESLA_T4_VWS = 8; + + // Accelerator type is NVIDIA Tesla P100 Virtual Workstations. + NVIDIA_TESLA_P100_VWS = 9; + + // Accelerator type is NVIDIA Tesla P4 Virtual Workstations. + NVIDIA_TESLA_P4_VWS = 10; + } + + // Optional. Type of this accelerator. + AcceleratorType type = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Count of cores of this accelerator. + int64 core_count = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A set of Shielded Instance options. +// See [Images using supported Shielded VM +// features](https://cloud.google.com/compute/docs/instances/modifying-shielded-vm). +// Not all combinations are valid. +message ShieldedInstanceConfig { + // Optional. Defines whether the VM instance has Secure Boot enabled. + // + // Secure Boot helps ensure that the system only runs authentic software by + // verifying the digital signature of all boot components, and halting the + // boot process if signature verification fails. Disabled by default. + bool enable_secure_boot = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Defines whether the VM instance has the vTPM enabled. Enabled by + // default. + bool enable_vtpm = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Defines whether the VM instance has integrity monitoring enabled. + // + // Enables monitoring and attestation of the boot integrity of the VM + // instance. The attestation is performed against the integrity policy + // baseline. This baseline is initially derived from the implicitly trusted + // boot image when the VM instance is created. Enabled by default. + bool enable_integrity_monitoring = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A GPU driver configuration +message GPUDriverConfig { + // Optional. Whether the end user authorizes Google Cloud to install GPU + // driver on this VM instance. If this field is empty or set to false, the GPU + // driver won't be installed. Only applicable to instances with GPUs. + bool enable_gpu_driver = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify a custom Cloud Storage path where the GPU driver is + // stored. If not specified, we'll automatically choose from official GPU + // drivers. + string custom_gpu_driver_path = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// An instance-attached disk resource. +message DataDisk { + // Optional. The size of the disk in GB attached to this VM instance, up to a + // maximum of 64000 GB (64 TB). If not specified, this defaults to 100. + int64 disk_size_gb = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Input only. Indicates the type of the disk. + DiskType disk_type = 2 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = OPTIONAL + ]; + + // Optional. Input only. Disk encryption method used on the boot and data + // disks, defaults to GMEK. + DiskEncryption disk_encryption = 5 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = OPTIONAL + ]; + + // Optional. Input only. The KMS key used to encrypt the disks, only + // applicable if disk_encryption is CMEK. Format: + // `projects/{project_id}/locations/{location}/keyRings/{key_ring_id}/cryptoKeys/{key_id}` + // + // Learn more about using your own encryption keys. + string kms_key = 6 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = OPTIONAL + ]; +} + +// The definition of a boot disk. +message BootDisk { + // Optional. The size of the boot disk in GB attached to this instance, up to + // a maximum of 64000 GB (64 TB). If not specified, this defaults to the + // recommended value of 150GB. + int64 disk_size_gb = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates the type of the disk. + DiskType disk_type = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Input only. Disk encryption method used on the boot and data + // disks, defaults to GMEK. + DiskEncryption disk_encryption = 3 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = OPTIONAL + ]; + + // Optional. Input only. The KMS key used to encrypt the disks, only + // applicable if disk_encryption is CMEK. Format: + // `projects/{project_id}/locations/{location}/keyRings/{key_ring_id}/cryptoKeys/{key_id}` + // + // Learn more about using your own encryption keys. + string kms_key = 4 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = OPTIONAL + ]; +} + +// A service account that acts as an identity. +message ServiceAccount { + // Optional. Email address of the service account. + string email = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The list of scopes to be made available for this service + // account. Set by the CLH to https://www.googleapis.com/auth/cloud-platform + repeated string scopes = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The definition of how to configure a VM instance outside of Resources and +// Identity. +message GceSetup { + // Optional. The machine type of the VM instance. + // https://cloud.google.com/compute/docs/machine-resource + string machine_type = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The hardware accelerators used on this instance. If you use + // accelerators, make sure that your configuration has + // [enough vCPUs and memory to support the `machine_type` you have + // selected](https://cloud.google.com/compute/docs/gpus/#gpus-list). + // Currently supports only one accelerator configuration. + repeated AcceleratorConfig accelerator_configs = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The service account that serves as an identity for the VM + // instance. Currently supports only one service account. + repeated ServiceAccount service_accounts = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Type of the image; can be one of VM image, or container image. + oneof image { + // Optional. Use a Compute Engine VM image to start the notebook instance. + VmImage vm_image = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Use a container image to start the notebook instance. + ContainerImage container_image = 5 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The boot disk for the VM. + BootDisk boot_disk = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Data disks attached to the VM instance. + // Currently supports only one data disk. + repeated DataDisk data_disks = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Shielded VM configuration. + // [Images using supported Shielded VM + // features](https://cloud.google.com/compute/docs/instances/modifying-shielded-vm). + ShieldedInstanceConfig shielded_instance_config = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The network interfaces for the VM. + // Supports only one interface. + repeated NetworkInterface network_interfaces = 9 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, no external IP will be assigned to this VM instance. + bool disable_public_ip = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Compute Engine tags to add to runtime (see [Tagging + // instances](https://cloud.google.com/compute/docs/label-or-tag-resources#tags)). + repeated string tags = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Custom metadata to apply to this instance. + map metadata = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Flag to enable ip forwarding or not, default false/off. + // https://cloud.google.com/vpc/docs/using-routes#canipforward + bool enable_ip_forwarding = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Configuration for GPU drivers. + GPUDriverConfig gpu_driver_config = 14 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Definition of the disk encryption options. +enum DiskEncryption { + // Disk encryption is not specified. + DISK_ENCRYPTION_UNSPECIFIED = 0; + + // Use Google managed encryption keys to encrypt the boot disk. + GMEK = 1; + + // Use customer managed encryption keys to encrypt the boot disk. + CMEK = 2; +} + +// Possible disk types. +enum DiskType { + // Disk type not set. + DISK_TYPE_UNSPECIFIED = 0; + + // Standard persistent disk type. + PD_STANDARD = 1; + + // SSD persistent disk type. + PD_SSD = 2; + + // Balanced persistent disk type. + PD_BALANCED = 3; + + // Extreme persistent disk type. + PD_EXTREME = 4; +} diff --git a/google/cloud/notebooks/v2/instance.proto b/google/cloud/notebooks/v2/instance.proto new file mode 100644 index 0000000000..9a3dff5bfe --- /dev/null +++ b/google/cloud/notebooks/v2/instance.proto @@ -0,0 +1,231 @@ +// Copyright 2023 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.v2; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/notebooks/v2/gce_setup.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Notebooks.V2"; +option go_package = "cloud.google.com/go/notebooks/apiv2/notebookspb;notebookspb"; +option java_multiple_files = true; +option java_outer_classname = "InstanceProto"; +option java_package = "com.google.cloud.notebooks.v2"; +option php_namespace = "Google\\Cloud\\Notebooks\\V2"; +option ruby_package = "Google::Cloud::Notebooks::V2"; + +// The entry of VM image upgrade history. +message UpgradeHistoryEntry { + // The definition of the states of this upgrade history entry. + enum State { + // State is not specified. + STATE_UNSPECIFIED = 0; + + // The instance upgrade is started. + STARTED = 1; + + // The instance upgrade is succeeded. + SUCCEEDED = 2; + + // The instance upgrade is failed. + FAILED = 3; + } + + // The definition of operations of this upgrade history entry. + enum Action { + // Operation is not specified. + ACTION_UNSPECIFIED = 0; + + // Upgrade. + UPGRADE = 1; + + // Rollback. + ROLLBACK = 2; + } + + // Optional. The snapshot of the boot disk of this notebook instance before + // upgrade. + string snapshot = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The VM image before this instance upgrade. + string vm_image = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The container image before this instance upgrade. + string container_image = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The framework of this notebook instance. + string framework = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The version of the notebook instance before this upgrade. + string version = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The state of this instance upgrade history entry. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. The time that this instance upgrade history entry is created. + google.protobuf.Timestamp create_time = 7 + [(google.api.field_behavior) = IMMUTABLE]; + + // Optional. Action. Rolloback or Upgrade. + Action action = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Target VM Version, like m63. + string target_version = 9 [(google.api.field_behavior) = OPTIONAL]; +} + +// The definition of a notebook instance. +message Instance { + option (google.api.resource) = { + type: "notebooks.googleapis.com/Instance" + pattern: "projects/{project}/locations/{location}/instances/{instance}" + plural: "instances" + singular: "instance" + }; + + // Output only. The name of this notebook instance. Format: + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Setup for the Notebook instance. + oneof infrastructure { + // Optional. Compute Engine setup for the notebook. Uses notebook-defined + // fields. + GceSetup gce_setup = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. The proxy endpoint that is used to access the Jupyter + // notebook. + string proxy_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Input only. The owner of this instance after creation. Format: + // `alias@example.com` + // + // Currently supports one owner only. If not specified, all of the service + // account users of your VM instance's service account can use + // the instance. + repeated string instance_owners = 4 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = OPTIONAL + ]; + + // Output only. Email address of entity that sent original CreateInstance + // request. + string creator = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The state of this instance. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The upgrade history of this instance. + repeated UpgradeHistoryEntry upgrade_history = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Unique ID of the resource. + string id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Instance health_state. + HealthState health_state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about instance health. + // Example: + // + // healthInfo": { + // "docker_proxy_agent_status": "1", + // "docker_status": "1", + // "jupyterlab_api_status": "-1", + // "jupyterlab_status": "-1", + // "updated": "2020-10-18 09:40:03.573409" + // } + map health_info = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Instance creation time. + google.protobuf.Timestamp create_time = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Instance update time. + google.protobuf.Timestamp update_time = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. If true, the notebook instance will not register with the proxy. + bool disable_proxy_access = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Labels to apply to this instance. + // These can be later modified by the UpdateInstance method. + map labels = 14 [(google.api.field_behavior) = OPTIONAL]; +} + +// The definition of the states of this instance. +enum State { + // State is not specified. + STATE_UNSPECIFIED = 0; + + // The control logic is starting the instance. + STARTING = 1; + + // The control logic is installing required frameworks and registering the + // instance with notebook proxy + PROVISIONING = 2; + + // The instance is running. + ACTIVE = 3; + + // The control logic is stopping the instance. + STOPPING = 4; + + // The instance is stopped. + STOPPED = 5; + + // The instance is deleted. + DELETED = 6; + + // The instance is upgrading. + UPGRADING = 7; + + // The instance is being created. + INITIALIZING = 8; + + // The instance is suspending. + SUSPENDING = 9; + + // The instance is suspended. + SUSPENDED = 10; +} + +// The instance health state. +enum HealthState { + // The instance substate is unknown. + HEALTH_STATE_UNSPECIFIED = 0; + + // The instance is known to be in an healthy state + // (for example, critical daemons are running) + // Applies to ACTIVE state. + HEALTHY = 1; + + // The instance is known to be in an unhealthy state + // (for example, critical daemons are not running) + // Applies to ACTIVE state. + UNHEALTHY = 2; + + // The instance has not installed health monitoring agent. + // Applies to ACTIVE state. + AGENT_NOT_INSTALLED = 3; + + // The instance health monitoring agent is not running. + // Applies to ACTIVE state. + AGENT_NOT_RUNNING = 4; +} diff --git a/google/cloud/notebooks/v2/notebooks_grpc_service_config.json b/google/cloud/notebooks/v2/notebooks_grpc_service_config.json new file mode 100644 index 0000000000..81a5e8c71f --- /dev/null +++ b/google/cloud/notebooks/v2/notebooks_grpc_service_config.json @@ -0,0 +1,65 @@ +{ + "methodConfig": [ + { + "name": [ + { "service": "google.cloud.notebooks.v2.NotebookService" } + ], + "timeout": "60s", + "retryPolicy": { + "maxAttempts": 5, + "initialBackoff": "0.100s", + "maxBackoff": "60s", + "backoffMultiplier": 1.3, + "retryableStatusCodes": ["UNAVAILABLE"] + } + }, + { + "name": [ + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "ListInstances" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "GetInstance" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "CreateInstance" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "RegisterInstance" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "SetInstanceAccelerator" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "SetInstanceMachineType" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "SetInstanceLabels" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "UpdateInstanceConfig" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "DeleteInstance" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "StartInstance" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "StopInstance" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "ResetInstance" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "RollbackInstance" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "ReportInstanceInfo" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "IsInstanceUpgradeable" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "GetInstanceHealth" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "UpgradeInstance" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "UpgradeInstanceInternal" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "UpdateShieldedInstanceConfig" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "ListEnvironments" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "GetEnvironment" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "CreateEnvironment" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "DeleteEnvironment" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "PrepareReportInstanceEvent" }, + { "service": "google.cloud.notebooks.v2.NotebookService", "method": "ReportInstanceEvent" } + ], + "timeout": "60s" + }, + { + "name": [ + { + "service": "google.longrunning.Operations", + "method": "ListOperations" + } + ], + "timeout": "300s", + "retryPolicy": { + "initialBackoff": "0.100s", + "maxBackoff": "300s", + "backoffMultiplier": 1.3, + "retryableStatusCodes": [ + "UNAVAILABLE", + "DEADLINE_EXCEEDED" + ] + } + } + ] +} diff --git a/google/cloud/notebooks/v2/notebooks_v2.yaml b/google/cloud/notebooks/v2/notebooks_v2.yaml new file mode 100644 index 0000000000..efaa3262ac --- /dev/null +++ b/google/cloud/notebooks/v2/notebooks_v2.yaml @@ -0,0 +1,107 @@ +type: google.api.Service +config_version: 3 +name: notebooks.googleapis.com +title: Notebooks API + +apis: +- name: google.cloud.location.Locations +- name: google.cloud.notebooks.v2.NotebookService +- name: google.iam.v1.IAMPolicy +- name: google.longrunning.Operations + +types: +- name: google.cloud.notebooks.v2.OperationMetadata + +documentation: + summary: Notebooks API is used to manage notebook resources in Google Cloud. + rules: + - selector: google.cloud.location.Locations.GetLocation + description: Gets information about a location. + + - selector: google.cloud.location.Locations.ListLocations + description: Lists information about the supported locations for this service. + + - selector: google.iam.v1.IAMPolicy.GetIamPolicy + description: |- + Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + + - selector: google.iam.v1.IAMPolicy.SetIamPolicy + description: |- + Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + + - selector: google.iam.v1.IAMPolicy.TestIamPermissions + description: |- + Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + +backend: + rules: + - selector: google.cloud.location.Locations.GetLocation + deadline: 60.0 + - selector: google.cloud.location.Locations.ListLocations + deadline: 60.0 + - selector: 'google.cloud.notebooks.v2.NotebookService.*' + deadline: 60.0 + - selector: 'google.iam.v1.IAMPolicy.*' + deadline: 60.0 + - selector: 'google.longrunning.Operations.*' + deadline: 60.0 + - selector: google.longrunning.Operations.GetOperation + deadline: 5.0 + +http: + rules: + - selector: google.cloud.location.Locations.GetLocation + get: '/v2/{name=projects/*/locations/*}' + - selector: google.cloud.location.Locations.ListLocations + get: '/v2/{name=projects/*}/locations' + - selector: google.iam.v1.IAMPolicy.GetIamPolicy + get: '/v2/{resource=projects/*/locations/*/instances/*}:getIamPolicy' + - selector: google.iam.v1.IAMPolicy.SetIamPolicy + post: '/v2/{resource=projects/*/locations/*/instances/*}:setIamPolicy' + body: '*' + - selector: google.iam.v1.IAMPolicy.TestIamPermissions + post: '/v2/{resource=projects/*/locations/*/instances/*}:testIamPermissions' + body: '*' + - selector: google.longrunning.Operations.CancelOperation + post: '/v2/{name=projects/*/locations/*/operations/*}:cancel' + body: '*' + - selector: google.longrunning.Operations.DeleteOperation + delete: '/v2/{name=projects/*/locations/*/operations/*}' + - selector: google.longrunning.Operations.GetOperation + get: '/v2/{name=projects/*/locations/*/operations/*}' + - selector: google.longrunning.Operations.ListOperations + get: '/v2/{name=projects/*/locations/*}/operations' + +authentication: + rules: + - selector: google.cloud.location.Locations.GetLocation + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform + - selector: google.cloud.location.Locations.ListLocations + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform + - selector: 'google.cloud.notebooks.v2.NotebookService.*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform + - selector: 'google.iam.v1.IAMPolicy.*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform + - selector: 'google.longrunning.Operations.*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform diff --git a/google/cloud/notebooks/v2/service.proto b/google/cloud/notebooks/v2/service.proto new file mode 100644 index 0000000000..e6412fc078 --- /dev/null +++ b/google/cloud/notebooks/v2/service.proto @@ -0,0 +1,406 @@ +// Copyright 2023 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.v2; + +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/v2/diagnostic_config.proto"; +import "google/cloud/notebooks/v2/instance.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Notebooks.V2"; +option go_package = "cloud.google.com/go/notebooks/apiv2/notebookspb;notebookspb"; +option java_multiple_files = true; +option java_outer_classname = "ServiceProto"; +option java_package = "com.google.cloud.notebooks.v2"; +option php_namespace = "Google\\Cloud\\Notebooks\\V2"; +option ruby_package = "Google::Cloud::Notebooks::V2"; + +// API v2 service for Workbench Notebooks Instances. +service NotebookService { + option (google.api.default_host) = "notebooks.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists instances in a given project and location. + rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/instances" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single Instance. + rpc GetInstance(GetInstanceRequest) returns (Instance) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/instances/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new Instance in a given project and location. + rpc CreateInstance(CreateInstanceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/instances" + body: "instance" + }; + option (google.api.method_signature) = "parent,instance,instance_id"; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // UpdateInstance updates an Instance. + rpc UpdateInstance(UpdateInstanceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{instance.name=projects/*/locations/*/instances/*}" + body: "instance" + }; + option (google.api.method_signature) = "instance,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a single Instance. + rpc DeleteInstance(DeleteInstanceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/instances/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Starts a notebook instance. + rpc StartInstance(StartInstanceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/instances/*}:start" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // Stops a notebook instance. + rpc StopInstance(StopInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/instances/*}:stop" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // Resets a notebook instance. + rpc ResetInstance(ResetInstanceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/instances/*}:reset" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // Checks whether a notebook instance is upgradable. + rpc CheckInstanceUpgradability(CheckInstanceUpgradabilityRequest) + returns (CheckInstanceUpgradabilityResponse) { + option (google.api.http) = { + get: "/v2/{notebook_instance=projects/*/locations/*/instances/*}:checkUpgradability" + }; + } + + // Upgrades a notebook instance to the latest version. + rpc UpgradeInstance(UpgradeInstanceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/instances/*}:upgrade" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // Rollbacks a notebook instance to the previous version. + rpc RollbackInstance(RollbackInstanceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/instances/*}:rollback" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // Creates a Diagnostic File and runs Diagnostic Tool given an Instance. + rpc DiagnoseInstance(DiagnoseInstanceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/instances/*}:diagnose" + body: "*" + }; + option (google.api.method_signature) = "name,diagnostic_config"; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Server-defined resource path for the target of the operation. + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_message = 5; + + // Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. + bool requested_cancellation = 6; + + // API version used to start the operation. + string api_version = 7; + + // API endpoint name of this operation. + string endpoint = 8; +} + +// Request for listing notebook instances. +message ListInstancesRequest { + // Required. Format: + // `parent=projects/{project_id}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "notebooks.googleapis.com/Instance" + } + ]; + + // Optional. Maximum return size of the list call. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A previous returned page token that can be used to continue + // listing from the last result. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for listing notebook instances. +message ListInstancesResponse { + // A list of returned instances. + repeated Instance instances = 1; + + // Page token that can be used to continue listing from the last result in the + // next list call. + string next_page_token = 2; + + // Locations that could not be reached. For example, + // ['us-west1-a', 'us-central1-b']. + // A ListInstancesResponse will only contain either instances or unreachables, + repeated string unreachable = 3; +} + +// Request for getting a notebook instance. +message GetInstanceRequest { + // Required. Format: + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "notebooks.googleapis.com/Instance" + } + ]; +} + +// Request for creating a notebook instance. +message CreateInstanceRequest { + // Required. Format: + // `parent=projects/{project_id}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "notebooks.googleapis.com/Instance" + } + ]; + + // Required. User-defined unique ID of this instance. + string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The instance to be created. + Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Idempotent request UUID. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for updating a notebook instance. +message UpdateInstanceRequest { + // Required. A representation of an instance. + Instance instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Mask used to update an instance + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. Idempotent request UUID. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for deleting a notebook instance. +message DeleteInstanceRequest { + // Required. Format: + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "notebooks.googleapis.com/Instance" + } + ]; + + // Optional. Idempotent request UUID. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for starting a notebook instance +message StartInstanceRequest { + // Required. Format: + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for stopping a notebook instance +message StopInstanceRequest { + // Required. Format: + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for resetting a notebook instance +message ResetInstanceRequest { + // Required. Format: + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for checking if a notebook instance is upgradeable. +message CheckInstanceUpgradabilityRequest { + // Required. Format: + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string notebook_instance = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Response for checking if a notebook instance is upgradeable. +message CheckInstanceUpgradabilityResponse { + // If an instance is upgradeable. + bool upgradeable = 1; + + // The version this instance will be upgraded to if calling the upgrade + // endpoint. This field will only be populated if field upgradeable is true. + string upgrade_version = 2; + + // Additional information about upgrade. + string upgrade_info = 3; + + // The new image self link this instance will be upgraded to if calling the + // upgrade endpoint. This field will only be populated if field upgradeable + // is true. + string upgrade_image = 4; +} + +// Request for upgrading a notebook instance +message UpgradeInstanceRequest { + // Required. Format: + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for rollbacking a notebook instance +message RollbackInstanceRequest { + // Required. Format: + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "notebooks.googleapis.com/Instance" + } + ]; + + // Required. The snapshot for rollback. + // Example: "projects/test-project/global/snapshots/krwlzipynril". + string target_snapshot = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Output only. Revision Id + string revision_id = 3 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = REQUIRED + ]; +} + +// Request for creating a notebook instance diagnostic file. +message DiagnoseInstanceRequest { + // Required. Format: + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "notebooks.googleapis.com/Instance" + } + ]; + + // Required. Defines flags that are used to run the diagnostic tool + DiagnosticConfig diagnostic_config = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. Maxmium amount of time in minutes before the operation times out. + int32 timeout_minutes = 3 [(google.api.field_behavior) = OPTIONAL]; +}