1#[allow(clippy::all)]
3#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4pub struct Session {
5 #[prost(string, tag = "1")]
7 pub name: ::prost::alloc::string::String,
8 #[prost(string, tag = "2")]
9 pub display_name: ::prost::alloc::string::String,
10 #[prost(string, tag = "3")]
12 pub short_id: ::prost::alloc::string::String,
13 #[prost(string, tag = "4")]
15 pub owner: ::prost::alloc::string::String,
16 #[prost(message, optional, tag = "5")]
18 pub create_time: ::core::option::Option<::prost_types::Timestamp>,
19 #[prost(enumeration = "Phase", tag = "11")]
21 pub phase: i32,
22 #[prost(message, optional, tag = "13")]
24 pub park_after: ::core::option::Option<::prost_types::Timestamp>,
25 #[prost(message, optional, tag = "14")]
27 pub expire_time: ::core::option::Option<::prost_types::Timestamp>,
28 #[prost(string, tag = "18")]
30 pub message: ::prost::alloc::string::String,
31 #[prost(message, optional, tag = "23")]
33 pub guest_started_time: ::core::option::Option<::prost_types::Timestamp>,
34 #[prost(bool, tag = "24")]
36 pub workspace_pending: bool,
37 #[prost(message, optional, tag = "34")]
39 pub held_until: ::core::option::Option<::prost_types::Timestamp>,
40 #[prost(enumeration = "IdlePolicy", tag = "35")]
41 pub idle: i32,
42 #[prost(string, tag = "43")]
44 pub region: ::prost::alloc::string::String,
45 #[prost(message, optional, tag = "44")]
47 pub max_resource_class: ::core::option::Option<SessionResourceLimit>,
48 #[prost(enumeration = "session::ParkRequest", tag = "53")]
49 pub park_request: i32,
50 #[prost(oneof = "session::Environment", tags = "7, 33")]
52 pub environment: ::core::option::Option<session::Environment>,
53}
54pub mod session {
56 #[allow(clippy::all)]
57 #[derive(
58 Clone,
59 Copy,
60 Debug,
61 PartialEq,
62 Eq,
63 Hash,
64 PartialOrd,
65 Ord,
66 ::prost::Enumeration
67 )]
68 #[repr(i32)]
69 pub enum ParkRequest {
70 Unspecified = 0,
71 Park = 1,
73 Restart = 2,
74 }
75 impl ParkRequest {
76 pub fn as_str_name(&self) -> &'static str {
81 match self {
82 Self::Unspecified => "PARK_REQUEST_UNSPECIFIED",
83 Self::Park => "PARK_REQUEST_PARK",
84 Self::Restart => "PARK_REQUEST_RESTART",
85 }
86 }
87 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
89 match value {
90 "PARK_REQUEST_UNSPECIFIED" => Some(Self::Unspecified),
91 "PARK_REQUEST_PARK" => Some(Self::Park),
92 "PARK_REQUEST_RESTART" => Some(Self::Restart),
93 _ => None,
94 }
95 }
96 }
97 #[allow(clippy::all)]
99 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
100 pub enum Environment {
101 #[prost(message, tag = "7")]
103 Source(super::Source),
104 #[prost(message, tag = "33")]
106 Workspace(super::Workspace),
107 }
108}
109#[allow(clippy::all)]
110#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
111pub struct SessionResourceLimit {
112 #[prost(int32, tag = "1")]
113 pub cpus: i32,
114 #[prost(int64, tag = "2")]
115 pub memory_mib: i64,
116 #[prost(int64, optional, tag = "3")]
117 pub disk_mib: ::core::option::Option<i64>,
118}
119#[allow(clippy::all)]
121#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
122pub struct Workspace {
123 #[prost(string, tag = "1")]
125 pub label: ::prost::alloc::string::String,
126 #[prost(string, tag = "2")]
127 pub repository: ::prost::alloc::string::String,
128 #[prost(string, tag = "3")]
129 pub revision: ::prost::alloc::string::String,
130 #[prost(bytes = "vec", tag = "4")]
132 pub document: ::prost::alloc::vec::Vec<u8>,
133 #[prost(enumeration = "Provenance", tag = "5")]
135 pub provenance: i32,
136}
137#[allow(clippy::all)]
139#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
140pub struct Source {
141 #[prost(string, tag = "1")]
143 pub repository: ::prost::alloc::string::String,
144 #[prost(string, tag = "2")]
145 pub revision: ::prost::alloc::string::String,
146 #[prost(bytes = "vec", tag = "3")]
148 pub fallback_document: ::prost::alloc::vec::Vec<u8>,
149 #[prost(bool, tag = "4")]
151 pub fallback_used: bool,
152}
153#[allow(clippy::all)]
154#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
155pub struct CreateSessionRequest {
156 #[prost(string, tag = "1")]
158 pub parent: ::prost::alloc::string::String,
159 #[prost(message, optional, tag = "2")]
161 pub session: ::core::option::Option<Session>,
162}
163#[allow(clippy::all)]
164#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
165pub struct GetSessionRequest {
166 #[prost(string, tag = "1")]
168 pub name: ::prost::alloc::string::String,
169}
170#[allow(clippy::all)]
171#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
172pub struct ListSessionsRequest {
173 #[prost(string, tag = "1")]
175 pub parent: ::prost::alloc::string::String,
176 #[prost(int32, tag = "2")]
177 pub page_size: i32,
178 #[prost(string, tag = "3")]
179 pub page_token: ::prost::alloc::string::String,
180 #[prost(string, tag = "4")]
182 pub owner: ::prost::alloc::string::String,
183}
184#[allow(clippy::all)]
185#[derive(Clone, PartialEq, ::prost::Message)]
186pub struct ListSessionsResponse {
187 #[prost(message, repeated, tag = "1")]
188 pub sessions: ::prost::alloc::vec::Vec<Session>,
189 #[prost(string, tag = "2")]
190 pub next_page_token: ::prost::alloc::string::String,
191}
192#[allow(clippy::all)]
193#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
194pub struct UpdateSessionRequest {
195 #[prost(message, optional, tag = "1")]
197 pub session: ::core::option::Option<Session>,
198 #[prost(message, optional, tag = "2")]
200 pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
201}
202#[allow(clippy::all)]
203#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
204pub struct DeleteSessionRequest {
205 #[prost(string, tag = "1")]
207 pub name: ::prost::alloc::string::String,
208}
209#[allow(clippy::all)]
210#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
211pub struct HeartbeatSessionRequest {
212 #[prost(string, tag = "1")]
214 pub name: ::prost::alloc::string::String,
215 #[prost(message, optional, tag = "2")]
216 pub hold_for: ::core::option::Option<::prost_types::Duration>,
217}
218#[allow(clippy::all)]
219#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
220pub struct ExecRequest {
221 #[prost(string, tag = "1")]
223 pub name: ::prost::alloc::string::String,
224 #[prost(string, repeated, tag = "2")]
226 pub argv: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
227 #[prost(bytes = "vec", tag = "3")]
229 pub stdin: ::prost::alloc::vec::Vec<u8>,
230 #[prost(message, optional, tag = "4")]
231 pub deadline: ::core::option::Option<::prost_types::Duration>,
232}
233#[allow(clippy::all)]
234#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
235pub struct ExecResponse {
236 #[prost(oneof = "exec_response::Event", tags = "1, 2, 3")]
237 pub event: ::core::option::Option<exec_response::Event>,
238}
239pub mod exec_response {
241 #[allow(clippy::all)]
242 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
243 pub struct Exited {
244 #[prost(int32, tag = "1")]
245 pub code: i32,
246 #[prost(bool, tag = "3")]
247 pub timed_out: bool,
248 }
249 #[allow(clippy::all)]
250 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
251 pub enum Event {
252 #[prost(bytes, tag = "1")]
253 Stdout(::prost::alloc::vec::Vec<u8>),
254 #[prost(bytes, tag = "2")]
255 Stderr(::prost::alloc::vec::Vec<u8>),
256 #[prost(message, tag = "3")]
258 Exited(Exited),
259 }
260}
261#[allow(clippy::all)]
262#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
263pub struct AttachRequest {
264 #[prost(oneof = "attach_request::Input", tags = "1, 4")]
265 pub input: ::core::option::Option<attach_request::Input>,
266}
267pub mod attach_request {
269 #[allow(clippy::all)]
270 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
271 pub struct Open {
272 #[prost(string, tag = "1")]
274 pub name: ::prost::alloc::string::String,
275 #[prost(message, optional, tag = "4")]
277 pub resume: ::core::option::Option<Resume>,
278 }
279 #[allow(clippy::all)]
280 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
281 pub struct Resume {
282 #[prost(uint64, tag = "1")]
283 pub incarnation: u64,
284 #[prost(int64, tag = "2")]
285 pub offset: i64,
286 #[prost(uint32, tag = "3")]
287 pub pty_id: u32,
288 }
289 #[allow(clippy::all)]
290 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
291 pub struct WorkspaceChunk {
292 #[prost(bytes = "vec", tag = "1")]
293 pub data: ::prost::alloc::vec::Vec<u8>,
294 #[prost(bool, tag = "2")]
295 pub last: bool,
296 #[prost(enumeration = "workspace_chunk::Format", tag = "3")]
297 pub format: i32,
298 #[prost(enumeration = "workspace_chunk::Encoding", tag = "4")]
299 pub encoding: i32,
300 }
301 pub mod workspace_chunk {
303 #[allow(clippy::all)]
304 #[derive(
305 Clone,
306 Copy,
307 Debug,
308 PartialEq,
309 Eq,
310 Hash,
311 PartialOrd,
312 Ord,
313 ::prost::Enumeration
314 )]
315 #[repr(i32)]
316 pub enum Format {
317 Unspecified = 0,
318 FullTar = 1,
319 DeltaTar = 2,
320 }
321 impl Format {
322 pub fn as_str_name(&self) -> &'static str {
327 match self {
328 Self::Unspecified => "FORMAT_UNSPECIFIED",
329 Self::FullTar => "FULL_TAR",
330 Self::DeltaTar => "DELTA_TAR",
331 }
332 }
333 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
335 match value {
336 "FORMAT_UNSPECIFIED" => Some(Self::Unspecified),
337 "FULL_TAR" => Some(Self::FullTar),
338 "DELTA_TAR" => Some(Self::DeltaTar),
339 _ => None,
340 }
341 }
342 }
343 #[allow(clippy::all)]
344 #[derive(
345 Clone,
346 Copy,
347 Debug,
348 PartialEq,
349 Eq,
350 Hash,
351 PartialOrd,
352 Ord,
353 ::prost::Enumeration
354 )]
355 #[repr(i32)]
356 pub enum Encoding {
357 Unspecified = 0,
358 Gzip = 1,
359 }
360 impl Encoding {
361 pub fn as_str_name(&self) -> &'static str {
366 match self {
367 Self::Unspecified => "ENCODING_UNSPECIFIED",
368 Self::Gzip => "GZIP",
369 }
370 }
371 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
373 match value {
374 "ENCODING_UNSPECIFIED" => Some(Self::Unspecified),
375 "GZIP" => Some(Self::Gzip),
376 _ => None,
377 }
378 }
379 }
380 }
381 #[allow(clippy::all)]
382 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
383 pub enum Input {
384 #[prost(message, tag = "1")]
386 Open(Open),
387 #[prost(message, tag = "4")]
388 WorkspaceChunk(WorkspaceChunk),
389 }
390}
391#[allow(clippy::all)]
392#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
393pub struct AttachResponse {
394 #[prost(oneof = "attach_response::Output", tags = "4, 5, 6")]
395 pub output: ::core::option::Option<attach_response::Output>,
396}
397pub mod attach_response {
399 #[allow(clippy::all)]
400 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
401 pub struct Opened {
402 #[prost(int32, tag = "1")]
403 pub rows: i32,
404 #[prost(int32, tag = "2")]
405 pub cols: i32,
406 #[prost(string, tag = "3")]
407 pub session_name: ::prost::alloc::string::String,
408 #[prost(bool, tag = "4")]
410 pub workspace_pending: bool,
411 #[prost(
412 enumeration = "super::attach_request::workspace_chunk::Encoding",
413 repeated,
414 tag = "6"
415 )]
416 pub workspace_encodings: ::prost::alloc::vec::Vec<i32>,
417 }
418 #[allow(clippy::all)]
419 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
420 pub struct WorkspaceReady {
421 #[prost(int64, tag = "1")]
422 pub bytes: i64,
423 #[prost(message, optional, tag = "2")]
424 pub elapsed: ::core::option::Option<::prost_types::Duration>,
425 }
426 #[allow(clippy::all)]
427 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
428 pub struct Detached {}
429 #[allow(clippy::all)]
430 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
431 pub enum Output {
432 #[prost(message, tag = "4")]
434 Detached(Detached),
435 #[prost(message, tag = "5")]
436 Opened(Opened),
437 #[prost(message, tag = "6")]
438 WorkspaceReady(WorkspaceReady),
439 }
440}
441#[allow(clippy::all)]
442#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
443#[repr(i32)]
444pub enum Phase {
445 Unspecified = 0,
446 Creating = 1,
447 Attached = 2,
448 Idle = 3,
449 Parked = 4,
450 Reaped = 5,
451}
452impl Phase {
453 pub fn as_str_name(&self) -> &'static str {
458 match self {
459 Self::Unspecified => "PHASE_UNSPECIFIED",
460 Self::Creating => "CREATING",
461 Self::Attached => "ATTACHED",
462 Self::Idle => "IDLE",
463 Self::Parked => "PARKED",
464 Self::Reaped => "REAPED",
465 }
466 }
467 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
469 match value {
470 "PHASE_UNSPECIFIED" => Some(Self::Unspecified),
471 "CREATING" => Some(Self::Creating),
472 "ATTACHED" => Some(Self::Attached),
473 "IDLE" => Some(Self::Idle),
474 "PARKED" => Some(Self::Parked),
475 "REAPED" => Some(Self::Reaped),
476 _ => None,
477 }
478 }
479}
480#[allow(clippy::all)]
481#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
482#[repr(i32)]
483pub enum IdlePolicy {
484 Unspecified = 0,
485 ParkWhenIdle = 1,
486 KeepRunning = 2,
487 AutoHold = 3,
488}
489impl IdlePolicy {
490 pub fn as_str_name(&self) -> &'static str {
495 match self {
496 Self::Unspecified => "IDLE_POLICY_UNSPECIFIED",
497 Self::ParkWhenIdle => "PARK_WHEN_IDLE",
498 Self::KeepRunning => "KEEP_RUNNING",
499 Self::AutoHold => "AUTO_HOLD",
500 }
501 }
502 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
504 match value {
505 "IDLE_POLICY_UNSPECIFIED" => Some(Self::Unspecified),
506 "PARK_WHEN_IDLE" => Some(Self::ParkWhenIdle),
507 "KEEP_RUNNING" => Some(Self::KeepRunning),
508 "AUTO_HOLD" => Some(Self::AutoHold),
509 _ => None,
510 }
511 }
512}
513#[allow(clippy::all)]
514#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
515#[repr(i32)]
516pub enum Provenance {
517 Unspecified = 0,
518 Authored = 1,
519 Migrated = 2,
520 Synthesized = 3,
521}
522impl Provenance {
523 pub fn as_str_name(&self) -> &'static str {
528 match self {
529 Self::Unspecified => "PROVENANCE_UNSPECIFIED",
530 Self::Authored => "AUTHORED",
531 Self::Migrated => "MIGRATED",
532 Self::Synthesized => "SYNTHESIZED",
533 }
534 }
535 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
537 match value {
538 "PROVENANCE_UNSPECIFIED" => Some(Self::Unspecified),
539 "AUTHORED" => Some(Self::Authored),
540 "MIGRATED" => Some(Self::Migrated),
541 "SYNTHESIZED" => Some(Self::Synthesized),
542 _ => None,
543 }
544 }
545}
546pub mod sessions_client {
548 #![allow(
549 unused_variables,
550 dead_code,
551 missing_docs,
552 clippy::wildcard_imports,
553 clippy::let_unit_value,
554 )]
555 use tonic::codegen::*;
556 use tonic::codegen::http::Uri;
557 #[derive(Debug, Clone)]
558 pub struct SessionsClient<T> {
559 inner: tonic::client::Grpc<T>,
560 }
561 impl SessionsClient<tonic::transport::Channel> {
562 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
564 where
565 D: TryInto<tonic::transport::Endpoint>,
566 D::Error: Into<StdError>,
567 {
568 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
569 Ok(Self::new(conn))
570 }
571 }
572 impl<T> SessionsClient<T>
573 where
574 T: tonic::client::GrpcService<tonic::body::Body>,
575 T::Error: Into<StdError>,
576 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
577 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
578 {
579 pub fn new(inner: T) -> Self {
580 let inner = tonic::client::Grpc::new(inner);
581 Self { inner }
582 }
583 pub fn with_origin(inner: T, origin: Uri) -> Self {
584 let inner = tonic::client::Grpc::with_origin(inner, origin);
585 Self { inner }
586 }
587 pub fn with_interceptor<F>(
588 inner: T,
589 interceptor: F,
590 ) -> SessionsClient<InterceptedService<T, F>>
591 where
592 F: tonic::service::Interceptor,
593 T::ResponseBody: Default,
594 T: tonic::codegen::Service<
595 http::Request<tonic::body::Body>,
596 Response = http::Response<
597 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
598 >,
599 >,
600 <T as tonic::codegen::Service<
601 http::Request<tonic::body::Body>,
602 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
603 {
604 SessionsClient::new(InterceptedService::new(inner, interceptor))
605 }
606 #[must_use]
611 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
612 self.inner = self.inner.send_compressed(encoding);
613 self
614 }
615 #[must_use]
617 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
618 self.inner = self.inner.accept_compressed(encoding);
619 self
620 }
621 #[must_use]
625 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
626 self.inner = self.inner.max_decoding_message_size(limit);
627 self
628 }
629 #[must_use]
633 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
634 self.inner = self.inner.max_encoding_message_size(limit);
635 self
636 }
637 pub async fn create_session(
638 &mut self,
639 request: impl tonic::IntoRequest<super::CreateSessionRequest>,
640 ) -> std::result::Result<tonic::Response<super::Session>, tonic::Status> {
641 self.inner
642 .ready()
643 .await
644 .map_err(|e| {
645 tonic::Status::unknown(
646 format!("Service was not ready: {}", e.into()),
647 )
648 })?;
649 let codec = tonic_prost::ProstCodec::default();
650 let path = http::uri::PathAndQuery::from_static(
651 "/chainguard.sandbox.runtime.session.v1.Sessions/CreateSession",
652 );
653 let mut req = request.into_request();
654 req.extensions_mut()
655 .insert(
656 GrpcMethod::new(
657 "chainguard.sandbox.runtime.session.v1.Sessions",
658 "CreateSession",
659 ),
660 );
661 self.inner.unary(req, path, codec).await
662 }
663 pub async fn get_session(
664 &mut self,
665 request: impl tonic::IntoRequest<super::GetSessionRequest>,
666 ) -> std::result::Result<tonic::Response<super::Session>, tonic::Status> {
667 self.inner
668 .ready()
669 .await
670 .map_err(|e| {
671 tonic::Status::unknown(
672 format!("Service was not ready: {}", e.into()),
673 )
674 })?;
675 let codec = tonic_prost::ProstCodec::default();
676 let path = http::uri::PathAndQuery::from_static(
677 "/chainguard.sandbox.runtime.session.v1.Sessions/GetSession",
678 );
679 let mut req = request.into_request();
680 req.extensions_mut()
681 .insert(
682 GrpcMethod::new(
683 "chainguard.sandbox.runtime.session.v1.Sessions",
684 "GetSession",
685 ),
686 );
687 self.inner.unary(req, path, codec).await
688 }
689 pub async fn list_sessions(
690 &mut self,
691 request: impl tonic::IntoRequest<super::ListSessionsRequest>,
692 ) -> std::result::Result<
693 tonic::Response<super::ListSessionsResponse>,
694 tonic::Status,
695 > {
696 self.inner
697 .ready()
698 .await
699 .map_err(|e| {
700 tonic::Status::unknown(
701 format!("Service was not ready: {}", e.into()),
702 )
703 })?;
704 let codec = tonic_prost::ProstCodec::default();
705 let path = http::uri::PathAndQuery::from_static(
706 "/chainguard.sandbox.runtime.session.v1.Sessions/ListSessions",
707 );
708 let mut req = request.into_request();
709 req.extensions_mut()
710 .insert(
711 GrpcMethod::new(
712 "chainguard.sandbox.runtime.session.v1.Sessions",
713 "ListSessions",
714 ),
715 );
716 self.inner.unary(req, path, codec).await
717 }
718 pub async fn update_session(
719 &mut self,
720 request: impl tonic::IntoRequest<super::UpdateSessionRequest>,
721 ) -> std::result::Result<tonic::Response<super::Session>, tonic::Status> {
722 self.inner
723 .ready()
724 .await
725 .map_err(|e| {
726 tonic::Status::unknown(
727 format!("Service was not ready: {}", e.into()),
728 )
729 })?;
730 let codec = tonic_prost::ProstCodec::default();
731 let path = http::uri::PathAndQuery::from_static(
732 "/chainguard.sandbox.runtime.session.v1.Sessions/UpdateSession",
733 );
734 let mut req = request.into_request();
735 req.extensions_mut()
736 .insert(
737 GrpcMethod::new(
738 "chainguard.sandbox.runtime.session.v1.Sessions",
739 "UpdateSession",
740 ),
741 );
742 self.inner.unary(req, path, codec).await
743 }
744 pub async fn delete_session(
745 &mut self,
746 request: impl tonic::IntoRequest<super::DeleteSessionRequest>,
747 ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
748 self.inner
749 .ready()
750 .await
751 .map_err(|e| {
752 tonic::Status::unknown(
753 format!("Service was not ready: {}", e.into()),
754 )
755 })?;
756 let codec = tonic_prost::ProstCodec::default();
757 let path = http::uri::PathAndQuery::from_static(
758 "/chainguard.sandbox.runtime.session.v1.Sessions/DeleteSession",
759 );
760 let mut req = request.into_request();
761 req.extensions_mut()
762 .insert(
763 GrpcMethod::new(
764 "chainguard.sandbox.runtime.session.v1.Sessions",
765 "DeleteSession",
766 ),
767 );
768 self.inner.unary(req, path, codec).await
769 }
770 pub async fn heartbeat_session(
771 &mut self,
772 request: impl tonic::IntoRequest<super::HeartbeatSessionRequest>,
773 ) -> std::result::Result<tonic::Response<super::Session>, tonic::Status> {
774 self.inner
775 .ready()
776 .await
777 .map_err(|e| {
778 tonic::Status::unknown(
779 format!("Service was not ready: {}", e.into()),
780 )
781 })?;
782 let codec = tonic_prost::ProstCodec::default();
783 let path = http::uri::PathAndQuery::from_static(
784 "/chainguard.sandbox.runtime.session.v1.Sessions/HeartbeatSession",
785 );
786 let mut req = request.into_request();
787 req.extensions_mut()
788 .insert(
789 GrpcMethod::new(
790 "chainguard.sandbox.runtime.session.v1.Sessions",
791 "HeartbeatSession",
792 ),
793 );
794 self.inner.unary(req, path, codec).await
795 }
796 pub async fn attach_session(
797 &mut self,
798 request: impl tonic::IntoStreamingRequest<Message = super::AttachRequest>,
799 ) -> std::result::Result<
800 tonic::Response<tonic::codec::Streaming<super::AttachResponse>>,
801 tonic::Status,
802 > {
803 self.inner
804 .ready()
805 .await
806 .map_err(|e| {
807 tonic::Status::unknown(
808 format!("Service was not ready: {}", e.into()),
809 )
810 })?;
811 let codec = tonic_prost::ProstCodec::default();
812 let path = http::uri::PathAndQuery::from_static(
813 "/chainguard.sandbox.runtime.session.v1.Sessions/AttachSession",
814 );
815 let mut req = request.into_streaming_request();
816 req.extensions_mut()
817 .insert(
818 GrpcMethod::new(
819 "chainguard.sandbox.runtime.session.v1.Sessions",
820 "AttachSession",
821 ),
822 );
823 self.inner.streaming(req, path, codec).await
824 }
825 pub async fn exec(
826 &mut self,
827 request: impl tonic::IntoRequest<super::ExecRequest>,
828 ) -> std::result::Result<
829 tonic::Response<tonic::codec::Streaming<super::ExecResponse>>,
830 tonic::Status,
831 > {
832 self.inner
833 .ready()
834 .await
835 .map_err(|e| {
836 tonic::Status::unknown(
837 format!("Service was not ready: {}", e.into()),
838 )
839 })?;
840 let codec = tonic_prost::ProstCodec::default();
841 let path = http::uri::PathAndQuery::from_static(
842 "/chainguard.sandbox.runtime.session.v1.Sessions/Exec",
843 );
844 let mut req = request.into_request();
845 req.extensions_mut()
846 .insert(
847 GrpcMethod::new(
848 "chainguard.sandbox.runtime.session.v1.Sessions",
849 "Exec",
850 ),
851 );
852 self.inner.server_streaming(req, path, codec).await
853 }
854 }
855}
856pub mod sessions_server {
858 #![allow(
859 unused_variables,
860 dead_code,
861 missing_docs,
862 clippy::wildcard_imports,
863 clippy::let_unit_value,
864 )]
865 use tonic::codegen::*;
866 #[async_trait]
868 pub trait Sessions: std::marker::Send + std::marker::Sync + 'static {
869 async fn create_session(
870 &self,
871 request: tonic::Request<super::CreateSessionRequest>,
872 ) -> std::result::Result<tonic::Response<super::Session>, tonic::Status>;
873 async fn get_session(
874 &self,
875 request: tonic::Request<super::GetSessionRequest>,
876 ) -> std::result::Result<tonic::Response<super::Session>, tonic::Status>;
877 async fn list_sessions(
878 &self,
879 request: tonic::Request<super::ListSessionsRequest>,
880 ) -> std::result::Result<
881 tonic::Response<super::ListSessionsResponse>,
882 tonic::Status,
883 >;
884 async fn update_session(
885 &self,
886 request: tonic::Request<super::UpdateSessionRequest>,
887 ) -> std::result::Result<tonic::Response<super::Session>, tonic::Status>;
888 async fn delete_session(
889 &self,
890 request: tonic::Request<super::DeleteSessionRequest>,
891 ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
892 async fn heartbeat_session(
893 &self,
894 request: tonic::Request<super::HeartbeatSessionRequest>,
895 ) -> std::result::Result<tonic::Response<super::Session>, tonic::Status>;
896 type AttachSessionStream: tonic::codegen::tokio_stream::Stream<
898 Item = std::result::Result<super::AttachResponse, tonic::Status>,
899 >
900 + std::marker::Send
901 + 'static;
902 async fn attach_session(
903 &self,
904 request: tonic::Request<tonic::Streaming<super::AttachRequest>>,
905 ) -> std::result::Result<
906 tonic::Response<Self::AttachSessionStream>,
907 tonic::Status,
908 >;
909 type ExecStream: tonic::codegen::tokio_stream::Stream<
911 Item = std::result::Result<super::ExecResponse, tonic::Status>,
912 >
913 + std::marker::Send
914 + 'static;
915 async fn exec(
916 &self,
917 request: tonic::Request<super::ExecRequest>,
918 ) -> std::result::Result<tonic::Response<Self::ExecStream>, tonic::Status>;
919 }
920 #[derive(Debug)]
921 pub struct SessionsServer<T> {
922 inner: Arc<T>,
923 accept_compression_encodings: EnabledCompressionEncodings,
924 send_compression_encodings: EnabledCompressionEncodings,
925 max_decoding_message_size: Option<usize>,
926 max_encoding_message_size: Option<usize>,
927 }
928 impl<T> SessionsServer<T> {
929 pub fn new(inner: T) -> Self {
930 Self::from_arc(Arc::new(inner))
931 }
932 pub fn from_arc(inner: Arc<T>) -> Self {
933 Self {
934 inner,
935 accept_compression_encodings: Default::default(),
936 send_compression_encodings: Default::default(),
937 max_decoding_message_size: None,
938 max_encoding_message_size: None,
939 }
940 }
941 pub fn with_interceptor<F>(
942 inner: T,
943 interceptor: F,
944 ) -> InterceptedService<Self, F>
945 where
946 F: tonic::service::Interceptor,
947 {
948 InterceptedService::new(Self::new(inner), interceptor)
949 }
950 #[must_use]
952 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
953 self.accept_compression_encodings.enable(encoding);
954 self
955 }
956 #[must_use]
958 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
959 self.send_compression_encodings.enable(encoding);
960 self
961 }
962 #[must_use]
966 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
967 self.max_decoding_message_size = Some(limit);
968 self
969 }
970 #[must_use]
974 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
975 self.max_encoding_message_size = Some(limit);
976 self
977 }
978 }
979 impl<T, B> tonic::codegen::Service<http::Request<B>> for SessionsServer<T>
980 where
981 T: Sessions,
982 B: Body + std::marker::Send + 'static,
983 B::Error: Into<StdError> + std::marker::Send + 'static,
984 {
985 type Response = http::Response<tonic::body::Body>;
986 type Error = std::convert::Infallible;
987 type Future = BoxFuture<Self::Response, Self::Error>;
988 fn poll_ready(
989 &mut self,
990 _cx: &mut Context<'_>,
991 ) -> Poll<std::result::Result<(), Self::Error>> {
992 Poll::Ready(Ok(()))
993 }
994 fn call(&mut self, req: http::Request<B>) -> Self::Future {
995 match req.uri().path() {
996 "/chainguard.sandbox.runtime.session.v1.Sessions/CreateSession" => {
997 #[allow(non_camel_case_types)]
998 struct CreateSessionSvc<T: Sessions>(pub Arc<T>);
999 impl<
1000 T: Sessions,
1001 > tonic::server::UnaryService<super::CreateSessionRequest>
1002 for CreateSessionSvc<T> {
1003 type Response = super::Session;
1004 type Future = BoxFuture<
1005 tonic::Response<Self::Response>,
1006 tonic::Status,
1007 >;
1008 fn call(
1009 &mut self,
1010 request: tonic::Request<super::CreateSessionRequest>,
1011 ) -> Self::Future {
1012 let inner = Arc::clone(&self.0);
1013 let fut = async move {
1014 <T as Sessions>::create_session(&inner, request).await
1015 };
1016 Box::pin(fut)
1017 }
1018 }
1019 let accept_compression_encodings = self.accept_compression_encodings;
1020 let send_compression_encodings = self.send_compression_encodings;
1021 let max_decoding_message_size = self.max_decoding_message_size;
1022 let max_encoding_message_size = self.max_encoding_message_size;
1023 let inner = self.inner.clone();
1024 let fut = async move {
1025 let method = CreateSessionSvc(inner);
1026 let codec = tonic_prost::ProstCodec::default();
1027 let mut grpc = tonic::server::Grpc::new(codec)
1028 .apply_compression_config(
1029 accept_compression_encodings,
1030 send_compression_encodings,
1031 )
1032 .apply_max_message_size_config(
1033 max_decoding_message_size,
1034 max_encoding_message_size,
1035 );
1036 let res = grpc.unary(method, req).await;
1037 Ok(res)
1038 };
1039 Box::pin(fut)
1040 }
1041 "/chainguard.sandbox.runtime.session.v1.Sessions/GetSession" => {
1042 #[allow(non_camel_case_types)]
1043 struct GetSessionSvc<T: Sessions>(pub Arc<T>);
1044 impl<
1045 T: Sessions,
1046 > tonic::server::UnaryService<super::GetSessionRequest>
1047 for GetSessionSvc<T> {
1048 type Response = super::Session;
1049 type Future = BoxFuture<
1050 tonic::Response<Self::Response>,
1051 tonic::Status,
1052 >;
1053 fn call(
1054 &mut self,
1055 request: tonic::Request<super::GetSessionRequest>,
1056 ) -> Self::Future {
1057 let inner = Arc::clone(&self.0);
1058 let fut = async move {
1059 <T as Sessions>::get_session(&inner, request).await
1060 };
1061 Box::pin(fut)
1062 }
1063 }
1064 let accept_compression_encodings = self.accept_compression_encodings;
1065 let send_compression_encodings = self.send_compression_encodings;
1066 let max_decoding_message_size = self.max_decoding_message_size;
1067 let max_encoding_message_size = self.max_encoding_message_size;
1068 let inner = self.inner.clone();
1069 let fut = async move {
1070 let method = GetSessionSvc(inner);
1071 let codec = tonic_prost::ProstCodec::default();
1072 let mut grpc = tonic::server::Grpc::new(codec)
1073 .apply_compression_config(
1074 accept_compression_encodings,
1075 send_compression_encodings,
1076 )
1077 .apply_max_message_size_config(
1078 max_decoding_message_size,
1079 max_encoding_message_size,
1080 );
1081 let res = grpc.unary(method, req).await;
1082 Ok(res)
1083 };
1084 Box::pin(fut)
1085 }
1086 "/chainguard.sandbox.runtime.session.v1.Sessions/ListSessions" => {
1087 #[allow(non_camel_case_types)]
1088 struct ListSessionsSvc<T: Sessions>(pub Arc<T>);
1089 impl<
1090 T: Sessions,
1091 > tonic::server::UnaryService<super::ListSessionsRequest>
1092 for ListSessionsSvc<T> {
1093 type Response = super::ListSessionsResponse;
1094 type Future = BoxFuture<
1095 tonic::Response<Self::Response>,
1096 tonic::Status,
1097 >;
1098 fn call(
1099 &mut self,
1100 request: tonic::Request<super::ListSessionsRequest>,
1101 ) -> Self::Future {
1102 let inner = Arc::clone(&self.0);
1103 let fut = async move {
1104 <T as Sessions>::list_sessions(&inner, request).await
1105 };
1106 Box::pin(fut)
1107 }
1108 }
1109 let accept_compression_encodings = self.accept_compression_encodings;
1110 let send_compression_encodings = self.send_compression_encodings;
1111 let max_decoding_message_size = self.max_decoding_message_size;
1112 let max_encoding_message_size = self.max_encoding_message_size;
1113 let inner = self.inner.clone();
1114 let fut = async move {
1115 let method = ListSessionsSvc(inner);
1116 let codec = tonic_prost::ProstCodec::default();
1117 let mut grpc = tonic::server::Grpc::new(codec)
1118 .apply_compression_config(
1119 accept_compression_encodings,
1120 send_compression_encodings,
1121 )
1122 .apply_max_message_size_config(
1123 max_decoding_message_size,
1124 max_encoding_message_size,
1125 );
1126 let res = grpc.unary(method, req).await;
1127 Ok(res)
1128 };
1129 Box::pin(fut)
1130 }
1131 "/chainguard.sandbox.runtime.session.v1.Sessions/UpdateSession" => {
1132 #[allow(non_camel_case_types)]
1133 struct UpdateSessionSvc<T: Sessions>(pub Arc<T>);
1134 impl<
1135 T: Sessions,
1136 > tonic::server::UnaryService<super::UpdateSessionRequest>
1137 for UpdateSessionSvc<T> {
1138 type Response = super::Session;
1139 type Future = BoxFuture<
1140 tonic::Response<Self::Response>,
1141 tonic::Status,
1142 >;
1143 fn call(
1144 &mut self,
1145 request: tonic::Request<super::UpdateSessionRequest>,
1146 ) -> Self::Future {
1147 let inner = Arc::clone(&self.0);
1148 let fut = async move {
1149 <T as Sessions>::update_session(&inner, request).await
1150 };
1151 Box::pin(fut)
1152 }
1153 }
1154 let accept_compression_encodings = self.accept_compression_encodings;
1155 let send_compression_encodings = self.send_compression_encodings;
1156 let max_decoding_message_size = self.max_decoding_message_size;
1157 let max_encoding_message_size = self.max_encoding_message_size;
1158 let inner = self.inner.clone();
1159 let fut = async move {
1160 let method = UpdateSessionSvc(inner);
1161 let codec = tonic_prost::ProstCodec::default();
1162 let mut grpc = tonic::server::Grpc::new(codec)
1163 .apply_compression_config(
1164 accept_compression_encodings,
1165 send_compression_encodings,
1166 )
1167 .apply_max_message_size_config(
1168 max_decoding_message_size,
1169 max_encoding_message_size,
1170 );
1171 let res = grpc.unary(method, req).await;
1172 Ok(res)
1173 };
1174 Box::pin(fut)
1175 }
1176 "/chainguard.sandbox.runtime.session.v1.Sessions/DeleteSession" => {
1177 #[allow(non_camel_case_types)]
1178 struct DeleteSessionSvc<T: Sessions>(pub Arc<T>);
1179 impl<
1180 T: Sessions,
1181 > tonic::server::UnaryService<super::DeleteSessionRequest>
1182 for DeleteSessionSvc<T> {
1183 type Response = ();
1184 type Future = BoxFuture<
1185 tonic::Response<Self::Response>,
1186 tonic::Status,
1187 >;
1188 fn call(
1189 &mut self,
1190 request: tonic::Request<super::DeleteSessionRequest>,
1191 ) -> Self::Future {
1192 let inner = Arc::clone(&self.0);
1193 let fut = async move {
1194 <T as Sessions>::delete_session(&inner, request).await
1195 };
1196 Box::pin(fut)
1197 }
1198 }
1199 let accept_compression_encodings = self.accept_compression_encodings;
1200 let send_compression_encodings = self.send_compression_encodings;
1201 let max_decoding_message_size = self.max_decoding_message_size;
1202 let max_encoding_message_size = self.max_encoding_message_size;
1203 let inner = self.inner.clone();
1204 let fut = async move {
1205 let method = DeleteSessionSvc(inner);
1206 let codec = tonic_prost::ProstCodec::default();
1207 let mut grpc = tonic::server::Grpc::new(codec)
1208 .apply_compression_config(
1209 accept_compression_encodings,
1210 send_compression_encodings,
1211 )
1212 .apply_max_message_size_config(
1213 max_decoding_message_size,
1214 max_encoding_message_size,
1215 );
1216 let res = grpc.unary(method, req).await;
1217 Ok(res)
1218 };
1219 Box::pin(fut)
1220 }
1221 "/chainguard.sandbox.runtime.session.v1.Sessions/HeartbeatSession" => {
1222 #[allow(non_camel_case_types)]
1223 struct HeartbeatSessionSvc<T: Sessions>(pub Arc<T>);
1224 impl<
1225 T: Sessions,
1226 > tonic::server::UnaryService<super::HeartbeatSessionRequest>
1227 for HeartbeatSessionSvc<T> {
1228 type Response = super::Session;
1229 type Future = BoxFuture<
1230 tonic::Response<Self::Response>,
1231 tonic::Status,
1232 >;
1233 fn call(
1234 &mut self,
1235 request: tonic::Request<super::HeartbeatSessionRequest>,
1236 ) -> Self::Future {
1237 let inner = Arc::clone(&self.0);
1238 let fut = async move {
1239 <T as Sessions>::heartbeat_session(&inner, request).await
1240 };
1241 Box::pin(fut)
1242 }
1243 }
1244 let accept_compression_encodings = self.accept_compression_encodings;
1245 let send_compression_encodings = self.send_compression_encodings;
1246 let max_decoding_message_size = self.max_decoding_message_size;
1247 let max_encoding_message_size = self.max_encoding_message_size;
1248 let inner = self.inner.clone();
1249 let fut = async move {
1250 let method = HeartbeatSessionSvc(inner);
1251 let codec = tonic_prost::ProstCodec::default();
1252 let mut grpc = tonic::server::Grpc::new(codec)
1253 .apply_compression_config(
1254 accept_compression_encodings,
1255 send_compression_encodings,
1256 )
1257 .apply_max_message_size_config(
1258 max_decoding_message_size,
1259 max_encoding_message_size,
1260 );
1261 let res = grpc.unary(method, req).await;
1262 Ok(res)
1263 };
1264 Box::pin(fut)
1265 }
1266 "/chainguard.sandbox.runtime.session.v1.Sessions/AttachSession" => {
1267 #[allow(non_camel_case_types)]
1268 struct AttachSessionSvc<T: Sessions>(pub Arc<T>);
1269 impl<
1270 T: Sessions,
1271 > tonic::server::StreamingService<super::AttachRequest>
1272 for AttachSessionSvc<T> {
1273 type Response = super::AttachResponse;
1274 type ResponseStream = T::AttachSessionStream;
1275 type Future = BoxFuture<
1276 tonic::Response<Self::ResponseStream>,
1277 tonic::Status,
1278 >;
1279 fn call(
1280 &mut self,
1281 request: tonic::Request<
1282 tonic::Streaming<super::AttachRequest>,
1283 >,
1284 ) -> Self::Future {
1285 let inner = Arc::clone(&self.0);
1286 let fut = async move {
1287 <T as Sessions>::attach_session(&inner, request).await
1288 };
1289 Box::pin(fut)
1290 }
1291 }
1292 let accept_compression_encodings = self.accept_compression_encodings;
1293 let send_compression_encodings = self.send_compression_encodings;
1294 let max_decoding_message_size = self.max_decoding_message_size;
1295 let max_encoding_message_size = self.max_encoding_message_size;
1296 let inner = self.inner.clone();
1297 let fut = async move {
1298 let method = AttachSessionSvc(inner);
1299 let codec = tonic_prost::ProstCodec::default();
1300 let mut grpc = tonic::server::Grpc::new(codec)
1301 .apply_compression_config(
1302 accept_compression_encodings,
1303 send_compression_encodings,
1304 )
1305 .apply_max_message_size_config(
1306 max_decoding_message_size,
1307 max_encoding_message_size,
1308 );
1309 let res = grpc.streaming(method, req).await;
1310 Ok(res)
1311 };
1312 Box::pin(fut)
1313 }
1314 "/chainguard.sandbox.runtime.session.v1.Sessions/Exec" => {
1315 #[allow(non_camel_case_types)]
1316 struct ExecSvc<T: Sessions>(pub Arc<T>);
1317 impl<
1318 T: Sessions,
1319 > tonic::server::ServerStreamingService<super::ExecRequest>
1320 for ExecSvc<T> {
1321 type Response = super::ExecResponse;
1322 type ResponseStream = T::ExecStream;
1323 type Future = BoxFuture<
1324 tonic::Response<Self::ResponseStream>,
1325 tonic::Status,
1326 >;
1327 fn call(
1328 &mut self,
1329 request: tonic::Request<super::ExecRequest>,
1330 ) -> Self::Future {
1331 let inner = Arc::clone(&self.0);
1332 let fut = async move {
1333 <T as Sessions>::exec(&inner, request).await
1334 };
1335 Box::pin(fut)
1336 }
1337 }
1338 let accept_compression_encodings = self.accept_compression_encodings;
1339 let send_compression_encodings = self.send_compression_encodings;
1340 let max_decoding_message_size = self.max_decoding_message_size;
1341 let max_encoding_message_size = self.max_encoding_message_size;
1342 let inner = self.inner.clone();
1343 let fut = async move {
1344 let method = ExecSvc(inner);
1345 let codec = tonic_prost::ProstCodec::default();
1346 let mut grpc = tonic::server::Grpc::new(codec)
1347 .apply_compression_config(
1348 accept_compression_encodings,
1349 send_compression_encodings,
1350 )
1351 .apply_max_message_size_config(
1352 max_decoding_message_size,
1353 max_encoding_message_size,
1354 );
1355 let res = grpc.server_streaming(method, req).await;
1356 Ok(res)
1357 };
1358 Box::pin(fut)
1359 }
1360 _ => {
1361 Box::pin(async move {
1362 let mut response = http::Response::new(
1363 tonic::body::Body::default(),
1364 );
1365 let headers = response.headers_mut();
1366 headers
1367 .insert(
1368 tonic::Status::GRPC_STATUS,
1369 (tonic::Code::Unimplemented as i32).into(),
1370 );
1371 headers
1372 .insert(
1373 http::header::CONTENT_TYPE,
1374 tonic::metadata::GRPC_CONTENT_TYPE,
1375 );
1376 Ok(response)
1377 })
1378 }
1379 }
1380 }
1381 }
1382 impl<T> Clone for SessionsServer<T> {
1383 fn clone(&self) -> Self {
1384 let inner = self.inner.clone();
1385 Self {
1386 inner,
1387 accept_compression_encodings: self.accept_compression_encodings,
1388 send_compression_encodings: self.send_compression_encodings,
1389 max_decoding_message_size: self.max_decoding_message_size,
1390 max_encoding_message_size: self.max_encoding_message_size,
1391 }
1392 }
1393 }
1394 pub const SERVICE_NAME: &str = "chainguard.sandbox.runtime.session.v1.Sessions";
1396 impl<T> tonic::server::NamedService for SessionsServer<T> {
1397 const NAME: &'static str = SERVICE_NAME;
1398 }
1399}