xref: /aosp_15_r20/external/googleapis/google/cloud/dataproc/v1/sessions.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.dataproc.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/dataproc/v1/shared.proto";
24import "google/longrunning/operations.proto";
25import "google/protobuf/timestamp.proto";
26
27option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb";
28option java_multiple_files = true;
29option java_outer_classname = "SessionsProto";
30option java_package = "com.google.cloud.dataproc.v1";
31
32// The `SessionController` provides methods to manage interactive sessions.
33service SessionController {
34  option (google.api.default_host) = "dataproc.googleapis.com";
35  option (google.api.oauth_scopes) =
36      "https://www.googleapis.com/auth/cloud-platform";
37
38  // Create an interactive session asynchronously.
39  rpc CreateSession(CreateSessionRequest)
40      returns (google.longrunning.Operation) {
41    option (google.api.http) = {
42      post: "/v1/{parent=projects/*/locations/*}/sessions"
43      body: "session"
44    };
45    option (google.api.method_signature) = "parent,session,session_id";
46    option (google.longrunning.operation_info) = {
47      response_type: "Session"
48      metadata_type: "google.cloud.dataproc.v1.SessionOperationMetadata"
49    };
50  }
51
52  // Gets the resource representation for an interactive session.
53  rpc GetSession(GetSessionRequest) returns (Session) {
54    option (google.api.http) = {
55      get: "/v1/{name=projects/*/locations/*/sessions/*}"
56    };
57    option (google.api.method_signature) = "name";
58  }
59
60  // Lists interactive sessions.
61  rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse) {
62    option (google.api.http) = {
63      get: "/v1/{parent=projects/*/locations/*}/sessions"
64    };
65    option (google.api.method_signature) = "parent";
66  }
67
68  // Terminates the interactive session.
69  rpc TerminateSession(TerminateSessionRequest)
70      returns (google.longrunning.Operation) {
71    option (google.api.http) = {
72      post: "/v1/{name=projects/*/locations/*/sessions/*}:terminate"
73      body: "*"
74    };
75    option (google.api.method_signature) = "name";
76    option (google.longrunning.operation_info) = {
77      response_type: "Session"
78      metadata_type: "google.cloud.dataproc.v1.SessionOperationMetadata"
79    };
80  }
81
82  // Deletes the interactive session resource. If the session is not in terminal
83  // state, it is terminated, and then deleted.
84  rpc DeleteSession(DeleteSessionRequest)
85      returns (google.longrunning.Operation) {
86    option (google.api.http) = {
87      delete: "/v1/{name=projects/*/locations/*/sessions/*}"
88    };
89    option (google.api.method_signature) = "name";
90    option (google.longrunning.operation_info) = {
91      response_type: "Session"
92      metadata_type: "google.cloud.dataproc.v1.SessionOperationMetadata"
93    };
94  }
95}
96
97// A request to create a session.
98message CreateSessionRequest {
99  // Required. The parent resource where this session will be created.
100  string parent = 1 [
101    (google.api.field_behavior) = REQUIRED,
102    (google.api.resource_reference) = {
103      child_type: "dataproc.googleapis.com/Session"
104    }
105  ];
106
107  // Required. The interactive session to create.
108  Session session = 2 [(google.api.field_behavior) = REQUIRED];
109
110  // Required. The ID to use for the session, which becomes the final component
111  // of the session's resource name.
112  //
113  // This value must be 4-63 characters. Valid characters
114  // are /[a-z][0-9]-/.
115  string session_id = 3 [(google.api.field_behavior) = REQUIRED];
116
117  // Optional. A unique ID used to identify the request. If the service
118  // receives two
119  // [CreateSessionRequests](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateSessionRequest)s
120  // with the same ID, the second request is ignored, and the
121  // first [Session][google.cloud.dataproc.v1.Session] is created and stored in
122  // the backend.
123  //
124  // Recommendation: Set this value to a
125  // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
126  //
127  // The value must contain only letters (a-z, A-Z), numbers (0-9),
128  // underscores (_), and hyphens (-). The maximum length is 40 characters.
129  string request_id = 4 [(google.api.field_behavior) = OPTIONAL];
130}
131
132// A request to get the resource representation for a session.
133message GetSessionRequest {
134  // Required. The name of the session to retrieve.
135  string name = 1 [
136    (google.api.field_behavior) = REQUIRED,
137    (google.api.resource_reference) = {
138      type: "dataproc.googleapis.com/Session"
139    }
140  ];
141}
142
143// A request to list sessions in a project.
144message ListSessionsRequest {
145  // Required. The parent, which owns this collection of sessions.
146  string parent = 1 [
147    (google.api.field_behavior) = REQUIRED,
148    (google.api.resource_reference) = {
149      child_type: "dataproc.googleapis.com/Session"
150    }
151  ];
152
153  // Optional. The maximum number of sessions to return in each response.
154  // The service may return fewer than this value.
155  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
156
157  // Optional. A page token received from a previous `ListSessions` call.
158  // Provide this token to retrieve the subsequent page.
159  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
160
161  // Optional. A filter for the sessions to return in the response.
162  //
163  // A filter is a logical expression constraining the values of various fields
164  // in each session resource. Filters are case sensitive, and may contain
165  // multiple clauses combined with logical operators (AND, OR).
166  // Supported fields are `session_id`, `session_uuid`, `state`, and
167  // `create_time`.
168  //
169  // Example: `state = ACTIVE and create_time < "2023-01-01T00:00:00Z"`
170  // is a filter for sessions in an ACTIVE state that were created before
171  // 2023-01-01.
172  //
173  // See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed
174  // description of the filter syntax and a list of supported comparators.
175  string filter = 4 [(google.api.field_behavior) = OPTIONAL];
176}
177
178// A list of interactive sessions.
179message ListSessionsResponse {
180  // Output only. The sessions from the specified collection.
181  repeated Session sessions = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
182
183  // A token, which can be sent as `page_token`, to retrieve the next page.
184  // If this field is omitted, there are no subsequent pages.
185  string next_page_token = 2;
186}
187
188// A request to terminate an interactive session.
189message TerminateSessionRequest {
190  // Required. The name of the session resource to terminate.
191  string name = 1 [
192    (google.api.field_behavior) = REQUIRED,
193    (google.api.resource_reference) = {
194      type: "dataproc.googleapis.com/Session"
195    }
196  ];
197
198  // Optional. A unique ID used to identify the request. If the service
199  // receives two
200  // [TerminateSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.TerminateSessionRequest)s
201  // with the same ID, the second request is ignored.
202  //
203  // Recommendation: Set this value to a
204  // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
205  //
206  // The value must contain only letters (a-z, A-Z), numbers (0-9),
207  // underscores (_), and hyphens (-). The maximum length is 40 characters.
208  string request_id = 2 [(google.api.field_behavior) = OPTIONAL];
209}
210
211// A request to delete a session.
212message DeleteSessionRequest {
213  // Required. The name of the session resource to delete.
214  string name = 1 [
215    (google.api.field_behavior) = REQUIRED,
216    (google.api.resource_reference) = {
217      type: "dataproc.googleapis.com/Session"
218    }
219  ];
220
221  // Optional. A unique ID used to identify the request. If the service
222  // receives two
223  // [DeleteSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteSessionRequest)s
224  // with the same ID, the second request is ignored.
225  //
226  // Recommendation: Set this value to a
227  // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
228  //
229  // The value must contain only letters (a-z, A-Z), numbers (0-9),
230  // underscores (_), and hyphens (-). The maximum length is 40 characters.
231  string request_id = 2 [(google.api.field_behavior) = OPTIONAL];
232}
233
234// A representation of a session.
235message Session {
236  option (google.api.resource) = {
237    type: "dataproc.googleapis.com/Session"
238    pattern: "projects/{project}/locations/{location}/sessions/{session}"
239  };
240
241  // The session state.
242  enum State {
243    // The session state is unknown.
244    STATE_UNSPECIFIED = 0;
245
246    // The session is created prior to running.
247    CREATING = 1;
248
249    // The session is running.
250    ACTIVE = 2;
251
252    // The session is terminating.
253    TERMINATING = 3;
254
255    // The session is terminated successfully.
256    TERMINATED = 4;
257
258    // The session is no longer running due to an error.
259    FAILED = 5;
260  }
261
262  // Historical state information.
263  message SessionStateHistory {
264    // Output only. The state of the session at this point in the session
265    // history.
266    State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
267
268    // Output only. Details about the state at this point in the session
269    // history.
270    string state_message = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
271
272    // Output only. The time when the session entered the historical state.
273    google.protobuf.Timestamp state_start_time = 3
274        [(google.api.field_behavior) = OUTPUT_ONLY];
275  }
276
277  // Required. The resource name of the session.
278  string name = 1 [(google.api.field_behavior) = REQUIRED];
279
280  // Output only. A session UUID (Unique Universal Identifier). The service
281  // generates this value when it creates the session.
282  string uuid = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
283
284  // Output only. The time when the session was created.
285  google.protobuf.Timestamp create_time = 3
286      [(google.api.field_behavior) = OUTPUT_ONLY];
287
288  // The session configuration.
289  oneof session_config {
290    // Optional. Jupyter session config.
291    JupyterConfig jupyter_session = 4 [(google.api.field_behavior) = OPTIONAL];
292  }
293
294  // Output only. Runtime information about session execution.
295  RuntimeInfo runtime_info = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
296
297  // Output only. A state of the session.
298  State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
299
300  // Output only. Session state details, such as the failure
301  // description if the state is `FAILED`.
302  string state_message = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
303
304  // Output only. The time when the session entered the current state.
305  google.protobuf.Timestamp state_time = 9
306      [(google.api.field_behavior) = OUTPUT_ONLY];
307
308  // Output only. The email address of the user who created the session.
309  string creator = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
310
311  // Optional. The labels to associate with the session.
312  // Label **keys** must contain 1 to 63 characters, and must conform to
313  // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
314  // Label **values** may be empty, but, if present, must contain 1 to 63
315  // characters, and must conform to [RFC
316  // 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
317  // associated with a session.
318  map<string, string> labels = 11 [(google.api.field_behavior) = OPTIONAL];
319
320  // Optional. Runtime configuration for the session execution.
321  RuntimeConfig runtime_config = 12 [(google.api.field_behavior) = OPTIONAL];
322
323  // Optional. Environment configuration for the session execution.
324  EnvironmentConfig environment_config = 13
325      [(google.api.field_behavior) = OPTIONAL];
326
327  // Optional. The email address of the user who owns the session.
328  string user = 14 [(google.api.field_behavior) = OPTIONAL];
329
330  // Output only. Historical state information for the session.
331  repeated SessionStateHistory state_history = 15
332      [(google.api.field_behavior) = OUTPUT_ONLY];
333
334  // Optional. The session template used by the session.
335  //
336  // Only resource names, including project ID and location, are valid.
337  //
338  // Example:
339  // * `https://www.googleapis.com/compute/v1/projects/[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]`
340  // * `projects/[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]`
341  //
342  // The template must be in the same project and Dataproc region as the
343  // session.
344  string session_template = 16 [
345    (google.api.field_behavior) = OPTIONAL,
346    (google.api.resource_reference) = {
347      type: "dataproc.googleapis.com/SessionTemplate"
348    }
349  ];
350}
351
352// Jupyter configuration for an interactive session.
353message JupyterConfig {
354  // Jupyter kernel types.
355  enum Kernel {
356    // The kernel is unknown.
357    KERNEL_UNSPECIFIED = 0;
358
359    // Python kernel.
360    PYTHON = 1;
361
362    // Scala kernel.
363    SCALA = 2;
364  }
365
366  // Optional. Kernel
367  Kernel kernel = 1 [(google.api.field_behavior) = OPTIONAL];
368
369  // Optional. Display name, shown in the Jupyter kernelspec card.
370  string display_name = 2 [(google.api.field_behavior) = OPTIONAL];
371}
372