From ec24d41f4dc5aa0ecfb73781180c711fb104ff0c Mon Sep 17 00:00:00 2001 From: Google APIs Date: Tue, 7 Jul 2020 16:43:31 -0700 Subject: [PATCH] feat: added support for Notebooks PiperOrigin-RevId: 320087095 --- google/cloud/notebooks/v1beta1/BUILD.bazel | 380 +++++++++++++ .../cloud/notebooks/v1beta1/environment.proto | 97 ++++ google/cloud/notebooks/v1beta1/instance.proto | 260 +++++++++ .../notebooks/v1beta1/notebooks_gapic.yaml | 10 + .../notebooks_grpc_service_config.json | 37 ++ .../notebooks/v1beta1/notebooks_v1beta1.yaml | 86 +++ google/cloud/notebooks/v1beta1/service.proto | 506 ++++++++++++++++++ 7 files changed, 1376 insertions(+) create mode 100644 google/cloud/notebooks/v1beta1/BUILD.bazel create mode 100644 google/cloud/notebooks/v1beta1/environment.proto create mode 100644 google/cloud/notebooks/v1beta1/instance.proto create mode 100644 google/cloud/notebooks/v1beta1/notebooks_gapic.yaml create mode 100644 google/cloud/notebooks/v1beta1/notebooks_grpc_service_config.json create mode 100644 google/cloud/notebooks/v1beta1/notebooks_v1beta1.yaml create mode 100644 google/cloud/notebooks/v1beta1/service.proto diff --git a/google/cloud/notebooks/v1beta1/BUILD.bazel b/google/cloud/notebooks/v1beta1/BUILD.bazel new file mode 100644 index 00000000..17b472f1 --- /dev/null +++ b/google/cloud/notebooks/v1beta1/BUILD.bazel @@ -0,0 +1,380 @@ +# This file was automatically generated by BuildFileGenerator +# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/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 = [ + "environment.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//:timestamp_proto", + ], +) + +proto_library_with_info( + name = "notebooks_proto_with_info", + deps = [ + ":notebooks_proto", + "//google/cloud:common_resources_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", + src = ":notebooks_proto_with_info", + gapic_yaml = "notebooks_gapic.yaml", + grpc_service_config = "notebooks_grpc_service_config.json", + package = "google.cloud.notebooks.v1beta1", + service_yaml = "notebooks_v1beta1.yaml", + test_deps = [ + ":notebooks_java_grpc", + ], + deps = [ + ":notebooks_java_proto", + ], +) + +java_gapic_test( + name = "notebooks_java_gapic_test_suite", + test_classes = [ + "com.google.cloud.notebooks.v1beta1.NotebookServiceClientTest", + ], + runtime_deps = [":notebooks_java_gapic_test"], +) + +# Open Source Packages +java_gapic_assembly_gradle_pkg( + name = "google-cloud-notebooks-v1beta1-java", + deps = [ + ":notebooks_java_gapic", + ":notebooks_java_grpc", + ":notebooks_java_proto", + ":notebooks_proto", + ], +) + +############################################################################## +# Go +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "go_gapic_assembly_pkg", + "go_gapic_library", + "go_proto_library", + "go_test", +) + +go_proto_library( + name = "notebooks_go_proto", + compilers = ["@io_bazel_rules_go//proto:go_grpc"], + importpath = "google.golang.org/genproto/googleapis/cloud/notebooks/v1beta1", + 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/apiv1beta1;notebooks", + service_yaml = "notebooks_v1beta1.yaml", + deps = [ + ":notebooks_go_proto", + "//google/longrunning:longrunning_go_gapic", + "//google/longrunning:longrunning_go_proto", + "@com_google_cloud_go//longrunning:go_default_library", + ], +) + +go_test( + name = "notebooks_go_gapic_test", + srcs = [":notebooks_go_gapic_srcjar_test"], + embed = [":notebooks_go_gapic"], + importpath = "cloud.google.com/go/notebooks/apiv1beta1", +) + +# Open Source Packages +go_gapic_assembly_pkg( + name = "gapi-cloud-notebooks-v1beta1-go", + deps = [ + ":notebooks_go_gapic", + ":notebooks_go_gapic_srcjar-test.srcjar", + ":notebooks_go_proto", + ], +) + +############################################################################## +# Python +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "moved_proto_library", + "py_gapic_assembly_pkg", + "py_gapic_library", + "py_grpc_library", + "py_proto_library", +) + +moved_proto_library( + name = "notebooks_moved_proto", + srcs = [":notebooks_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//:timestamp_proto", + ], +) + +py_proto_library( + name = "notebooks_py_proto", + plugin = "@protoc_docs_plugin//:docs_plugin", + deps = [":notebooks_moved_proto"], +) + +py_grpc_library( + name = "notebooks_py_grpc", + srcs = [":notebooks_moved_proto"], + deps = [":notebooks_py_proto"], +) + +py_gapic_library( + name = "notebooks_py_gapic", + src = ":notebooks_proto_with_info", + gapic_yaml = "notebooks_gapic.yaml", + grpc_service_config = "notebooks_grpc_service_config.json", + package = "google.cloud.notebooks.v1beta1", + service_yaml = "notebooks_v1beta1.yaml", + deps = [ + ":notebooks_py_grpc", + ":notebooks_py_proto", + ], +) + +# Open Source Packages +py_gapic_assembly_pkg( + name = "notebooks-v1beta1-py", + deps = [ + ":notebooks_py_gapic", + ":notebooks_py_grpc", + ":notebooks_py_proto", + ], +) + +############################################################################## +# PHP +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "php_gapic_assembly_pkg", + "php_gapic_library", + "php_grpc_library", + "php_proto_library", +) + +php_proto_library( + name = "notebooks_php_proto", + deps = [":notebooks_proto"], +) + +php_grpc_library( + name = "notebooks_php_grpc", + srcs = [":notebooks_proto"], + deps = [":notebooks_php_proto"], +) + +php_gapic_library( + name = "notebooks_php_gapic", + src = ":notebooks_proto_with_info", + gapic_yaml = "notebooks_gapic.yaml", + grpc_service_config = "notebooks_grpc_service_config.json", + package = "google.cloud.notebooks.v1beta1", + service_yaml = "notebooks_v1beta1.yaml", + deps = [ + ":notebooks_php_grpc", + ":notebooks_php_proto", + ], +) + +# Open Source Packages +php_gapic_assembly_pkg( + name = "google-cloud-notebooks-v1beta1-php", + deps = [ + ":notebooks_php_gapic", + ":notebooks_php_grpc", + ":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", + src = ":notebooks_proto_with_info", + grpc_service_config = "notebooks_grpc_service_config.json", + package = "google.cloud.notebooks.v1beta1", + service_yaml = "notebooks_v1beta1.yaml", + deps = [], +) + +nodejs_gapic_assembly_pkg( + name = "notebooks-v1beta1-nodejs", + deps = [ + ":notebooks_nodejs_gapic", + ":notebooks_proto", + ], +) + +############################################################################## +# Ruby +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "ruby_gapic_assembly_pkg", + "ruby_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_gapic_library( + name = "notebooks_ruby_gapic", + src = ":notebooks_proto_with_info", + gapic_yaml = "notebooks_gapic.yaml", + grpc_service_config = "notebooks_grpc_service_config.json", + package = "google.cloud.notebooks.v1beta1", + service_yaml = "notebooks_v1beta1.yaml", + deps = [ + ":notebooks_ruby_grpc", + ":notebooks_ruby_proto", + ], +) + +# Open Source Packages +ruby_gapic_assembly_pkg( + name = "google-cloud-notebooks-v1beta1-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", + deps = [":notebooks_proto"], +) + +csharp_grpc_library( + name = "notebooks_csharp_grpc", + srcs = [":notebooks_proto"], + deps = [":notebooks_csharp_proto"], +) + +csharp_gapic_library( + name = "notebooks_csharp_gapic", + src = ":notebooks_proto_with_info", + gapic_yaml = "notebooks_gapic.yaml", + grpc_service_config = "notebooks_grpc_service_config.json", + package = "google.cloud.notebooks.v1beta1", + service_yaml = "notebooks_v1beta1.yaml", + deps = [ + ":notebooks_csharp_grpc", + ":notebooks_csharp_proto", + ], +) + +# Open Source Packages +csharp_gapic_assembly_pkg( + name = "google-cloud-notebooks-v1beta1-csharp", + deps = [ + ":notebooks_csharp_gapic", + ":notebooks_csharp_grpc", + ":notebooks_csharp_proto", + ], +) + +############################################################################## +# C++ +############################################################################## +# Put your C++ rules here diff --git a/google/cloud/notebooks/v1beta1/environment.proto b/google/cloud/notebooks/v1beta1/environment.proto new file mode 100644 index 00000000..924257d6 --- /dev/null +++ b/google/cloud/notebooks/v1beta1/environment.proto @@ -0,0 +1,97 @@ +// Copyright 2020 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.v1beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/notebooks/v1beta1;notebooks"; +option csharp_namespace = "Google.Cloud.Notebooks.V1Beta1"; +option php_namespace = "Google\\Cloud\\Notebooks\\V1Beta1"; +option ruby_package = "Google::Cloud::Notebooks::V1Beta1"; +option java_multiple_files = true; +option java_outer_classname = "EnvironmentProto"; +option java_package = "com.google.cloud.notebooks.v1beta1"; + +// Definition of a software environment that is used to start a notebook +// instance. +message Environment { + option (google.api.resource) = { + type: "notebooks.googleapis.com/Environment" + pattern: "projects/{project}/environments/{environment}" + }; + + // Output only. Name of this environment. + // Format: + // `projects/{project_id}/locations/{location}/environments/{environment_id}` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Display name of this environment for the UI. + string display_name = 2; + + // A brief description of this environment. + string description = 3; + + // Type of the environment; can be one of VM image, or container image. + oneof image_type { + // Use a Compute Engine VM image to start the notebook instance. + VmImage vm_image = 6; + + // Use a container image to start the notebook instance. + ContainerImage container_image = 7; + } + + // Path to a Bash script that automatically runs after a notebook instance + // fully boots up. The path must be a URL or + // Cloud Storage path. Example: `"gs://path-to-file/file-name"` + string post_startup_script = 8; + + // Output only. The time at which this environment was created. + google.protobuf.Timestamp create_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// 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: `projects/{project_id}` + string project = 1 [(google.api.field_behavior) = REQUIRED]; + + // The reference to an external Compute Engine VM image. + oneof image { + // Use VM image name to find the image. + string image_name = 2; + + // Use this VM image family to find the image; the newest image in this + // family will be used. + string image_family = 3; + } +} + +// 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]; + + // The tag of the container image. If not specified, this defaults + // to the latest tag. + string tag = 2; +} diff --git a/google/cloud/notebooks/v1beta1/instance.proto b/google/cloud/notebooks/v1beta1/instance.proto new file mode 100644 index 00000000..9a0a984c --- /dev/null +++ b/google/cloud/notebooks/v1beta1/instance.proto @@ -0,0 +1,260 @@ +// Copyright 2020 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.v1beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/notebooks/v1beta1/environment.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/notebooks/v1beta1;notebooks"; +option csharp_namespace = "Google.Cloud.Notebooks.V1Beta1"; +option php_namespace = "Google\\Cloud\\Notebooks\\V1Beta1"; +option ruby_package = "Google::Cloud::Notebooks::V1Beta1"; +option java_multiple_files = true; +option java_outer_classname = "InstanceProto"; +option java_package = "com.google.cloud.notebooks.v1beta1"; + +// The definition of a notebook instance. +message Instance { + option (google.api.resource) = { + type: "notebooks.googleapis.com/Instance" + pattern: "projects/{project}/instances/{instance}" + }; + + // Definition of a hardware accelerator. Note that not all combinations + // of `type` and `core_count` are valid. Check [GPUs on + // Compute Engine](/compute/docs/gpus/#gpus-list) to find a valid + // combination. TPUs are not supported. + message AcceleratorConfig { + // Type of this accelerator. + AcceleratorType type = 1; + + // Count of cores of this accelerator. + int64 core_count = 2; + } + + // 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 K80. + NVIDIA_TESLA_K80 = 1; + + // 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 P_4. + NVIDIA_TESLA_P4 = 4; + + // Accelerator type is Nvidia Tesla T4. + NVIDIA_TESLA_T4 = 5; + + // 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 P_4 Virtual Workstations. + NVIDIA_TESLA_P4_VWS = 10; + + // (Coming soon) Accelerator type is TPU V2. + TPU_V2 = 6; + + // (Coming soon) Accelerator type is TPU V3. + TPU_V3 = 7; + } + + // 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; + } + + // Possible disk types for notebook instances. + enum DiskType { + // Disk type not set. + DISK_TYPE_UNSPECIFIED = 0; + + // Standard persistent disk type. + PD_STANDARD = 1; + + // SSD persistent disk type. + PD_SSD = 2; + } + + // 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; + } + + // 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]; + + // Type of the environment; can be one of VM image, or container image. + oneof environment { + // Use a Compute Engine VM image to start the notebook instance. + VmImage vm_image = 2; + + // Use a container image to start the notebook instance. + ContainerImage container_image = 3; + } + + // Path to a Bash script that automatically runs after a notebook instance + // fully boots up. The path must be a URL or + // Cloud Storage path (`gs://path-to-file/file-name`). + string post_startup_script = 4; + + // Output only. The proxy endpoint that is used to access the Jupyter notebook. + string proxy_uri = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // 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 = 6 [(google.api.field_behavior) = INPUT_ONLY]; + + // The service account on this instance, giving access to other Google + // Cloud services. + // You can use any service account within the same project, but you + // must have the service account user permission to use the instance. + // + // If not specified, the [Compute Engine default service + // account](https://cloud.google.com/compute/docs/access/service-accounts#default_service_account) + // is used. + string service_account = 7; + + // Required. The [Compute Engine machine type](https://cloud.google.com/compute/docs/machine-types) of this + // instance. + string machine_type = 8 [(google.api.field_behavior) = REQUIRED]; + + // The hardware accelerator 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). + AcceleratorConfig accelerator_config = 9; + + // Output only. The state of this instance. + State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Whether the end user authorizes Google Cloud to install GPU driver + // on this instance. + // If this field is empty or set to false, the GPU driver won't be installed. + // Only applicable to instances with GPUs. + bool install_gpu_driver = 11; + + // 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 = 12; + + // Input only. The type of the boot disk attached to this instance, defaults to + // standard persistent disk (`PD_STANDARD`). + DiskType boot_disk_type = 13 [(google.api.field_behavior) = INPUT_ONLY]; + + // Input only. The size of the boot disk in GB attached to this instance, up to a maximum + // of 64000 GB (64 TB). The minimum recommended value is + // 100 GB. If not specified, this defaults to 100. + int64 boot_disk_size_gb = 14 [(google.api.field_behavior) = INPUT_ONLY]; + + // Input only. The type of the data disk attached to this instance, defaults to + // standard persistent disk (`PD_STANDARD`). + DiskType data_disk_type = 25 [(google.api.field_behavior) = INPUT_ONLY]; + + // Input only. The size of the data disk in GB attached to this instance, up to a maximum + // of 64000 GB (64 TB). You can choose the size of the data disk + // based on how big your notebooks and data are. If not specified, this + // defaults to 100. + int64 data_disk_size_gb = 26 [(google.api.field_behavior) = INPUT_ONLY]; + + // Input only. If true, the data disk will not be auto deleted when deleting the instance. + bool no_remove_data_disk = 27 [(google.api.field_behavior) = INPUT_ONLY]; + + // Input only. Disk encryption method used on the boot and data disks, defaults to GMEK. + DiskEncryption disk_encryption = 15 [(google.api.field_behavior) = INPUT_ONLY]; + + // 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]( https://cloud.google.com/kms/docs/quickstart). + string kms_key = 16 [(google.api.field_behavior) = INPUT_ONLY]; + + // If true, no public IP will be assigned to this instance. + bool no_public_ip = 17; + + // If true, the notebook instance will not register with the proxy. + bool no_proxy_access = 18; + + // The name of the VPC that this instance is in. + // Format: + // `projects/{project_id}/global/networks/{network_id}` + string network = 19; + + // The name of the subnet that this instance is in. + // Format: + // `projects/{project_id}/regions/{region}/subnetworks/{subnetwork_id}` + string subnet = 20; + + // Labels to apply to this instance. + // These can be later modified by the setLabels method. + map labels = 21; + + // Custom metadata to apply to this instance. + map metadata = 22; + + // Output only. Instance creation time. + google.protobuf.Timestamp create_time = 23 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Instance update time. + google.protobuf.Timestamp update_time = 24 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/google/cloud/notebooks/v1beta1/notebooks_gapic.yaml b/google/cloud/notebooks/v1beta1/notebooks_gapic.yaml new file mode 100644 index 00000000..5d8eab1b --- /dev/null +++ b/google/cloud/notebooks/v1beta1/notebooks_gapic.yaml @@ -0,0 +1,10 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 2.0.0 +language_settings: + java: + package_name: com.google.cloud.notebooks.v1beta1 + python: + package_name: google.cloud.notebooks_v1beta1.gapic + nodejs: + package_name: notebooks.v1beta1 + domain_layer_location: google-cloud diff --git a/google/cloud/notebooks/v1beta1/notebooks_grpc_service_config.json b/google/cloud/notebooks/v1beta1/notebooks_grpc_service_config.json new file mode 100644 index 00000000..2a2e1bcf --- /dev/null +++ b/google/cloud/notebooks/v1beta1/notebooks_grpc_service_config.json @@ -0,0 +1,37 @@ +{ + "methodConfig": [{ + "name": [{ "service": "google.cloud.notebooks.v1beta1.NotebookService" }], + "timeout": "60s", + "retryPolicy": { + "maxAttempts": 5, + "initialBackoff": "0.100s", + "maxBackoff": "60s", + "backoffMultiplier": 1.3, + "retryableStatusCodes": ["UNAVAILABLE"] + } + }, + { + "name": [ + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "ListInstances" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "GetInstance" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "CreateInstance" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "RegisterInstance" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "SetInstanceAccelerator" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "SetInstanceMachineType" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "SetInstanceLabels" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "DeleteInstance" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "StartInstance" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "StopInstance" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "ResetInstance" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "ReportInstanceInfo" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "IsInstanceUpgradeable" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "UpgradeInstance" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "UpgradeInstanceInternal" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "ListEnvironments" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "GetEnvironment" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "CreateEnvironment" }, + { "service": "google.cloud.notebooks.v1beta1.NotebookService", "method": "DeleteEnvironment" } + ], + "timeout": "60s" + }] +} diff --git a/google/cloud/notebooks/v1beta1/notebooks_v1beta1.yaml b/google/cloud/notebooks/v1beta1/notebooks_v1beta1.yaml new file mode 100644 index 00000000..f1311f94 --- /dev/null +++ b/google/cloud/notebooks/v1beta1/notebooks_v1beta1.yaml @@ -0,0 +1,86 @@ +type: google.api.Service +config_version: 3 +name: notebooks.googleapis.com +title: Notebooks API + +apis: +- name: google.cloud.notebooks.v1beta1.NotebookService + +types: +- name: google.cloud.notebooks.v1beta1.OperationMetadata + +documentation: + summary: |- + AI Platform Notebooks API (beta) is used to manage notebook resources in + Google Cloud. AI Platform Notebooks API is in a pre-release state and + might change or have limited support. For more information, see the product launch stages. + rules: + - 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.notebooks.v1beta1.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.iam.v1.IAMPolicy.GetIamPolicy + get: '/v1beta1/{resource=projects/*/locations/*/instances/*}:getIamPolicy' + - selector: google.iam.v1.IAMPolicy.SetIamPolicy + post: '/v1beta1/{resource=projects/*/locations/*/instances/*}:setIamPolicy' + body: '*' + - selector: google.iam.v1.IAMPolicy.TestIamPermissions + post: '/v1beta1/{resource=projects/*/locations/*/instances/*}:testIamPermissions' + body: '*' + - selector: google.longrunning.Operations.CancelOperation + post: '/v1beta1/{name=projects/*/locations/*/operations/*}:cancel' + body: '*' + - selector: google.longrunning.Operations.DeleteOperation + delete: '/v1beta1/{name=projects/*/locations/*/operations/*}' + - selector: google.longrunning.Operations.GetOperation + get: '/v1beta1/{name=projects/*/locations/*/operations/*}' + - selector: google.longrunning.Operations.ListOperations + get: '/v1beta1/{name=projects/*/locations/*}/operations' + +authentication: + rules: + - selector: 'google.cloud.notebooks.v1beta1.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/v1beta1/service.proto b/google/cloud/notebooks/v1beta1/service.proto new file mode 100644 index 00000000..21a8ccb9 --- /dev/null +++ b/google/cloud/notebooks/v1beta1/service.proto @@ -0,0 +1,506 @@ +// Copyright 2020 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.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/notebooks/v1beta1/environment.proto"; +import "google/cloud/notebooks/v1beta1/instance.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/client.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/notebooks/v1beta1;notebooks"; +option csharp_namespace = "Google.Cloud.Notebooks.V1Beta1"; +option php_namespace = "Google\\Cloud\\Notebooks\\V1Beta1"; +option ruby_package = "Google::Cloud::Notebooks::V1Beta1"; +option java_multiple_files = true; +option java_outer_classname = "NotebooksProto"; +option java_package = "com.google.cloud.notebooks.v1beta1"; + +// API service for Cloud AI Platform Notebooks. +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: "/v1beta1/{parent=projects/*/locations/*}/instances" + }; + } + + // Gets details of a single Instance. + rpc GetInstance(GetInstanceRequest) returns (Instance) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/instances/*}" + }; + } + + // Creates a new Instance in a given project and location. + rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/*}/instances" + body: "instance" + }; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // Registers an existing legacy notebook instance to the Notebooks API server. + // Legacy instances are instances created with the legacy Compute Engine + // calls. They are not manageable by the Notebooks API out of the box. This + // call makes these instances manageable by the Notebooks API. + rpc RegisterInstance(RegisterInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/*}/instances:register" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // Updates the guest accelerators of a single Instance. + rpc SetInstanceAccelerator(SetInstanceAcceleratorRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta1/{name=projects/*/locations/*/instances/*}:setAccelerator" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // Updates the machine type of a single Instance. + rpc SetInstanceMachineType(SetInstanceMachineTypeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta1/{name=projects/*/locations/*/instances/*}:setMachineType" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // Updates the labels of an Instance. + rpc SetInstanceLabels(SetInstanceLabelsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta1/{name=projects/*/locations/*/instances/*}:setLabels" + body: "*" + }; + 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: "/v1beta1/{name=projects/*/locations/*/instances/*}" + }; + 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: "/v1beta1/{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: "/v1beta1/{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: "/v1beta1/{name=projects/*/locations/*/instances/*}:reset" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // Allows notebook instances to + // report their latest instance information to the Notebooks + // API server. The server will merge the reported information to + // the instance metadata store. Do not use this method directly. + rpc ReportInstanceInfo(ReportInstanceInfoRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/instances/*}:report" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // Check if a notebook instance is upgradable. + rpc IsInstanceUpgradeable(IsInstanceUpgradeableRequest) returns (IsInstanceUpgradeableResponse) { + option (google.api.http) = { + get: "/v1beta1/{notebook_instance=projects/*/locations/*/instances/*}:isUpgradeable" + }; + } + + // Upgrades a notebook instance to the latest version. + rpc UpgradeInstance(UpgradeInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/instances/*}:upgrade" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // Allows notebook instances to + // call this endpoint to upgrade themselves. Do not use this method directly. + rpc UpgradeInstanceInternal(UpgradeInstanceInternalRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/instances/*}:upgradeInternal" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // Lists environments in a project. + rpc ListEnvironments(ListEnvironmentsRequest) returns (ListEnvironmentsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/*}/environments" + }; + } + + // Gets details of a single Environment. + rpc GetEnvironment(GetEnvironmentRequest) returns (Environment) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/environments/*}" + }; + } + + // Creates a new Environment. + rpc CreateEnvironment(CreateEnvironmentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/*}/environments" + body: "environment" + }; + option (google.longrunning.operation_info) = { + response_type: "Environment" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a single Environment. + rpc DeleteEnvironment(DeleteEnvironmentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta1/{name=projects/*/locations/*/environments/*}" + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + 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; +} + +// Request for listing notebook instances. +message ListInstancesRequest { + // Required. Format: + // `parent=projects/{project_id}/locations/{location}` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Maximum return size of the list call. + int32 page_size = 2; + + // A previous returned page token that can be used to continue listing + // from the last result. + string page_token = 3; +} + +// 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]; +} + +// Request for creating a notebook instance. +message CreateInstanceRequest { + // Required. Format: + // `parent=projects/{project_id}/locations/{location}` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // 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]; +} + +// Request for registering a notebook instance. +message RegisterInstanceRequest { + // Required. Format: + // `parent=projects/{project_id}/locations/{location}` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. User defined unique ID of this instance. The `instance_id` must + // be 1 to 63 characters long and contain only lowercase letters, + // numeric characters, and dashes. The first character must be a lowercase + // letter and the last character cannot be a dash. + string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for setting instance accelerator. +message SetInstanceAcceleratorRequest { + // Required. Format: + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Type of this accelerator. + Instance.AcceleratorType type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Count of cores of this accelerator. Note that not all combinations + // of `type` and `core_count` are valid. Check [GPUs on + // Compute Engine](/compute/docs/gpus/#gpus-list) to find a valid + // combination. TPUs are not supported. + int64 core_count = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for setting instance machine type. +message SetInstanceMachineTypeRequest { + // Required. Format: + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The [Compute Engine machine type](/compute/docs/machine-types). + string machine_type = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for setting instance labels. +message SetInstanceLabelsRequest { + // Required. Format: + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Labels to apply to this instance. + // These can be later modified by the setLabels method + map labels = 2; +} + +// 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]; +} + +// 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 reseting 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 notebook instances to report information to Notebooks API. +message ReportInstanceInfoRequest { + // Required. Format: + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The VM hardware token for authenticating the VM. + // https://cloud.google.com/compute/docs/instances/verifying-instance-identity + string vm_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // The metadata reported to Notebooks API. This will be merged to the instance + // metadata store + map metadata = 3; +} + +// Request for checking if a notebook instance is upgradeable. +message IsInstanceUpgradeableRequest { + // 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 IsInstanceUpgradeableResponse { + // 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; +} + +// 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 upgrading a notebook instance from within the VM +message UpgradeInstanceInternalRequest { + // Required. Format: + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The VM hardware token for authenticating the VM. + // https://cloud.google.com/compute/docs/instances/verifying-instance-identity + string vm_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for listing environments. +message ListEnvironmentsRequest { + // Required. Format: `projects/{project_id}/locations/{location}` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Maximum return size of the list call. + int32 page_size = 2; + + // A previous returned page token that can be used to continue listing from + // the last result. + string page_token = 3; +} + +// Response for listing environments. +message ListEnvironmentsResponse { + // A list of returned environments. + repeated Environment environments = 1; + + // A 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. + repeated string unreachable = 3; +} + +// Request for getting a notebook environment. +message GetEnvironmentRequest { + // Required. Format: + // `projects/{project_id}/locations/{location}/environments/{environment_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for creating a notebook environment. +message CreateEnvironmentRequest { + // Required. Format: `projects/{project_id}/locations/{location}` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. User-defined unique ID of this environment. The `environment_id` must + // be 1 to 63 characters long and contain only lowercase letters, + // numeric characters, and dashes. The first character must be a lowercase + // letter and the last character cannot be a dash. + string environment_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The environment to be created. + Environment environment = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for deleting a notebook environment. +message DeleteEnvironmentRequest { + // Required. Format: + // `projects/{project_id}/locations/{location}/environments/{environment_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +}