xref: /aosp_15_r20/external/googleapis/google/cloud/notebooks/v1/managed_service.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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.v1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/cloud/notebooks/v1/diagnostic_config.proto";
24import "google/cloud/notebooks/v1/event.proto";
25import "google/cloud/notebooks/v1/runtime.proto";
26import "google/longrunning/operations.proto";
27import "google/protobuf/field_mask.proto";
28import "google/protobuf/timestamp.proto";
29
30option csharp_namespace = "Google.Cloud.Notebooks.V1";
31option go_package = "cloud.google.com/go/notebooks/apiv1/notebookspb;notebookspb";
32option java_multiple_files = true;
33option java_outer_classname = "ManagedNotebooksProto";
34option java_package = "com.google.cloud.notebooks.v1";
35option php_namespace = "Google\\Cloud\\Notebooks\\V1";
36option ruby_package = "Google::Cloud::Notebooks::V1";
37
38// API v1 service for Managed Notebooks.
39service ManagedNotebookService {
40  option (google.api.default_host) = "notebooks.googleapis.com";
41  option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
42
43  // Lists Runtimes in a given project and location.
44  rpc ListRuntimes(ListRuntimesRequest) returns (ListRuntimesResponse) {
45    option (google.api.http) = {
46      get: "/v1/{parent=projects/*/locations/*}/runtimes"
47    };
48    option (google.api.method_signature) = "parent";
49  }
50
51  // Gets details of a single Runtime. The location must be a regional endpoint
52  // rather than zonal.
53  rpc GetRuntime(GetRuntimeRequest) returns (Runtime) {
54    option (google.api.http) = {
55      get: "/v1/{name=projects/*/locations/*/runtimes/*}"
56    };
57    option (google.api.method_signature) = "name";
58  }
59
60  // Creates a new Runtime in a given project and location.
61  rpc CreateRuntime(CreateRuntimeRequest) returns (google.longrunning.Operation) {
62    option (google.api.http) = {
63      post: "/v1/{parent=projects/*/locations/*}/runtimes"
64      body: "runtime"
65    };
66    option (google.api.method_signature) = "parent,runtime_id,runtime";
67    option (google.longrunning.operation_info) = {
68      response_type: "Runtime"
69      metadata_type: "OperationMetadata"
70    };
71  }
72
73  // Update Notebook Runtime configuration.
74  rpc UpdateRuntime(UpdateRuntimeRequest) returns (google.longrunning.Operation) {
75    option (google.api.http) = {
76      patch: "/v1/{runtime.name=projects/*/locations/*/runtimes/*}"
77      body: "runtime"
78    };
79    option (google.api.method_signature) = "runtime,update_mask";
80    option (google.longrunning.operation_info) = {
81      response_type: "Runtime"
82      metadata_type: "OperationMetadata"
83    };
84  }
85
86  // Deletes a single Runtime.
87  rpc DeleteRuntime(DeleteRuntimeRequest) returns (google.longrunning.Operation) {
88    option (google.api.http) = {
89      delete: "/v1/{name=projects/*/locations/*/runtimes/*}"
90    };
91    option (google.api.method_signature) = "name";
92    option (google.longrunning.operation_info) = {
93      response_type: "google.protobuf.Empty"
94      metadata_type: "OperationMetadata"
95    };
96  }
97
98  // Starts a Managed Notebook Runtime.
99  // Perform "Start" on GPU instances; "Resume" on CPU instances
100  // See:
101  // https://cloud.google.com/compute/docs/instances/stop-start-instance
102  // https://cloud.google.com/compute/docs/instances/suspend-resume-instance
103  rpc StartRuntime(StartRuntimeRequest) returns (google.longrunning.Operation) {
104    option (google.api.http) = {
105      post: "/v1/{name=projects/*/locations/*/runtimes/*}:start"
106      body: "*"
107    };
108    option (google.api.method_signature) = "name";
109    option (google.longrunning.operation_info) = {
110      response_type: "Runtime"
111      metadata_type: "OperationMetadata"
112    };
113  }
114
115  // Stops a Managed Notebook Runtime.
116  // Perform "Stop" on GPU instances; "Suspend" on CPU instances
117  // See:
118  // https://cloud.google.com/compute/docs/instances/stop-start-instance
119  // https://cloud.google.com/compute/docs/instances/suspend-resume-instance
120  rpc StopRuntime(StopRuntimeRequest) returns (google.longrunning.Operation) {
121    option (google.api.http) = {
122      post: "/v1/{name=projects/*/locations/*/runtimes/*}:stop"
123      body: "*"
124    };
125    option (google.api.method_signature) = "name";
126    option (google.longrunning.operation_info) = {
127      response_type: "Runtime"
128      metadata_type: "OperationMetadata"
129    };
130  }
131
132  // Switch a Managed Notebook Runtime.
133  rpc SwitchRuntime(SwitchRuntimeRequest) returns (google.longrunning.Operation) {
134    option (google.api.http) = {
135      post: "/v1/{name=projects/*/locations/*/runtimes/*}:switch"
136      body: "*"
137    };
138    option (google.api.method_signature) = "name";
139    option (google.longrunning.operation_info) = {
140      response_type: "Runtime"
141      metadata_type: "OperationMetadata"
142    };
143  }
144
145  // Resets a Managed Notebook Runtime.
146  rpc ResetRuntime(ResetRuntimeRequest) returns (google.longrunning.Operation) {
147    option (google.api.http) = {
148      post: "/v1/{name=projects/*/locations/*/runtimes/*}:reset"
149      body: "*"
150    };
151    option (google.api.method_signature) = "name";
152    option (google.longrunning.operation_info) = {
153      response_type: "Runtime"
154      metadata_type: "OperationMetadata"
155    };
156  }
157
158  // Upgrades a Managed Notebook Runtime to the latest version.
159  rpc UpgradeRuntime(UpgradeRuntimeRequest) returns (google.longrunning.Operation) {
160    option (google.api.http) = {
161      post: "/v1/{name=projects/*/locations/*/runtimes/*}:upgrade"
162      body: "*"
163    };
164    option (google.api.method_signature) = "name";
165    option (google.longrunning.operation_info) = {
166      response_type: "Runtime"
167      metadata_type: "OperationMetadata"
168    };
169  }
170
171  // Report and process a runtime event.
172  rpc ReportRuntimeEvent(ReportRuntimeEventRequest) returns (google.longrunning.Operation) {
173    option (google.api.http) = {
174      post: "/v1/{name=projects/*/locations/*/runtimes/*}:reportEvent"
175      body: "*"
176    };
177    option (google.api.method_signature) = "name";
178    option (google.longrunning.operation_info) = {
179      response_type: "Runtime"
180      metadata_type: "OperationMetadata"
181    };
182  }
183
184  // Gets an access token for the consumer service account that the customer
185  // attached to the runtime. Only accessible from the tenant instance.
186  rpc RefreshRuntimeTokenInternal(RefreshRuntimeTokenInternalRequest) returns (RefreshRuntimeTokenInternalResponse) {
187    option (google.api.http) = {
188      post: "/v1/{name=projects/*/locations/*/runtimes/*}:refreshRuntimeTokenInternal"
189      body: "*"
190    };
191    option (google.api.method_signature) = "name,vm_id";
192  }
193
194  // Creates a Diagnostic File and runs Diagnostic Tool given a Runtime.
195  rpc DiagnoseRuntime(DiagnoseRuntimeRequest) returns (google.longrunning.Operation) {
196    option (google.api.http) = {
197      post: "/v1/{name=projects/*/locations/*/runtimes/*}:diagnose"
198      body: "*"
199    };
200    option (google.api.method_signature) = "name,diagnostic_config";
201    option (google.longrunning.operation_info) = {
202      response_type: "Runtime"
203      metadata_type: "OperationMetadata"
204    };
205  }
206}
207
208// Request for listing Managed Notebook Runtimes.
209message ListRuntimesRequest {
210  // Required. Format:
211  // `parent=projects/{project_id}/locations/{location}`
212  string parent = 1 [
213    (google.api.field_behavior) = REQUIRED,
214    (google.api.resource_reference) = {
215      child_type: "notebooks.googleapis.com/Runtime"
216    }
217  ];
218
219  // Maximum return size of the list call.
220  int32 page_size = 2;
221
222  // A previous returned page token that can be used to continue listing
223  // from the last result.
224  string page_token = 3;
225}
226
227// Response for listing Managed Notebook Runtimes.
228message ListRuntimesResponse {
229  // A list of returned Runtimes.
230  repeated Runtime runtimes = 1;
231
232  // Page token that can be used to continue listing from the last result in the
233  // next list call.
234  string next_page_token = 2;
235
236  // Locations that could not be reached. For example,
237  // `['us-west1', 'us-central1']`.
238  // A ListRuntimesResponse will only contain either runtimes or unreachables,
239  repeated string unreachable = 3;
240}
241
242// Request for getting a Managed Notebook Runtime.
243message GetRuntimeRequest {
244  // Required. Format:
245  // `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
246  string name = 1 [
247    (google.api.field_behavior) = REQUIRED,
248    (google.api.resource_reference) = {
249      type: "notebooks.googleapis.com/Runtime"
250    }
251  ];
252}
253
254// Request for creating a Managed Notebook Runtime.
255message CreateRuntimeRequest {
256  // Required. Format:
257  // `parent=projects/{project_id}/locations/{location}`
258  string parent = 1 [
259    (google.api.field_behavior) = REQUIRED,
260    (google.api.resource_reference) = {
261      type: "notebooks.googleapis.com/Runtime"
262    }
263  ];
264
265  // Required. User-defined unique ID of this Runtime.
266  string runtime_id = 2 [(google.api.field_behavior) = REQUIRED];
267
268  // Required. The Runtime to be created.
269  Runtime runtime = 3 [(google.api.field_behavior) = REQUIRED];
270
271  // Idempotent request UUID.
272  string request_id = 4;
273}
274
275// Request for deleting a Managed Notebook Runtime.
276message DeleteRuntimeRequest {
277  // Required. Format:
278  // `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
279  string name = 1 [
280    (google.api.field_behavior) = REQUIRED,
281    (google.api.resource_reference) = {
282      type: "notebooks.googleapis.com/Runtime"
283    }
284  ];
285
286  // Idempotent request UUID.
287  string request_id = 2;
288}
289
290// Request for starting a Managed Notebook Runtime.
291message StartRuntimeRequest {
292  // Required. Format:
293  // `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
294  string name = 1 [(google.api.field_behavior) = REQUIRED];
295
296  // Idempotent request UUID.
297  string request_id = 2;
298}
299
300// Request for stopping a Managed Notebook Runtime.
301message StopRuntimeRequest {
302  // Required. Format:
303  // `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
304  string name = 1 [(google.api.field_behavior) = REQUIRED];
305
306  // Idempotent request UUID.
307  string request_id = 2;
308}
309
310// Request for switching a Managed Notebook Runtime.
311message SwitchRuntimeRequest {
312  // Required. Format:
313  // `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
314  string name = 1 [(google.api.field_behavior) = REQUIRED];
315
316  // machine type.
317  string machine_type = 2;
318
319  // accelerator config.
320  RuntimeAcceleratorConfig accelerator_config = 3;
321
322  // Idempotent request UUID.
323  string request_id = 4;
324}
325
326// Request for resetting a Managed Notebook Runtime.
327message ResetRuntimeRequest {
328  // Required. Format:
329  // `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
330  string name = 1 [(google.api.field_behavior) = REQUIRED];
331
332  // Idempotent request UUID.
333  string request_id = 2;
334}
335
336// Request for upgrading a Managed Notebook Runtime to the latest version.
337// option (google.api.message_visibility).restriction =
338//     "TRUSTED_TESTER,SPECIAL_TESTER";
339message UpgradeRuntimeRequest {
340  // Required. Format:
341  // `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
342  string name = 1 [(google.api.field_behavior) = REQUIRED];
343
344  // Idempotent request UUID.
345  string request_id = 2;
346}
347
348// Request for reporting a Managed Notebook Event.
349message ReportRuntimeEventRequest {
350  // Required. Format:
351  // `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
352  string name = 1 [
353    (google.api.field_behavior) = REQUIRED,
354    (google.api.resource_reference) = {
355      type: "notebooks.googleapis.com/Runtime"
356    }
357  ];
358
359  // Required. The VM hardware token for authenticating the VM.
360  // https://cloud.google.com/compute/docs/instances/verifying-instance-identity
361  string vm_id = 2 [(google.api.field_behavior) = REQUIRED];
362
363  // Required. The Event to be reported.
364  Event event = 3 [(google.api.field_behavior) = REQUIRED];
365}
366
367// Request for updating a Managed Notebook configuration.
368message UpdateRuntimeRequest {
369  // Required. The Runtime to be updated.
370  Runtime runtime = 1 [(google.api.field_behavior) = REQUIRED];
371
372  // Required. Specifies the path, relative to `Runtime`, of
373  // the field to update. For example, to change the software configuration
374  // kernels, the `update_mask` parameter would be
375  // specified as `software_config.kernels`,
376  // and the `PATCH` request body would specify the new value, as follows:
377  //
378  //     {
379  //       "software_config":{
380  //         "kernels": [{
381  //            'repository':
382  //            'gcr.io/deeplearning-platform-release/pytorch-gpu', 'tag':
383  //            'latest' }],
384  //         }
385  //     }
386  //
387  //
388  // Currently, only the following fields can be updated:
389  // - `software_config.kernels`
390  // - `software_config.post_startup_script`
391  // - `software_config.custom_gpu_driver_path`
392  // - `software_config.idle_shutdown`
393  // - `software_config.idle_shutdown_timeout`
394  // - `software_config.disable_terminal`
395  google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
396
397  // Idempotent request UUID.
398  string request_id = 3;
399}
400
401// Request for getting a new access token.
402message RefreshRuntimeTokenInternalRequest {
403  // Required. Format:
404  // `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
405  string name = 1 [
406    (google.api.field_behavior) = REQUIRED,
407    (google.api.resource_reference) = {
408      type: "notebooks.googleapis.com/Runtime"
409    }
410  ];
411
412  // Required. The VM hardware token for authenticating the VM.
413  // https://cloud.google.com/compute/docs/instances/verifying-instance-identity
414  string vm_id = 2 [(google.api.field_behavior) = REQUIRED];
415}
416
417// Response with a new access token.
418message RefreshRuntimeTokenInternalResponse {
419  // The OAuth 2.0 access token.
420  string access_token = 1;
421
422  // Output only. Token expiration time.
423  google.protobuf.Timestamp expire_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
424}
425
426// Request for creating a notebook instance diagnostic file.
427message DiagnoseRuntimeRequest {
428  // Required. Format:
429  // `projects/{project_id}/locations/{location}/runtimes/{runtimes_id}`
430  string name = 1 [
431    (google.api.field_behavior) = REQUIRED,
432    (google.api.resource_reference) = {
433      type: "notebooks.googleapis.com/Runtime"
434    }
435  ];
436
437  // Required. Defines flags that are used to run the diagnostic tool
438  DiagnosticConfig diagnostic_config = 2 [(google.api.field_behavior) = REQUIRED];
439}
440