service.proto 18 KB

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