1#[derive(serde::Deserialize, serde::Serialize)]
3#[allow(clippy::derive_partial_eq_without_eq)]
4#[derive(Clone, PartialEq, ::prost::Message)]
5pub struct Trigger {
6 #[prost(enumeration = "TriggerType", tag = "1")]
7 pub trigger_type: i32,
8 #[prost(message, repeated, tag = "2")]
9 pub filters: ::prost::alloc::vec::Vec<Filter>,
10}
11#[derive(serde::Deserialize, serde::Serialize)]
12#[allow(clippy::derive_partial_eq_without_eq)]
13#[derive(Clone, PartialEq, ::prost::Message)]
14pub struct ExternalHook {
15 #[prost(string, tag = "1")]
16 pub url: ::prost::alloc::string::String,
17 #[prost(message, optional, tag = "2")]
18 pub credentials: ::core::option::Option<Credentials>,
19 #[prost(string, optional, tag = "3")]
21 pub custom_template: ::core::option::Option<::prost::alloc::string::String>,
22 #[prost(enumeration = "Method", tag = "5")]
23 pub method: i32,
24}
25#[derive(serde::Deserialize, serde::Serialize)]
26#[allow(clippy::derive_partial_eq_without_eq)]
27#[derive(Clone, PartialEq, ::prost::Message)]
28pub struct AddLabel {
29 #[prost(string, tag = "1")]
30 pub key: ::prost::alloc::string::String,
31 #[prost(string, tag = "2")]
32 pub value: ::prost::alloc::string::String,
33}
34#[derive(serde::Deserialize, serde::Serialize)]
35#[allow(clippy::derive_partial_eq_without_eq)]
36#[derive(Clone, PartialEq, ::prost::Message)]
37pub struct AddHook {
38 #[prost(string, tag = "1")]
39 pub key: ::prost::alloc::string::String,
40 #[prost(string, tag = "2")]
41 pub value: ::prost::alloc::string::String,
42}
43#[derive(serde::Deserialize, serde::Serialize)]
44#[allow(clippy::derive_partial_eq_without_eq)]
45#[derive(Clone, PartialEq, ::prost::Message)]
46pub struct InternalHook {
47 #[prost(oneof = "internal_hook::InternalAction", tags = "1, 2, 3")]
48 pub internal_action: ::core::option::Option<internal_hook::InternalAction>,
49}
50pub mod internal_hook {
52 #[derive(serde::Deserialize, serde::Serialize)]
53 #[allow(clippy::derive_partial_eq_without_eq)]
54 #[derive(Clone, PartialEq, ::prost::Oneof)]
55 pub enum InternalAction {
56 #[prost(message, tag = "1")]
57 AddLabel(super::AddLabel),
58 #[prost(message, tag = "2")]
59 AddHook(super::AddHook),
60 #[prost(message, tag = "3")]
61 AddRelation(super::super::super::super::storage::models::v2::Relation),
62 }
63}
64#[derive(serde::Deserialize, serde::Serialize)]
65#[allow(clippy::derive_partial_eq_without_eq)]
66#[derive(Clone, PartialEq, ::prost::Message)]
67pub struct Hook {
68 #[prost(oneof = "hook::HookType", tags = "1, 2")]
69 pub hook_type: ::core::option::Option<hook::HookType>,
70}
71pub mod hook {
73 #[derive(serde::Deserialize, serde::Serialize)]
74 #[allow(clippy::derive_partial_eq_without_eq)]
75 #[derive(Clone, PartialEq, ::prost::Oneof)]
76 pub enum HookType {
77 #[prost(message, tag = "1")]
78 ExternalHook(super::ExternalHook),
79 #[prost(message, tag = "2")]
80 InternalHook(super::InternalHook),
81 }
82}
83#[derive(serde::Deserialize, serde::Serialize)]
85#[allow(clippy::derive_partial_eq_without_eq)]
86#[derive(Clone, PartialEq, ::prost::Message)]
87pub struct Credentials {
88 #[prost(string, tag = "1")]
89 pub token: ::prost::alloc::string::String,
90}
91#[derive(serde::Deserialize, serde::Serialize)]
92#[allow(clippy::derive_partial_eq_without_eq)]
93#[derive(Clone, PartialEq, ::prost::Message)]
94pub struct Filter {
95 #[prost(oneof = "filter::FilterVariant", tags = "1, 2")]
96 pub filter_variant: ::core::option::Option<filter::FilterVariant>,
97}
98pub mod filter {
100 #[derive(serde::Deserialize, serde::Serialize)]
101 #[allow(clippy::derive_partial_eq_without_eq)]
102 #[derive(Clone, PartialEq, ::prost::Oneof)]
103 pub enum FilterVariant {
104 #[prost(string, tag = "1")]
106 Name(::prost::alloc::string::String),
107 #[prost(message, tag = "2")]
111 KeyValue(super::super::super::super::storage::models::v2::KeyValue),
112 }
113}
114#[derive(serde::Deserialize, serde::Serialize)]
115#[allow(clippy::derive_partial_eq_without_eq)]
116#[derive(Clone, PartialEq, ::prost::Message)]
117pub struct CreateHookRequest {
118 #[prost(string, tag = "1")]
119 pub name: ::prost::alloc::string::String,
120 #[prost(message, optional, tag = "2")]
121 pub trigger: ::core::option::Option<Trigger>,
122 #[prost(message, optional, tag = "3")]
123 pub hook: ::core::option::Option<Hook>,
124 #[prost(uint64, tag = "4")]
125 pub timeout: u64,
126 #[prost(string, repeated, tag = "5")]
127 pub project_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
128 #[prost(string, tag = "6")]
129 pub description: ::prost::alloc::string::String,
130}
131#[derive(serde::Deserialize, serde::Serialize)]
132#[allow(clippy::derive_partial_eq_without_eq)]
133#[derive(Clone, PartialEq, ::prost::Message)]
134pub struct CreateHookResponse {
135 #[prost(string, tag = "1")]
136 pub hook_id: ::prost::alloc::string::String,
137}
138#[derive(serde::Deserialize, serde::Serialize)]
139#[allow(clippy::derive_partial_eq_without_eq)]
140#[derive(Clone, PartialEq, ::prost::Message)]
141pub struct DeleteHookRequest {
142 #[prost(string, tag = "1")]
143 pub hook_id: ::prost::alloc::string::String,
144}
145#[derive(serde::Deserialize, serde::Serialize)]
146#[allow(clippy::derive_partial_eq_without_eq)]
147#[derive(Clone, PartialEq, ::prost::Message)]
148pub struct DeleteHookResponse {}
149#[derive(serde::Deserialize, serde::Serialize)]
150#[allow(clippy::derive_partial_eq_without_eq)]
151#[derive(Clone, PartialEq, ::prost::Message)]
152pub struct HookCallbackRequest {
153 #[prost(string, tag = "3")]
154 pub secret: ::prost::alloc::string::String,
155 #[prost(string, tag = "4")]
156 pub hook_id: ::prost::alloc::string::String,
157 #[prost(string, tag = "5")]
158 pub object_id: ::prost::alloc::string::String,
159 #[prost(int32, tag = "6")]
160 pub pubkey_serial: i32,
161 #[prost(oneof = "hook_callback_request::Status", tags = "1, 2")]
162 pub status: ::core::option::Option<hook_callback_request::Status>,
163}
164pub mod hook_callback_request {
166 #[derive(serde::Deserialize, serde::Serialize)]
167 #[allow(clippy::derive_partial_eq_without_eq)]
168 #[derive(Clone, PartialEq, ::prost::Oneof)]
169 pub enum Status {
170 #[prost(message, tag = "1")]
171 Finished(super::Finished),
172 #[prost(message, tag = "2")]
173 Error(super::Error),
174 }
175}
176#[derive(serde::Deserialize, serde::Serialize)]
177#[allow(clippy::derive_partial_eq_without_eq)]
178#[derive(Clone, PartialEq, ::prost::Message)]
179pub struct Finished {
180 #[prost(message, repeated, tag = "1")]
181 pub add_key_values: ::prost::alloc::vec::Vec<
182 super::super::super::storage::models::v2::KeyValue,
183 >,
184 #[prost(message, repeated, tag = "2")]
185 pub remove_key_values: ::prost::alloc::vec::Vec<
186 super::super::super::storage::models::v2::KeyValue,
187 >,
188}
189#[derive(serde::Deserialize, serde::Serialize)]
190#[allow(clippy::derive_partial_eq_without_eq)]
191#[derive(Clone, PartialEq, ::prost::Message)]
192pub struct Error {
193 #[prost(string, tag = "1")]
194 pub error: ::prost::alloc::string::String,
195}
196#[derive(serde::Deserialize, serde::Serialize)]
197#[allow(clippy::derive_partial_eq_without_eq)]
198#[derive(Clone, PartialEq, ::prost::Message)]
199pub struct HookCallbackResponse {}
200#[derive(serde::Deserialize, serde::Serialize)]
201#[allow(clippy::derive_partial_eq_without_eq)]
202#[derive(Clone, PartialEq, ::prost::Message)]
203pub struct ListProjectHooksRequest {
204 #[prost(string, tag = "1")]
205 pub project_id: ::prost::alloc::string::String,
206}
207#[derive(serde::Deserialize, serde::Serialize)]
208#[allow(clippy::derive_partial_eq_without_eq)]
209#[derive(Clone, PartialEq, ::prost::Message)]
210pub struct ListOwnedHooksRequest {
211 #[prost(string, tag = "1")]
213 pub user_id: ::prost::alloc::string::String,
214}
215#[derive(serde::Deserialize, serde::Serialize)]
216#[allow(clippy::derive_partial_eq_without_eq)]
217#[derive(Clone, PartialEq, ::prost::Message)]
218pub struct HookInfo {
219 #[prost(string, tag = "1")]
220 pub hook_id: ::prost::alloc::string::String,
221 #[prost(string, repeated, tag = "2")]
222 pub project_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
223 #[prost(string, tag = "3")]
224 pub name: ::prost::alloc::string::String,
225 #[prost(string, tag = "4")]
226 pub description: ::prost::alloc::string::String,
227 #[prost(message, optional, tag = "5")]
228 pub hook: ::core::option::Option<Hook>,
229 #[prost(message, optional, tag = "6")]
230 pub trigger: ::core::option::Option<Trigger>,
231 #[prost(uint64, tag = "7")]
232 pub timeout: u64,
233}
234#[derive(serde::Deserialize, serde::Serialize)]
235#[allow(clippy::derive_partial_eq_without_eq)]
236#[derive(Clone, PartialEq, ::prost::Message)]
237pub struct ListProjectHooksResponse {
238 #[prost(message, repeated, tag = "1")]
239 pub infos: ::prost::alloc::vec::Vec<HookInfo>,
240}
241#[derive(serde::Deserialize, serde::Serialize)]
242#[allow(clippy::derive_partial_eq_without_eq)]
243#[derive(Clone, PartialEq, ::prost::Message)]
244pub struct ListOwnedHooksResponse {
245 #[prost(message, repeated, tag = "1")]
246 pub infos: ::prost::alloc::vec::Vec<HookInfo>,
247}
248#[derive(serde::Deserialize, serde::Serialize)]
249#[allow(clippy::derive_partial_eq_without_eq)]
250#[derive(Clone, PartialEq, ::prost::Message)]
251pub struct AddProjectsToHookRequest {
252 #[prost(string, tag = "1")]
253 pub hook_id: ::prost::alloc::string::String,
254 #[prost(string, repeated, tag = "2")]
255 pub project_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
256}
257#[derive(serde::Deserialize, serde::Serialize)]
258#[allow(clippy::derive_partial_eq_without_eq)]
259#[derive(Clone, PartialEq, ::prost::Message)]
260pub struct AddProjectsToHookResponse {}
261#[derive(serde::Deserialize, serde::Serialize)]
262#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
263#[repr(i32)]
264pub enum TriggerType {
265 Unspecified = 0,
266 HookAdded = 1,
267 ResourceCreated = 2,
268 LabelAdded = 3,
269 StaticLabelAdded = 4,
270 HookStatusChanged = 5,
271 ObjectFinished = 6,
272}
273impl TriggerType {
274 pub fn as_str_name(&self) -> &'static str {
279 match self {
280 TriggerType::Unspecified => "TRIGGER_TYPE_UNSPECIFIED",
281 TriggerType::HookAdded => "TRIGGER_TYPE_HOOK_ADDED",
282 TriggerType::ResourceCreated => "TRIGGER_TYPE_RESOURCE_CREATED",
283 TriggerType::LabelAdded => "TRIGGER_TYPE_LABEL_ADDED",
284 TriggerType::StaticLabelAdded => "TRIGGER_TYPE_STATIC_LABEL_ADDED",
285 TriggerType::HookStatusChanged => "TRIGGER_TYPE_HOOK_STATUS_CHANGED",
286 TriggerType::ObjectFinished => "TRIGGER_TYPE_OBJECT_FINISHED",
287 }
288 }
289 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
291 match value {
292 "TRIGGER_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
293 "TRIGGER_TYPE_HOOK_ADDED" => Some(Self::HookAdded),
294 "TRIGGER_TYPE_RESOURCE_CREATED" => Some(Self::ResourceCreated),
295 "TRIGGER_TYPE_LABEL_ADDED" => Some(Self::LabelAdded),
296 "TRIGGER_TYPE_STATIC_LABEL_ADDED" => Some(Self::StaticLabelAdded),
297 "TRIGGER_TYPE_HOOK_STATUS_CHANGED" => Some(Self::HookStatusChanged),
298 "TRIGGER_TYPE_OBJECT_FINISHED" => Some(Self::ObjectFinished),
299 _ => None,
300 }
301 }
302}
303#[derive(serde::Deserialize, serde::Serialize)]
304#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
305#[repr(i32)]
306pub enum Method {
307 Unspecified = 0,
308 Put = 1,
309 Post = 2,
310}
311impl Method {
312 pub fn as_str_name(&self) -> &'static str {
317 match self {
318 Method::Unspecified => "METHOD_UNSPECIFIED",
319 Method::Put => "METHOD_PUT",
320 Method::Post => "METHOD_POST",
321 }
322 }
323 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
325 match value {
326 "METHOD_UNSPECIFIED" => Some(Self::Unspecified),
327 "METHOD_PUT" => Some(Self::Put),
328 "METHOD_POST" => Some(Self::Post),
329 _ => None,
330 }
331 }
332}
333pub mod hooks_service_client {
335 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
336 use tonic::codegen::*;
337 use tonic::codegen::http::Uri;
338 #[derive(Debug, Clone)]
344 pub struct HooksServiceClient<T> {
345 inner: tonic::client::Grpc<T>,
346 }
347 impl HooksServiceClient<tonic::transport::Channel> {
348 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
350 where
351 D: TryInto<tonic::transport::Endpoint>,
352 D::Error: Into<StdError>,
353 {
354 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
355 Ok(Self::new(conn))
356 }
357 }
358 impl<T> HooksServiceClient<T>
359 where
360 T: tonic::client::GrpcService<tonic::body::BoxBody>,
361 T::Error: Into<StdError>,
362 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
363 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
364 {
365 pub fn new(inner: T) -> Self {
366 let inner = tonic::client::Grpc::new(inner);
367 Self { inner }
368 }
369 pub fn with_origin(inner: T, origin: Uri) -> Self {
370 let inner = tonic::client::Grpc::with_origin(inner, origin);
371 Self { inner }
372 }
373 pub fn with_interceptor<F>(
374 inner: T,
375 interceptor: F,
376 ) -> HooksServiceClient<InterceptedService<T, F>>
377 where
378 F: tonic::service::Interceptor,
379 T::ResponseBody: Default,
380 T: tonic::codegen::Service<
381 http::Request<tonic::body::BoxBody>,
382 Response = http::Response<
383 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
384 >,
385 >,
386 <T as tonic::codegen::Service<
387 http::Request<tonic::body::BoxBody>,
388 >>::Error: Into<StdError> + Send + Sync,
389 {
390 HooksServiceClient::new(InterceptedService::new(inner, interceptor))
391 }
392 #[must_use]
397 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
398 self.inner = self.inner.send_compressed(encoding);
399 self
400 }
401 #[must_use]
403 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
404 self.inner = self.inner.accept_compressed(encoding);
405 self
406 }
407 #[must_use]
411 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
412 self.inner = self.inner.max_decoding_message_size(limit);
413 self
414 }
415 #[must_use]
419 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
420 self.inner = self.inner.max_encoding_message_size(limit);
421 self
422 }
423 pub async fn create_hook(
430 &mut self,
431 request: impl tonic::IntoRequest<super::CreateHookRequest>,
432 ) -> std::result::Result<
433 tonic::Response<super::CreateHookResponse>,
434 tonic::Status,
435 > {
436 self.inner
437 .ready()
438 .await
439 .map_err(|e| {
440 tonic::Status::new(
441 tonic::Code::Unknown,
442 format!("Service was not ready: {}", e.into()),
443 )
444 })?;
445 let codec = tonic::codec::ProstCodec::default();
446 let path = http::uri::PathAndQuery::from_static(
447 "/aruna.api.hooks.services.v2.HooksService/CreateHook",
448 );
449 let mut req = request.into_request();
450 req.extensions_mut()
451 .insert(
452 GrpcMethod::new(
453 "aruna.api.hooks.services.v2.HooksService",
454 "CreateHook",
455 ),
456 );
457 self.inner.unary(req, path, codec).await
458 }
459 pub async fn add_projects_to_hook(
465 &mut self,
466 request: impl tonic::IntoRequest<super::AddProjectsToHookRequest>,
467 ) -> std::result::Result<
468 tonic::Response<super::AddProjectsToHookResponse>,
469 tonic::Status,
470 > {
471 self.inner
472 .ready()
473 .await
474 .map_err(|e| {
475 tonic::Status::new(
476 tonic::Code::Unknown,
477 format!("Service was not ready: {}", e.into()),
478 )
479 })?;
480 let codec = tonic::codec::ProstCodec::default();
481 let path = http::uri::PathAndQuery::from_static(
482 "/aruna.api.hooks.services.v2.HooksService/AddProjectsToHook",
483 );
484 let mut req = request.into_request();
485 req.extensions_mut()
486 .insert(
487 GrpcMethod::new(
488 "aruna.api.hooks.services.v2.HooksService",
489 "AddProjectsToHook",
490 ),
491 );
492 self.inner.unary(req, path, codec).await
493 }
494 pub async fn list_project_hooks(
500 &mut self,
501 request: impl tonic::IntoRequest<super::ListProjectHooksRequest>,
502 ) -> std::result::Result<
503 tonic::Response<super::ListProjectHooksResponse>,
504 tonic::Status,
505 > {
506 self.inner
507 .ready()
508 .await
509 .map_err(|e| {
510 tonic::Status::new(
511 tonic::Code::Unknown,
512 format!("Service was not ready: {}", e.into()),
513 )
514 })?;
515 let codec = tonic::codec::ProstCodec::default();
516 let path = http::uri::PathAndQuery::from_static(
517 "/aruna.api.hooks.services.v2.HooksService/ListProjectHooks",
518 );
519 let mut req = request.into_request();
520 req.extensions_mut()
521 .insert(
522 GrpcMethod::new(
523 "aruna.api.hooks.services.v2.HooksService",
524 "ListProjectHooks",
525 ),
526 );
527 self.inner.unary(req, path, codec).await
528 }
529 pub async fn list_owned_hooks(
535 &mut self,
536 request: impl tonic::IntoRequest<super::ListOwnedHooksRequest>,
537 ) -> std::result::Result<
538 tonic::Response<super::ListOwnedHooksResponse>,
539 tonic::Status,
540 > {
541 self.inner
542 .ready()
543 .await
544 .map_err(|e| {
545 tonic::Status::new(
546 tonic::Code::Unknown,
547 format!("Service was not ready: {}", e.into()),
548 )
549 })?;
550 let codec = tonic::codec::ProstCodec::default();
551 let path = http::uri::PathAndQuery::from_static(
552 "/aruna.api.hooks.services.v2.HooksService/ListOwnedHooks",
553 );
554 let mut req = request.into_request();
555 req.extensions_mut()
556 .insert(
557 GrpcMethod::new(
558 "aruna.api.hooks.services.v2.HooksService",
559 "ListOwnedHooks",
560 ),
561 );
562 self.inner.unary(req, path, codec).await
563 }
564 pub async fn delete_hook(
570 &mut self,
571 request: impl tonic::IntoRequest<super::DeleteHookRequest>,
572 ) -> std::result::Result<
573 tonic::Response<super::DeleteHookResponse>,
574 tonic::Status,
575 > {
576 self.inner
577 .ready()
578 .await
579 .map_err(|e| {
580 tonic::Status::new(
581 tonic::Code::Unknown,
582 format!("Service was not ready: {}", e.into()),
583 )
584 })?;
585 let codec = tonic::codec::ProstCodec::default();
586 let path = http::uri::PathAndQuery::from_static(
587 "/aruna.api.hooks.services.v2.HooksService/DeleteHook",
588 );
589 let mut req = request.into_request();
590 req.extensions_mut()
591 .insert(
592 GrpcMethod::new(
593 "aruna.api.hooks.services.v2.HooksService",
594 "DeleteHook",
595 ),
596 );
597 self.inner.unary(req, path, codec).await
598 }
599 pub async fn hook_callback(
606 &mut self,
607 request: impl tonic::IntoRequest<super::HookCallbackRequest>,
608 ) -> std::result::Result<
609 tonic::Response<super::HookCallbackResponse>,
610 tonic::Status,
611 > {
612 self.inner
613 .ready()
614 .await
615 .map_err(|e| {
616 tonic::Status::new(
617 tonic::Code::Unknown,
618 format!("Service was not ready: {}", e.into()),
619 )
620 })?;
621 let codec = tonic::codec::ProstCodec::default();
622 let path = http::uri::PathAndQuery::from_static(
623 "/aruna.api.hooks.services.v2.HooksService/HookCallback",
624 );
625 let mut req = request.into_request();
626 req.extensions_mut()
627 .insert(
628 GrpcMethod::new(
629 "aruna.api.hooks.services.v2.HooksService",
630 "HookCallback",
631 ),
632 );
633 self.inner.unary(req, path, codec).await
634 }
635 }
636}
637pub mod hooks_service_server {
639 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
640 use tonic::codegen::*;
641 #[async_trait]
643 pub trait HooksService: Send + Sync + 'static {
644 async fn create_hook(
651 &self,
652 request: tonic::Request<super::CreateHookRequest>,
653 ) -> std::result::Result<
654 tonic::Response<super::CreateHookResponse>,
655 tonic::Status,
656 >;
657 async fn add_projects_to_hook(
663 &self,
664 request: tonic::Request<super::AddProjectsToHookRequest>,
665 ) -> std::result::Result<
666 tonic::Response<super::AddProjectsToHookResponse>,
667 tonic::Status,
668 >;
669 async fn list_project_hooks(
675 &self,
676 request: tonic::Request<super::ListProjectHooksRequest>,
677 ) -> std::result::Result<
678 tonic::Response<super::ListProjectHooksResponse>,
679 tonic::Status,
680 >;
681 async fn list_owned_hooks(
687 &self,
688 request: tonic::Request<super::ListOwnedHooksRequest>,
689 ) -> std::result::Result<
690 tonic::Response<super::ListOwnedHooksResponse>,
691 tonic::Status,
692 >;
693 async fn delete_hook(
699 &self,
700 request: tonic::Request<super::DeleteHookRequest>,
701 ) -> std::result::Result<
702 tonic::Response<super::DeleteHookResponse>,
703 tonic::Status,
704 >;
705 async fn hook_callback(
712 &self,
713 request: tonic::Request<super::HookCallbackRequest>,
714 ) -> std::result::Result<
715 tonic::Response<super::HookCallbackResponse>,
716 tonic::Status,
717 >;
718 }
719 #[derive(Debug)]
725 pub struct HooksServiceServer<T: HooksService> {
726 inner: _Inner<T>,
727 accept_compression_encodings: EnabledCompressionEncodings,
728 send_compression_encodings: EnabledCompressionEncodings,
729 max_decoding_message_size: Option<usize>,
730 max_encoding_message_size: Option<usize>,
731 }
732 struct _Inner<T>(Arc<T>);
733 impl<T: HooksService> HooksServiceServer<T> {
734 pub fn new(inner: T) -> Self {
735 Self::from_arc(Arc::new(inner))
736 }
737 pub fn from_arc(inner: Arc<T>) -> Self {
738 let inner = _Inner(inner);
739 Self {
740 inner,
741 accept_compression_encodings: Default::default(),
742 send_compression_encodings: Default::default(),
743 max_decoding_message_size: None,
744 max_encoding_message_size: None,
745 }
746 }
747 pub fn with_interceptor<F>(
748 inner: T,
749 interceptor: F,
750 ) -> InterceptedService<Self, F>
751 where
752 F: tonic::service::Interceptor,
753 {
754 InterceptedService::new(Self::new(inner), interceptor)
755 }
756 #[must_use]
758 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
759 self.accept_compression_encodings.enable(encoding);
760 self
761 }
762 #[must_use]
764 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
765 self.send_compression_encodings.enable(encoding);
766 self
767 }
768 #[must_use]
772 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
773 self.max_decoding_message_size = Some(limit);
774 self
775 }
776 #[must_use]
780 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
781 self.max_encoding_message_size = Some(limit);
782 self
783 }
784 }
785 impl<T, B> tonic::codegen::Service<http::Request<B>> for HooksServiceServer<T>
786 where
787 T: HooksService,
788 B: Body + Send + 'static,
789 B::Error: Into<StdError> + Send + 'static,
790 {
791 type Response = http::Response<tonic::body::BoxBody>;
792 type Error = std::convert::Infallible;
793 type Future = BoxFuture<Self::Response, Self::Error>;
794 fn poll_ready(
795 &mut self,
796 _cx: &mut Context<'_>,
797 ) -> Poll<std::result::Result<(), Self::Error>> {
798 Poll::Ready(Ok(()))
799 }
800 fn call(&mut self, req: http::Request<B>) -> Self::Future {
801 let inner = self.inner.clone();
802 match req.uri().path() {
803 "/aruna.api.hooks.services.v2.HooksService/CreateHook" => {
804 #[allow(non_camel_case_types)]
805 struct CreateHookSvc<T: HooksService>(pub Arc<T>);
806 impl<
807 T: HooksService,
808 > tonic::server::UnaryService<super::CreateHookRequest>
809 for CreateHookSvc<T> {
810 type Response = super::CreateHookResponse;
811 type Future = BoxFuture<
812 tonic::Response<Self::Response>,
813 tonic::Status,
814 >;
815 fn call(
816 &mut self,
817 request: tonic::Request<super::CreateHookRequest>,
818 ) -> Self::Future {
819 let inner = Arc::clone(&self.0);
820 let fut = async move {
821 <T as HooksService>::create_hook(&inner, request).await
822 };
823 Box::pin(fut)
824 }
825 }
826 let accept_compression_encodings = self.accept_compression_encodings;
827 let send_compression_encodings = self.send_compression_encodings;
828 let max_decoding_message_size = self.max_decoding_message_size;
829 let max_encoding_message_size = self.max_encoding_message_size;
830 let inner = self.inner.clone();
831 let fut = async move {
832 let inner = inner.0;
833 let method = CreateHookSvc(inner);
834 let codec = tonic::codec::ProstCodec::default();
835 let mut grpc = tonic::server::Grpc::new(codec)
836 .apply_compression_config(
837 accept_compression_encodings,
838 send_compression_encodings,
839 )
840 .apply_max_message_size_config(
841 max_decoding_message_size,
842 max_encoding_message_size,
843 );
844 let res = grpc.unary(method, req).await;
845 Ok(res)
846 };
847 Box::pin(fut)
848 }
849 "/aruna.api.hooks.services.v2.HooksService/AddProjectsToHook" => {
850 #[allow(non_camel_case_types)]
851 struct AddProjectsToHookSvc<T: HooksService>(pub Arc<T>);
852 impl<
853 T: HooksService,
854 > tonic::server::UnaryService<super::AddProjectsToHookRequest>
855 for AddProjectsToHookSvc<T> {
856 type Response = super::AddProjectsToHookResponse;
857 type Future = BoxFuture<
858 tonic::Response<Self::Response>,
859 tonic::Status,
860 >;
861 fn call(
862 &mut self,
863 request: tonic::Request<super::AddProjectsToHookRequest>,
864 ) -> Self::Future {
865 let inner = Arc::clone(&self.0);
866 let fut = async move {
867 <T as HooksService>::add_projects_to_hook(&inner, request)
868 .await
869 };
870 Box::pin(fut)
871 }
872 }
873 let accept_compression_encodings = self.accept_compression_encodings;
874 let send_compression_encodings = self.send_compression_encodings;
875 let max_decoding_message_size = self.max_decoding_message_size;
876 let max_encoding_message_size = self.max_encoding_message_size;
877 let inner = self.inner.clone();
878 let fut = async move {
879 let inner = inner.0;
880 let method = AddProjectsToHookSvc(inner);
881 let codec = tonic::codec::ProstCodec::default();
882 let mut grpc = tonic::server::Grpc::new(codec)
883 .apply_compression_config(
884 accept_compression_encodings,
885 send_compression_encodings,
886 )
887 .apply_max_message_size_config(
888 max_decoding_message_size,
889 max_encoding_message_size,
890 );
891 let res = grpc.unary(method, req).await;
892 Ok(res)
893 };
894 Box::pin(fut)
895 }
896 "/aruna.api.hooks.services.v2.HooksService/ListProjectHooks" => {
897 #[allow(non_camel_case_types)]
898 struct ListProjectHooksSvc<T: HooksService>(pub Arc<T>);
899 impl<
900 T: HooksService,
901 > tonic::server::UnaryService<super::ListProjectHooksRequest>
902 for ListProjectHooksSvc<T> {
903 type Response = super::ListProjectHooksResponse;
904 type Future = BoxFuture<
905 tonic::Response<Self::Response>,
906 tonic::Status,
907 >;
908 fn call(
909 &mut self,
910 request: tonic::Request<super::ListProjectHooksRequest>,
911 ) -> Self::Future {
912 let inner = Arc::clone(&self.0);
913 let fut = async move {
914 <T as HooksService>::list_project_hooks(&inner, request)
915 .await
916 };
917 Box::pin(fut)
918 }
919 }
920 let accept_compression_encodings = self.accept_compression_encodings;
921 let send_compression_encodings = self.send_compression_encodings;
922 let max_decoding_message_size = self.max_decoding_message_size;
923 let max_encoding_message_size = self.max_encoding_message_size;
924 let inner = self.inner.clone();
925 let fut = async move {
926 let inner = inner.0;
927 let method = ListProjectHooksSvc(inner);
928 let codec = tonic::codec::ProstCodec::default();
929 let mut grpc = tonic::server::Grpc::new(codec)
930 .apply_compression_config(
931 accept_compression_encodings,
932 send_compression_encodings,
933 )
934 .apply_max_message_size_config(
935 max_decoding_message_size,
936 max_encoding_message_size,
937 );
938 let res = grpc.unary(method, req).await;
939 Ok(res)
940 };
941 Box::pin(fut)
942 }
943 "/aruna.api.hooks.services.v2.HooksService/ListOwnedHooks" => {
944 #[allow(non_camel_case_types)]
945 struct ListOwnedHooksSvc<T: HooksService>(pub Arc<T>);
946 impl<
947 T: HooksService,
948 > tonic::server::UnaryService<super::ListOwnedHooksRequest>
949 for ListOwnedHooksSvc<T> {
950 type Response = super::ListOwnedHooksResponse;
951 type Future = BoxFuture<
952 tonic::Response<Self::Response>,
953 tonic::Status,
954 >;
955 fn call(
956 &mut self,
957 request: tonic::Request<super::ListOwnedHooksRequest>,
958 ) -> Self::Future {
959 let inner = Arc::clone(&self.0);
960 let fut = async move {
961 <T as HooksService>::list_owned_hooks(&inner, request).await
962 };
963 Box::pin(fut)
964 }
965 }
966 let accept_compression_encodings = self.accept_compression_encodings;
967 let send_compression_encodings = self.send_compression_encodings;
968 let max_decoding_message_size = self.max_decoding_message_size;
969 let max_encoding_message_size = self.max_encoding_message_size;
970 let inner = self.inner.clone();
971 let fut = async move {
972 let inner = inner.0;
973 let method = ListOwnedHooksSvc(inner);
974 let codec = tonic::codec::ProstCodec::default();
975 let mut grpc = tonic::server::Grpc::new(codec)
976 .apply_compression_config(
977 accept_compression_encodings,
978 send_compression_encodings,
979 )
980 .apply_max_message_size_config(
981 max_decoding_message_size,
982 max_encoding_message_size,
983 );
984 let res = grpc.unary(method, req).await;
985 Ok(res)
986 };
987 Box::pin(fut)
988 }
989 "/aruna.api.hooks.services.v2.HooksService/DeleteHook" => {
990 #[allow(non_camel_case_types)]
991 struct DeleteHookSvc<T: HooksService>(pub Arc<T>);
992 impl<
993 T: HooksService,
994 > tonic::server::UnaryService<super::DeleteHookRequest>
995 for DeleteHookSvc<T> {
996 type Response = super::DeleteHookResponse;
997 type Future = BoxFuture<
998 tonic::Response<Self::Response>,
999 tonic::Status,
1000 >;
1001 fn call(
1002 &mut self,
1003 request: tonic::Request<super::DeleteHookRequest>,
1004 ) -> Self::Future {
1005 let inner = Arc::clone(&self.0);
1006 let fut = async move {
1007 <T as HooksService>::delete_hook(&inner, request).await
1008 };
1009 Box::pin(fut)
1010 }
1011 }
1012 let accept_compression_encodings = self.accept_compression_encodings;
1013 let send_compression_encodings = self.send_compression_encodings;
1014 let max_decoding_message_size = self.max_decoding_message_size;
1015 let max_encoding_message_size = self.max_encoding_message_size;
1016 let inner = self.inner.clone();
1017 let fut = async move {
1018 let inner = inner.0;
1019 let method = DeleteHookSvc(inner);
1020 let codec = tonic::codec::ProstCodec::default();
1021 let mut grpc = tonic::server::Grpc::new(codec)
1022 .apply_compression_config(
1023 accept_compression_encodings,
1024 send_compression_encodings,
1025 )
1026 .apply_max_message_size_config(
1027 max_decoding_message_size,
1028 max_encoding_message_size,
1029 );
1030 let res = grpc.unary(method, req).await;
1031 Ok(res)
1032 };
1033 Box::pin(fut)
1034 }
1035 "/aruna.api.hooks.services.v2.HooksService/HookCallback" => {
1036 #[allow(non_camel_case_types)]
1037 struct HookCallbackSvc<T: HooksService>(pub Arc<T>);
1038 impl<
1039 T: HooksService,
1040 > tonic::server::UnaryService<super::HookCallbackRequest>
1041 for HookCallbackSvc<T> {
1042 type Response = super::HookCallbackResponse;
1043 type Future = BoxFuture<
1044 tonic::Response<Self::Response>,
1045 tonic::Status,
1046 >;
1047 fn call(
1048 &mut self,
1049 request: tonic::Request<super::HookCallbackRequest>,
1050 ) -> Self::Future {
1051 let inner = Arc::clone(&self.0);
1052 let fut = async move {
1053 <T as HooksService>::hook_callback(&inner, request).await
1054 };
1055 Box::pin(fut)
1056 }
1057 }
1058 let accept_compression_encodings = self.accept_compression_encodings;
1059 let send_compression_encodings = self.send_compression_encodings;
1060 let max_decoding_message_size = self.max_decoding_message_size;
1061 let max_encoding_message_size = self.max_encoding_message_size;
1062 let inner = self.inner.clone();
1063 let fut = async move {
1064 let inner = inner.0;
1065 let method = HookCallbackSvc(inner);
1066 let codec = tonic::codec::ProstCodec::default();
1067 let mut grpc = tonic::server::Grpc::new(codec)
1068 .apply_compression_config(
1069 accept_compression_encodings,
1070 send_compression_encodings,
1071 )
1072 .apply_max_message_size_config(
1073 max_decoding_message_size,
1074 max_encoding_message_size,
1075 );
1076 let res = grpc.unary(method, req).await;
1077 Ok(res)
1078 };
1079 Box::pin(fut)
1080 }
1081 _ => {
1082 Box::pin(async move {
1083 Ok(
1084 http::Response::builder()
1085 .status(200)
1086 .header("grpc-status", "12")
1087 .header("content-type", "application/grpc")
1088 .body(empty_body())
1089 .unwrap(),
1090 )
1091 })
1092 }
1093 }
1094 }
1095 }
1096 impl<T: HooksService> Clone for HooksServiceServer<T> {
1097 fn clone(&self) -> Self {
1098 let inner = self.inner.clone();
1099 Self {
1100 inner,
1101 accept_compression_encodings: self.accept_compression_encodings,
1102 send_compression_encodings: self.send_compression_encodings,
1103 max_decoding_message_size: self.max_decoding_message_size,
1104 max_encoding_message_size: self.max_encoding_message_size,
1105 }
1106 }
1107 }
1108 impl<T: HooksService> Clone for _Inner<T> {
1109 fn clone(&self) -> Self {
1110 Self(Arc::clone(&self.0))
1111 }
1112 }
1113 impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
1114 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1115 write!(f, "{:?}", self.0)
1116 }
1117 }
1118 impl<T: HooksService> tonic::server::NamedService for HooksServiceServer<T> {
1119 const NAME: &'static str = "aruna.api.hooks.services.v2.HooksService";
1120 }
1121}