1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.cloud.notebooks.v1beta1; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/cloud/notebooks/v1beta1/environment.proto"; 23import "google/cloud/notebooks/v1beta1/instance.proto"; 24import "google/longrunning/operations.proto"; 25import "google/protobuf/timestamp.proto"; 26 27option csharp_namespace = "Google.Cloud.Notebooks.V1Beta1"; 28option go_package = "cloud.google.com/go/notebooks/apiv1beta1/notebookspb;notebookspb"; 29option java_multiple_files = true; 30option java_outer_classname = "NotebooksProto"; 31option java_package = "com.google.cloud.notebooks.v1beta1"; 32option php_namespace = "Google\\Cloud\\Notebooks\\V1beta1"; 33option ruby_package = "Google::Cloud::Notebooks::V1beta1"; 34 35// API v1beta1 service for Cloud AI Platform Notebooks. 36service NotebookService { 37 option (google.api.default_host) = "notebooks.googleapis.com"; 38 option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; 39 40 // Lists instances in a given project and location. 41 rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { 42 option (google.api.http) = { 43 get: "/v1beta1/{parent=projects/*/locations/*}/instances" 44 }; 45 } 46 47 // Gets details of a single Instance. 48 rpc GetInstance(GetInstanceRequest) returns (Instance) { 49 option (google.api.http) = { 50 get: "/v1beta1/{name=projects/*/locations/*/instances/*}" 51 }; 52 } 53 54 // Creates a new Instance in a given project and location. 55 rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { 56 option (google.api.http) = { 57 post: "/v1beta1/{parent=projects/*/locations/*}/instances" 58 body: "instance" 59 }; 60 option (google.longrunning.operation_info) = { 61 response_type: "Instance" 62 metadata_type: "OperationMetadata" 63 }; 64 } 65 66 // Registers an existing legacy notebook instance to the Notebooks API server. 67 // Legacy instances are instances created with the legacy Compute Engine 68 // calls. They are not manageable by the Notebooks API out of the box. This 69 // call makes these instances manageable by the Notebooks API. 70 rpc RegisterInstance(RegisterInstanceRequest) returns (google.longrunning.Operation) { 71 option (google.api.http) = { 72 post: "/v1beta1/{parent=projects/*/locations/*}/instances:register" 73 body: "*" 74 }; 75 option (google.longrunning.operation_info) = { 76 response_type: "Instance" 77 metadata_type: "OperationMetadata" 78 }; 79 } 80 81 // Updates the guest accelerators of a single Instance. 82 rpc SetInstanceAccelerator(SetInstanceAcceleratorRequest) returns (google.longrunning.Operation) { 83 option (google.api.http) = { 84 patch: "/v1beta1/{name=projects/*/locations/*/instances/*}:setAccelerator" 85 body: "*" 86 }; 87 option (google.longrunning.operation_info) = { 88 response_type: "Instance" 89 metadata_type: "OperationMetadata" 90 }; 91 } 92 93 // Updates the machine type of a single Instance. 94 rpc SetInstanceMachineType(SetInstanceMachineTypeRequest) returns (google.longrunning.Operation) { 95 option (google.api.http) = { 96 patch: "/v1beta1/{name=projects/*/locations/*/instances/*}:setMachineType" 97 body: "*" 98 }; 99 option (google.longrunning.operation_info) = { 100 response_type: "Instance" 101 metadata_type: "OperationMetadata" 102 }; 103 } 104 105 // Updates the labels of an Instance. 106 rpc SetInstanceLabels(SetInstanceLabelsRequest) returns (google.longrunning.Operation) { 107 option (google.api.http) = { 108 patch: "/v1beta1/{name=projects/*/locations/*/instances/*}:setLabels" 109 body: "*" 110 }; 111 option (google.longrunning.operation_info) = { 112 response_type: "Instance" 113 metadata_type: "OperationMetadata" 114 }; 115 } 116 117 // Deletes a single Instance. 118 rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) { 119 option (google.api.http) = { 120 delete: "/v1beta1/{name=projects/*/locations/*/instances/*}" 121 }; 122 option (google.longrunning.operation_info) = { 123 response_type: "google.protobuf.Empty" 124 metadata_type: "OperationMetadata" 125 }; 126 } 127 128 // Starts a notebook instance. 129 rpc StartInstance(StartInstanceRequest) returns (google.longrunning.Operation) { 130 option (google.api.http) = { 131 post: "/v1beta1/{name=projects/*/locations/*/instances/*}:start" 132 body: "*" 133 }; 134 option (google.longrunning.operation_info) = { 135 response_type: "Instance" 136 metadata_type: "OperationMetadata" 137 }; 138 } 139 140 // Stops a notebook instance. 141 rpc StopInstance(StopInstanceRequest) returns (google.longrunning.Operation) { 142 option (google.api.http) = { 143 post: "/v1beta1/{name=projects/*/locations/*/instances/*}:stop" 144 body: "*" 145 }; 146 option (google.longrunning.operation_info) = { 147 response_type: "Instance" 148 metadata_type: "OperationMetadata" 149 }; 150 } 151 152 // Resets a notebook instance. 153 rpc ResetInstance(ResetInstanceRequest) returns (google.longrunning.Operation) { 154 option (google.api.http) = { 155 post: "/v1beta1/{name=projects/*/locations/*/instances/*}:reset" 156 body: "*" 157 }; 158 option (google.longrunning.operation_info) = { 159 response_type: "Instance" 160 metadata_type: "OperationMetadata" 161 }; 162 } 163 164 // Allows notebook instances to 165 // report their latest instance information to the Notebooks 166 // API server. The server will merge the reported information to 167 // the instance metadata store. Do not use this method directly. 168 rpc ReportInstanceInfo(ReportInstanceInfoRequest) returns (google.longrunning.Operation) { 169 option (google.api.http) = { 170 post: "/v1beta1/{name=projects/*/locations/*/instances/*}:report" 171 body: "*" 172 }; 173 option (google.longrunning.operation_info) = { 174 response_type: "Instance" 175 metadata_type: "OperationMetadata" 176 }; 177 } 178 179 // Check if a notebook instance is upgradable. 180 // Deprecated. Please consider using v1. 181 rpc IsInstanceUpgradeable(IsInstanceUpgradeableRequest) returns (IsInstanceUpgradeableResponse) { 182 option deprecated = true; 183 option (google.api.http) = { 184 get: "/v1beta1/{notebook_instance=projects/*/locations/*/instances/*}:isUpgradeable" 185 }; 186 } 187 188 // Upgrades a notebook instance to the latest version. 189 // Deprecated. Please consider using v1. 190 rpc UpgradeInstance(UpgradeInstanceRequest) returns (google.longrunning.Operation) { 191 option deprecated = true; 192 option (google.api.http) = { 193 post: "/v1beta1/{name=projects/*/locations/*/instances/*}:upgrade" 194 body: "*" 195 }; 196 option (google.longrunning.operation_info) = { 197 response_type: "Instance" 198 metadata_type: "OperationMetadata" 199 }; 200 } 201 202 // Allows notebook instances to 203 // call this endpoint to upgrade themselves. Do not use this method directly. 204 // Deprecated. Please consider using v1. 205 rpc UpgradeInstanceInternal(UpgradeInstanceInternalRequest) returns (google.longrunning.Operation) { 206 option deprecated = true; 207 option (google.api.http) = { 208 post: "/v1beta1/{name=projects/*/locations/*/instances/*}:upgradeInternal" 209 body: "*" 210 }; 211 option (google.longrunning.operation_info) = { 212 response_type: "Instance" 213 metadata_type: "OperationMetadata" 214 }; 215 } 216 217 // Lists environments in a project. 218 rpc ListEnvironments(ListEnvironmentsRequest) returns (ListEnvironmentsResponse) { 219 option (google.api.http) = { 220 get: "/v1beta1/{parent=projects/*/locations/*}/environments" 221 }; 222 } 223 224 // Gets details of a single Environment. 225 rpc GetEnvironment(GetEnvironmentRequest) returns (Environment) { 226 option (google.api.http) = { 227 get: "/v1beta1/{name=projects/*/locations/*/environments/*}" 228 }; 229 } 230 231 // Creates a new Environment. 232 rpc CreateEnvironment(CreateEnvironmentRequest) returns (google.longrunning.Operation) { 233 option (google.api.http) = { 234 post: "/v1beta1/{parent=projects/*/locations/*}/environments" 235 body: "environment" 236 }; 237 option (google.longrunning.operation_info) = { 238 response_type: "Environment" 239 metadata_type: "OperationMetadata" 240 }; 241 } 242 243 // Deletes a single Environment. 244 rpc DeleteEnvironment(DeleteEnvironmentRequest) returns (google.longrunning.Operation) { 245 option (google.api.http) = { 246 delete: "/v1beta1/{name=projects/*/locations/*/environments/*}" 247 }; 248 option (google.longrunning.operation_info) = { 249 response_type: "google.protobuf.Empty" 250 metadata_type: "OperationMetadata" 251 }; 252 } 253} 254 255// Represents the metadata of the long-running operation. 256message OperationMetadata { 257 // The time the operation was created. 258 google.protobuf.Timestamp create_time = 1; 259 260 // The time the operation finished running. 261 google.protobuf.Timestamp end_time = 2; 262 263 // Server-defined resource path for the target of the operation. 264 string target = 3; 265 266 // Name of the verb executed by the operation. 267 string verb = 4; 268 269 // Human-readable status of the operation, if any. 270 string status_message = 5; 271 272 // Identifies whether the user has requested cancellation 273 // of the operation. Operations that have successfully been cancelled 274 // have [Operation.error][] value with a 275 // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to `Code.CANCELLED`. 276 bool requested_cancellation = 6; 277 278 // API version used to start the operation. 279 string api_version = 7; 280 281 // API endpoint name of this operation. 282 string endpoint = 8; 283} 284 285// Request for listing notebook instances. 286message ListInstancesRequest { 287 // Required. Format: 288 // `parent=projects/{project_id}/locations/{location}` 289 string parent = 1 [(google.api.field_behavior) = REQUIRED]; 290 291 // Maximum return size of the list call. 292 int32 page_size = 2; 293 294 // A previous returned page token that can be used to continue listing 295 // from the last result. 296 string page_token = 3; 297} 298 299// Response for listing notebook instances. 300message ListInstancesResponse { 301 // A list of returned instances. 302 repeated Instance instances = 1; 303 304 // Page token that can be used to continue listing from the last result in the 305 // next list call. 306 string next_page_token = 2; 307 308 // Locations that could not be reached. For example, 309 // `['us-west1-a', 'us-central1-b']`. 310 // A ListInstancesResponse will only contain either instances or unreachables, 311 repeated string unreachable = 3; 312} 313 314// Request for getting a notebook instance. 315message GetInstanceRequest { 316 // Required. Format: 317 // `projects/{project_id}/locations/{location}/instances/{instance_id}` 318 string name = 1 [(google.api.field_behavior) = REQUIRED]; 319} 320 321// Request for creating a notebook instance. 322message CreateInstanceRequest { 323 // Required. Format: 324 // `parent=projects/{project_id}/locations/{location}` 325 string parent = 1 [(google.api.field_behavior) = REQUIRED]; 326 327 // Required. User-defined unique ID of this instance. 328 string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; 329 330 // Required. The instance to be created. 331 Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; 332} 333 334// Request for registering a notebook instance. 335message RegisterInstanceRequest { 336 // Required. Format: 337 // `parent=projects/{project_id}/locations/{location}` 338 string parent = 1 [(google.api.field_behavior) = REQUIRED]; 339 340 // Required. User defined unique ID of this instance. The `instance_id` must 341 // be 1 to 63 characters long and contain only lowercase letters, 342 // numeric characters, and dashes. The first character must be a lowercase 343 // letter and the last character cannot be a dash. 344 string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; 345} 346 347// Request for setting instance accelerator. 348message SetInstanceAcceleratorRequest { 349 // Required. Format: 350 // `projects/{project_id}/locations/{location}/instances/{instance_id}` 351 string name = 1 [(google.api.field_behavior) = REQUIRED]; 352 353 // Required. Type of this accelerator. 354 Instance.AcceleratorType type = 2 [(google.api.field_behavior) = REQUIRED]; 355 356 // Required. Count of cores of this accelerator. Note that not all combinations 357 // of `type` and `core_count` are valid. Check [GPUs on 358 // Compute Engine](https://cloud.google.com/compute/docs/gpus/#gpus-list) to 359 // find a valid combination. TPUs are not supported. 360 int64 core_count = 3 [(google.api.field_behavior) = REQUIRED]; 361} 362 363// Request for setting instance machine type. 364message SetInstanceMachineTypeRequest { 365 // Required. Format: 366 // `projects/{project_id}/locations/{location}/instances/{instance_id}` 367 string name = 1 [(google.api.field_behavior) = REQUIRED]; 368 369 // Required. The [Compute Engine machine 370 // type](https://cloud.google.com/compute/docs/machine-types). 371 string machine_type = 2 [(google.api.field_behavior) = REQUIRED]; 372} 373 374// Request for setting instance labels. 375message SetInstanceLabelsRequest { 376 // Required. Format: 377 // `projects/{project_id}/locations/{location}/instances/{instance_id}` 378 string name = 1 [(google.api.field_behavior) = REQUIRED]; 379 380 // Labels to apply to this instance. 381 // These can be later modified by the setLabels method 382 map<string, string> labels = 2; 383} 384 385// Request for deleting a notebook instance. 386message DeleteInstanceRequest { 387 // Required. Format: 388 // `projects/{project_id}/locations/{location}/instances/{instance_id}` 389 string name = 1 [(google.api.field_behavior) = REQUIRED]; 390} 391 392// Request for starting a notebook instance 393message StartInstanceRequest { 394 // Required. Format: 395 // `projects/{project_id}/locations/{location}/instances/{instance_id}` 396 string name = 1 [(google.api.field_behavior) = REQUIRED]; 397} 398 399// Request for stopping a notebook instance 400message StopInstanceRequest { 401 // Required. Format: 402 // `projects/{project_id}/locations/{location}/instances/{instance_id}` 403 string name = 1 [(google.api.field_behavior) = REQUIRED]; 404} 405 406// Request for reseting a notebook instance 407message ResetInstanceRequest { 408 // Required. Format: 409 // `projects/{project_id}/locations/{location}/instances/{instance_id}` 410 string name = 1 [(google.api.field_behavior) = REQUIRED]; 411} 412 413// Request for notebook instances to report information to Notebooks API. 414message ReportInstanceInfoRequest { 415 // Required. Format: 416 // `projects/{project_id}/locations/{location}/instances/{instance_id}` 417 string name = 1 [(google.api.field_behavior) = REQUIRED]; 418 419 // Required. The VM hardware token for authenticating the VM. 420 // https://cloud.google.com/compute/docs/instances/verifying-instance-identity 421 string vm_id = 2 [(google.api.field_behavior) = REQUIRED]; 422 423 // The metadata reported to Notebooks API. This will be merged to the instance 424 // metadata store 425 map<string, string> metadata = 3; 426} 427 428// Request for checking if a notebook instance is upgradeable. 429message IsInstanceUpgradeableRequest { 430 // Required. Format: 431 // `projects/{project_id}/locations/{location}/instances/{instance_id}` 432 string notebook_instance = 1 [(google.api.field_behavior) = REQUIRED]; 433} 434 435// Response for checking if a notebook instance is upgradeable. 436message IsInstanceUpgradeableResponse { 437 // If an instance is upgradeable. 438 bool upgradeable = 1; 439 440 // The version this instance will be upgraded to if calling the upgrade 441 // endpoint. This field will only be populated if field upgradeable is true. 442 string upgrade_version = 2; 443 444 // Additional information about upgrade. 445 string upgrade_info = 3; 446 447 // The new image self link this instance will be upgraded to if calling the 448 // upgrade endpoint. This field will only be populated if field upgradeable 449 // is true. 450 string upgrade_image = 4; 451} 452 453// Request for upgrading a notebook instance 454message UpgradeInstanceRequest { 455 // Required. Format: 456 // `projects/{project_id}/locations/{location}/instances/{instance_id}` 457 string name = 1 [(google.api.field_behavior) = REQUIRED]; 458} 459 460// Request for upgrading a notebook instance from within the VM 461message UpgradeInstanceInternalRequest { 462 // Required. Format: 463 // `projects/{project_id}/locations/{location}/instances/{instance_id}` 464 string name = 1 [(google.api.field_behavior) = REQUIRED]; 465 466 // Required. The VM hardware token for authenticating the VM. 467 // https://cloud.google.com/compute/docs/instances/verifying-instance-identity 468 string vm_id = 2 [(google.api.field_behavior) = REQUIRED]; 469} 470 471// Request for listing environments. 472message ListEnvironmentsRequest { 473 // Required. Format: `projects/{project_id}/locations/{location}` 474 string parent = 1 [(google.api.field_behavior) = REQUIRED]; 475 476 // Maximum return size of the list call. 477 int32 page_size = 2; 478 479 // A previous returned page token that can be used to continue listing from 480 // the last result. 481 string page_token = 3; 482} 483 484// Response for listing environments. 485message ListEnvironmentsResponse { 486 // A list of returned environments. 487 repeated Environment environments = 1; 488 489 // A page token that can be used to continue listing from the last result 490 // in the next list call. 491 string next_page_token = 2; 492 493 // Locations that could not be reached. 494 repeated string unreachable = 3; 495} 496 497// Request for getting a notebook environment. 498message GetEnvironmentRequest { 499 // Required. Format: 500 // `projects/{project_id}/locations/{location}/environments/{environment_id}` 501 string name = 1 [(google.api.field_behavior) = REQUIRED]; 502} 503 504// Request for creating a notebook environment. 505message CreateEnvironmentRequest { 506 // Required. Format: `projects/{project_id}/locations/{location}` 507 string parent = 1 [(google.api.field_behavior) = REQUIRED]; 508 509 // Required. User-defined unique ID of this environment. The `environment_id` must 510 // be 1 to 63 characters long and contain only lowercase letters, 511 // numeric characters, and dashes. The first character must be a lowercase 512 // letter and the last character cannot be a dash. 513 string environment_id = 2 [(google.api.field_behavior) = REQUIRED]; 514 515 // Required. The environment to be created. 516 Environment environment = 3 [(google.api.field_behavior) = REQUIRED]; 517} 518 519// Request for deleting a notebook environment. 520message DeleteEnvironmentRequest { 521 // Required. Format: 522 // `projects/{project_id}/locations/{location}/environments/{environment_id}` 523 string name = 1 [(google.api.field_behavior) = REQUIRED]; 524} 525