1#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct ExecutionEvent {
4 #[prost(uint64, tag = "1")]
5 pub seq: u64,
6 #[prost(string, tag = "2")]
7 pub exec_id: ::prost::alloc::string::String,
8 #[prost(oneof = "execution_event::Event", tags = "3, 4, 5, 6, 7")]
9 pub event: ::core::option::Option<execution_event::Event>,
10}
11pub mod execution_event {
13 #[derive(Clone, PartialEq, ::prost::Message)]
14 pub struct StreamOutput {
15 #[prost(enumeration = "StreamName", tag = "1")]
16 pub name: i32,
17 #[prost(string, tag = "2")]
18 pub text: ::prost::alloc::string::String,
19 }
20 #[derive(Clone, PartialEq, ::prost::Message)]
21 pub struct MimeBundle {
22 #[prost(map = "string, bytes", tag = "1")]
23 pub payloads: ::std::collections::HashMap<
24 ::prost::alloc::string::String,
25 ::prost::alloc::vec::Vec<u8>,
26 >,
27 }
28 #[derive(Clone, PartialEq, ::prost::Message)]
29 pub struct ExecutionResult {
30 #[prost(message, optional, tag = "1")]
31 pub mime_bundle: ::core::option::Option<MimeBundle>,
32 }
33 #[derive(Clone, PartialEq, ::prost::Message)]
34 pub struct DisplayData {
35 #[prost(message, optional, tag = "1")]
36 pub mime_bundle: ::core::option::Option<MimeBundle>,
37 }
38 #[derive(Clone, PartialEq, ::prost::Message)]
39 pub struct ExecutionError {
40 #[prost(string, tag = "1")]
41 pub ename: ::prost::alloc::string::String,
42 #[prost(string, tag = "2")]
43 pub evalue: ::prost::alloc::string::String,
44 #[prost(string, repeated, tag = "3")]
45 pub traceback: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
46 #[prost(enumeration = "execution_error::Source", tag = "4")]
47 pub source: i32,
48 }
49 pub mod execution_error {
51 #[derive(
52 Clone,
53 Copy,
54 Debug,
55 PartialEq,
56 Eq,
57 Hash,
58 PartialOrd,
59 Ord,
60 ::prost::Enumeration
61 )]
62 #[repr(i32)]
63 pub enum Source {
64 Unspecified = 0,
65 Interpreter = 1,
66 KernelDied = 2,
67 OutputDropped = 3,
68 SupervisionFailed = 4,
69 }
70 impl Source {
71 pub fn as_str_name(&self) -> &'static str {
76 match self {
77 Self::Unspecified => "SOURCE_UNSPECIFIED",
78 Self::Interpreter => "SOURCE_INTERPRETER",
79 Self::KernelDied => "SOURCE_KERNEL_DIED",
80 Self::OutputDropped => "SOURCE_OUTPUT_DROPPED",
81 Self::SupervisionFailed => "SOURCE_SUPERVISION_FAILED",
82 }
83 }
84 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
86 match value {
87 "SOURCE_UNSPECIFIED" => Some(Self::Unspecified),
88 "SOURCE_INTERPRETER" => Some(Self::Interpreter),
89 "SOURCE_KERNEL_DIED" => Some(Self::KernelDied),
90 "SOURCE_OUTPUT_DROPPED" => Some(Self::OutputDropped),
91 "SOURCE_SUPERVISION_FAILED" => Some(Self::SupervisionFailed),
92 _ => None,
93 }
94 }
95 }
96 }
97 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
98 pub struct ExecutionComplete {
99 #[prost(enumeration = "Status", tag = "1")]
100 pub status: i32,
101 #[prost(double, tag = "2")]
102 pub duration_s: f64,
103 }
104 #[derive(
105 Clone,
106 Copy,
107 Debug,
108 PartialEq,
109 Eq,
110 Hash,
111 PartialOrd,
112 Ord,
113 ::prost::Enumeration
114 )]
115 #[repr(i32)]
116 pub enum StreamName {
117 Unspecified = 0,
118 Stdout = 1,
119 Stderr = 2,
120 }
121 impl StreamName {
122 pub fn as_str_name(&self) -> &'static str {
127 match self {
128 Self::Unspecified => "STREAM_NAME_UNSPECIFIED",
129 Self::Stdout => "STREAM_NAME_STDOUT",
130 Self::Stderr => "STREAM_NAME_STDERR",
131 }
132 }
133 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
135 match value {
136 "STREAM_NAME_UNSPECIFIED" => Some(Self::Unspecified),
137 "STREAM_NAME_STDOUT" => Some(Self::Stdout),
138 "STREAM_NAME_STDERR" => Some(Self::Stderr),
139 _ => None,
140 }
141 }
142 }
143 #[derive(
144 Clone,
145 Copy,
146 Debug,
147 PartialEq,
148 Eq,
149 Hash,
150 PartialOrd,
151 Ord,
152 ::prost::Enumeration
153 )]
154 #[repr(i32)]
155 pub enum Status {
156 Unspecified = 0,
157 Ok = 1,
158 Error = 2,
159 Interrupted = 3,
160 }
161 impl Status {
162 pub fn as_str_name(&self) -> &'static str {
167 match self {
168 Self::Unspecified => "STATUS_UNSPECIFIED",
169 Self::Ok => "STATUS_OK",
170 Self::Error => "STATUS_ERROR",
171 Self::Interrupted => "STATUS_INTERRUPTED",
172 }
173 }
174 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
176 match value {
177 "STATUS_UNSPECIFIED" => Some(Self::Unspecified),
178 "STATUS_OK" => Some(Self::Ok),
179 "STATUS_ERROR" => Some(Self::Error),
180 "STATUS_INTERRUPTED" => Some(Self::Interrupted),
181 _ => None,
182 }
183 }
184 }
185 #[derive(Clone, PartialEq, ::prost::Oneof)]
186 pub enum Event {
187 #[prost(message, tag = "3")]
188 StreamOutput(StreamOutput),
189 #[prost(message, tag = "4")]
190 Result(ExecutionResult),
191 #[prost(message, tag = "5")]
192 DisplayData(DisplayData),
193 #[prost(message, tag = "6")]
194 Error(ExecutionError),
195 #[prost(message, tag = "7")]
196 Complete(ExecutionComplete),
197 }
198}
199#[derive(Clone, PartialEq, ::prost::Message)]
200pub struct Sandbox {
201 #[prost(string, tag = "1")]
202 pub sandbox_rid: ::prost::alloc::string::String,
203 #[prost(enumeration = "SandboxProfile", tag = "2")]
204 pub profile: i32,
205 #[prost(enumeration = "SandboxStatus", tag = "3")]
206 pub status: i32,
207 #[prost(message, optional, tag = "4")]
208 pub created_at: ::core::option::Option<
209 super::super::super::google::protobuf::Timestamp,
210 >,
211 #[prost(message, optional, tag = "5")]
212 pub last_activity_at: ::core::option::Option<
213 super::super::super::google::protobuf::Timestamp,
214 >,
215 #[prost(uint32, tag = "6")]
216 pub idle_timeout_seconds: u32,
217}
218#[derive(Clone, Copy, PartialEq, ::prost::Message)]
219pub struct CreateSandboxRequest {
220 #[prost(enumeration = "SandboxProfile", tag = "1")]
221 pub profile: i32,
222}
223#[derive(Clone, PartialEq, ::prost::Message)]
224pub struct CreateSandboxResponse {
225 #[prost(message, optional, tag = "1")]
226 pub sandbox: ::core::option::Option<Sandbox>,
227}
228#[derive(Clone, PartialEq, ::prost::Message)]
229pub struct GetSandboxRequest {
230 #[prost(string, tag = "1")]
231 pub sandbox_rid: ::prost::alloc::string::String,
232}
233#[derive(Clone, PartialEq, ::prost::Message)]
234pub struct GetSandboxResponse {
235 #[prost(message, optional, tag = "1")]
236 pub sandbox: ::core::option::Option<Sandbox>,
237}
238#[derive(Clone, PartialEq, ::prost::Message)]
239pub struct DeleteSandboxRequest {
240 #[prost(string, tag = "1")]
241 pub sandbox_rid: ::prost::alloc::string::String,
242}
243#[derive(Clone, PartialEq, ::prost::Message)]
244pub struct DeleteSandboxResponse {
245 #[prost(message, optional, tag = "1")]
246 pub sandbox: ::core::option::Option<Sandbox>,
247}
248#[derive(Clone, PartialEq, ::prost::Message)]
249pub struct ExecuteCodeRequest {
250 #[prost(string, tag = "1")]
251 pub sandbox_rid: ::prost::alloc::string::String,
252 #[prost(string, tag = "2")]
253 pub code: ::prost::alloc::string::String,
254 #[prost(string, tag = "3")]
255 pub exec_id: ::prost::alloc::string::String,
256}
257#[derive(Clone, PartialEq, ::prost::Message)]
258pub struct ExecuteCodeResponse {
259 #[prost(message, optional, tag = "1")]
260 pub event: ::core::option::Option<ExecutionEvent>,
261}
262#[derive(Clone, PartialEq, ::prost::Message)]
263pub struct InterruptExecutionRequest {
264 #[prost(string, tag = "1")]
265 pub sandbox_rid: ::prost::alloc::string::String,
266}
267#[derive(Clone, Copy, PartialEq, ::prost::Message)]
268pub struct InterruptExecutionResponse {}
269#[derive(Clone, PartialEq, ::prost::Message)]
270pub struct RestartInterpreterRequest {
271 #[prost(string, tag = "1")]
272 pub sandbox_rid: ::prost::alloc::string::String,
273}
274#[derive(Clone, Copy, PartialEq, ::prost::Message)]
275pub struct RestartInterpreterResponse {}
276#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
277#[repr(i32)]
278pub enum SandboxProfile {
279 Unspecified = 0,
280 Notebook = 1,
281 AgentRun = 2,
282}
283impl SandboxProfile {
284 pub fn as_str_name(&self) -> &'static str {
289 match self {
290 Self::Unspecified => "SANDBOX_PROFILE_UNSPECIFIED",
291 Self::Notebook => "SANDBOX_PROFILE_NOTEBOOK",
292 Self::AgentRun => "SANDBOX_PROFILE_AGENT_RUN",
293 }
294 }
295 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
297 match value {
298 "SANDBOX_PROFILE_UNSPECIFIED" => Some(Self::Unspecified),
299 "SANDBOX_PROFILE_NOTEBOOK" => Some(Self::Notebook),
300 "SANDBOX_PROFILE_AGENT_RUN" => Some(Self::AgentRun),
301 _ => None,
302 }
303 }
304}
305#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
306#[repr(i32)]
307pub enum SandboxStatus {
308 Unspecified = 0,
309 Creating = 1,
310 Ready = 2,
311 Terminating = 3,
312 Terminated = 4,
313 Failed = 5,
314}
315impl SandboxStatus {
316 pub fn as_str_name(&self) -> &'static str {
321 match self {
322 Self::Unspecified => "SANDBOX_STATUS_UNSPECIFIED",
323 Self::Creating => "SANDBOX_STATUS_CREATING",
324 Self::Ready => "SANDBOX_STATUS_READY",
325 Self::Terminating => "SANDBOX_STATUS_TERMINATING",
326 Self::Terminated => "SANDBOX_STATUS_TERMINATED",
327 Self::Failed => "SANDBOX_STATUS_FAILED",
328 }
329 }
330 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
332 match value {
333 "SANDBOX_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
334 "SANDBOX_STATUS_CREATING" => Some(Self::Creating),
335 "SANDBOX_STATUS_READY" => Some(Self::Ready),
336 "SANDBOX_STATUS_TERMINATING" => Some(Self::Terminating),
337 "SANDBOX_STATUS_TERMINATED" => Some(Self::Terminated),
338 "SANDBOX_STATUS_FAILED" => Some(Self::Failed),
339 _ => None,
340 }
341 }
342}
343pub mod code_sandbox_service_client {
345 #![allow(
346 unused_variables,
347 dead_code,
348 missing_docs,
349 clippy::wildcard_imports,
350 clippy::let_unit_value,
351 )]
352 use tonic::codegen::*;
353 use tonic::codegen::http::Uri;
354 #[derive(Debug, Clone)]
355 pub struct CodeSandboxServiceClient<T> {
356 inner: tonic::client::Grpc<T>,
357 }
358 impl CodeSandboxServiceClient<tonic::transport::Channel> {
359 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
361 where
362 D: TryInto<tonic::transport::Endpoint>,
363 D::Error: Into<StdError>,
364 {
365 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
366 Ok(Self::new(conn))
367 }
368 }
369 impl<T> CodeSandboxServiceClient<T>
370 where
371 T: tonic::client::GrpcService<tonic::body::Body>,
372 T::Error: Into<StdError>,
373 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
374 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
375 {
376 pub fn new(inner: T) -> Self {
377 let inner = tonic::client::Grpc::new(inner);
378 Self { inner }
379 }
380 pub fn with_origin(inner: T, origin: Uri) -> Self {
381 let inner = tonic::client::Grpc::with_origin(inner, origin);
382 Self { inner }
383 }
384 pub fn with_interceptor<F>(
385 inner: T,
386 interceptor: F,
387 ) -> CodeSandboxServiceClient<InterceptedService<T, F>>
388 where
389 F: tonic::service::Interceptor,
390 T::ResponseBody: Default,
391 T: tonic::codegen::Service<
392 http::Request<tonic::body::Body>,
393 Response = http::Response<
394 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
395 >,
396 >,
397 <T as tonic::codegen::Service<
398 http::Request<tonic::body::Body>,
399 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
400 {
401 CodeSandboxServiceClient::new(InterceptedService::new(inner, interceptor))
402 }
403 #[must_use]
408 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
409 self.inner = self.inner.send_compressed(encoding);
410 self
411 }
412 #[must_use]
414 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
415 self.inner = self.inner.accept_compressed(encoding);
416 self
417 }
418 #[must_use]
422 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
423 self.inner = self.inner.max_decoding_message_size(limit);
424 self
425 }
426 #[must_use]
430 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
431 self.inner = self.inner.max_encoding_message_size(limit);
432 self
433 }
434 pub async fn create_sandbox(
435 &mut self,
436 request: impl tonic::IntoRequest<super::CreateSandboxRequest>,
437 ) -> std::result::Result<
438 tonic::Response<super::CreateSandboxResponse>,
439 tonic::Status,
440 > {
441 self.inner
442 .ready()
443 .await
444 .map_err(|e| {
445 tonic::Status::unknown(
446 format!("Service was not ready: {}", e.into()),
447 )
448 })?;
449 let codec = tonic::codec::ProstCodec::default();
450 let path = http::uri::PathAndQuery::from_static(
451 "/nominal.codesandbox.v1.CodeSandboxService/CreateSandbox",
452 );
453 let mut req = request.into_request();
454 req.extensions_mut()
455 .insert(
456 GrpcMethod::new(
457 "nominal.codesandbox.v1.CodeSandboxService",
458 "CreateSandbox",
459 ),
460 );
461 self.inner.unary(req, path, codec).await
462 }
463 pub async fn get_sandbox(
464 &mut self,
465 request: impl tonic::IntoRequest<super::GetSandboxRequest>,
466 ) -> std::result::Result<
467 tonic::Response<super::GetSandboxResponse>,
468 tonic::Status,
469 > {
470 self.inner
471 .ready()
472 .await
473 .map_err(|e| {
474 tonic::Status::unknown(
475 format!("Service was not ready: {}", e.into()),
476 )
477 })?;
478 let codec = tonic::codec::ProstCodec::default();
479 let path = http::uri::PathAndQuery::from_static(
480 "/nominal.codesandbox.v1.CodeSandboxService/GetSandbox",
481 );
482 let mut req = request.into_request();
483 req.extensions_mut()
484 .insert(
485 GrpcMethod::new(
486 "nominal.codesandbox.v1.CodeSandboxService",
487 "GetSandbox",
488 ),
489 );
490 self.inner.unary(req, path, codec).await
491 }
492 pub async fn delete_sandbox(
493 &mut self,
494 request: impl tonic::IntoRequest<super::DeleteSandboxRequest>,
495 ) -> std::result::Result<
496 tonic::Response<super::DeleteSandboxResponse>,
497 tonic::Status,
498 > {
499 self.inner
500 .ready()
501 .await
502 .map_err(|e| {
503 tonic::Status::unknown(
504 format!("Service was not ready: {}", e.into()),
505 )
506 })?;
507 let codec = tonic::codec::ProstCodec::default();
508 let path = http::uri::PathAndQuery::from_static(
509 "/nominal.codesandbox.v1.CodeSandboxService/DeleteSandbox",
510 );
511 let mut req = request.into_request();
512 req.extensions_mut()
513 .insert(
514 GrpcMethod::new(
515 "nominal.codesandbox.v1.CodeSandboxService",
516 "DeleteSandbox",
517 ),
518 );
519 self.inner.unary(req, path, codec).await
520 }
521 pub async fn execute_code(
522 &mut self,
523 request: impl tonic::IntoRequest<super::ExecuteCodeRequest>,
524 ) -> std::result::Result<
525 tonic::Response<tonic::codec::Streaming<super::ExecuteCodeResponse>>,
526 tonic::Status,
527 > {
528 self.inner
529 .ready()
530 .await
531 .map_err(|e| {
532 tonic::Status::unknown(
533 format!("Service was not ready: {}", e.into()),
534 )
535 })?;
536 let codec = tonic::codec::ProstCodec::default();
537 let path = http::uri::PathAndQuery::from_static(
538 "/nominal.codesandbox.v1.CodeSandboxService/ExecuteCode",
539 );
540 let mut req = request.into_request();
541 req.extensions_mut()
542 .insert(
543 GrpcMethod::new(
544 "nominal.codesandbox.v1.CodeSandboxService",
545 "ExecuteCode",
546 ),
547 );
548 self.inner.server_streaming(req, path, codec).await
549 }
550 pub async fn interrupt_execution(
551 &mut self,
552 request: impl tonic::IntoRequest<super::InterruptExecutionRequest>,
553 ) -> std::result::Result<
554 tonic::Response<super::InterruptExecutionResponse>,
555 tonic::Status,
556 > {
557 self.inner
558 .ready()
559 .await
560 .map_err(|e| {
561 tonic::Status::unknown(
562 format!("Service was not ready: {}", e.into()),
563 )
564 })?;
565 let codec = tonic::codec::ProstCodec::default();
566 let path = http::uri::PathAndQuery::from_static(
567 "/nominal.codesandbox.v1.CodeSandboxService/InterruptExecution",
568 );
569 let mut req = request.into_request();
570 req.extensions_mut()
571 .insert(
572 GrpcMethod::new(
573 "nominal.codesandbox.v1.CodeSandboxService",
574 "InterruptExecution",
575 ),
576 );
577 self.inner.unary(req, path, codec).await
578 }
579 pub async fn restart_interpreter(
580 &mut self,
581 request: impl tonic::IntoRequest<super::RestartInterpreterRequest>,
582 ) -> std::result::Result<
583 tonic::Response<super::RestartInterpreterResponse>,
584 tonic::Status,
585 > {
586 self.inner
587 .ready()
588 .await
589 .map_err(|e| {
590 tonic::Status::unknown(
591 format!("Service was not ready: {}", e.into()),
592 )
593 })?;
594 let codec = tonic::codec::ProstCodec::default();
595 let path = http::uri::PathAndQuery::from_static(
596 "/nominal.codesandbox.v1.CodeSandboxService/RestartInterpreter",
597 );
598 let mut req = request.into_request();
599 req.extensions_mut()
600 .insert(
601 GrpcMethod::new(
602 "nominal.codesandbox.v1.CodeSandboxService",
603 "RestartInterpreter",
604 ),
605 );
606 self.inner.unary(req, path, codec).await
607 }
608 }
609}