managed_service.proto 15 KB

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