#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Greeting {
#[prost(string, tag = "1")]
pub message: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Acknowledgement {
#[prost(string, tag = "1")]
pub message: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Empty {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GreeterProjection {
#[prost(bool, tag = "1")]
pub is_recording: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GreetCommand {
#[prost(string, tag = "1")]
pub aggregate_identifier: std::string::String,
#[prost(message, optional, tag = "2")]
pub message: ::std::option::Option<Greeting>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RecordCommand {
#[prost(string, tag = "1")]
pub aggregate_identifier: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StopCommand {
#[prost(string, tag = "1")]
pub aggregate_identifier: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RegisterTrustedKeyCommand {
#[prost(message, optional, tag = "1")]
pub public_key: ::std::option::Option<PublicKey>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RegisterKeyManagerCommand {
#[prost(message, optional, tag = "1")]
pub public_key: ::std::option::Option<PublicKey>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RegisterCredentialsCommand {
#[prost(message, optional, tag = "1")]
pub credentials: ::std::option::Option<Credentials>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChangePropertyCommand {
#[prost(message, optional, tag = "1")]
pub property: ::std::option::Option<KeyValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GreetedEvent {
#[prost(message, optional, tag = "1")]
pub message: ::std::option::Option<Greeting>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StartedRecordingEvent {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StoppedRecordingEvent {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TrustedKeyAddedEvent {
#[prost(message, optional, tag = "1")]
pub public_key: ::std::option::Option<PublicKey>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TrustedKeyRemovedEvent {
#[prost(string, tag = "1")]
pub name: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KeyManagerAddedEvent {
#[prost(message, optional, tag = "1")]
pub public_key: ::std::option::Option<PublicKey>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KeyManagerRemovedEvent {
#[prost(string, tag = "1")]
pub name: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CredentialsAddedEvent {
#[prost(message, optional, tag = "1")]
pub credentials: ::std::option::Option<Credentials>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CredentialsRemovedEvent {
#[prost(string, tag = "1")]
pub identifier: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PropertyChangedEvent {
#[prost(message, optional, tag = "1")]
pub property: ::std::option::Option<KeyValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchQuery {
#[prost(string, tag = "1")]
pub query: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchResponse {
#[prost(message, repeated, tag = "1")]
pub greetings: ::std::vec::Vec<Greeting>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PublicKey {
#[prost(string, tag = "1")]
pub public_key: std::string::String,
#[prost(string, tag = "2")]
pub name: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PrivateKey {
#[prost(string, tag = "1")]
pub private_key: std::string::String,
#[prost(string, tag = "2")]
pub name: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AccessToken {
#[prost(string, tag = "1")]
pub jwt: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TrustedKeyRequest {
#[prost(message, optional, tag = "1")]
pub public_key: ::std::option::Option<PublicKey>,
#[prost(bytes, tag = "2")]
pub nonce: std::vec::Vec<u8>,
#[prost(message, optional, tag = "4")]
pub signature: ::std::option::Option<Signature>,
#[prost(bool, tag = "5")]
pub is_key_manager: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TrustedKeyResponse {
#[prost(message, optional, tag = "1")]
pub status: ::std::option::Option<Status>,
#[prost(bytes, tag = "2")]
pub nonce: std::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Signature {
#[prost(string, tag = "1")]
pub format: std::string::String,
#[prost(bytes, tag = "2")]
pub blob: std::vec::Vec<u8>,
#[prost(bytes, tag = "3")]
pub rest: std::vec::Vec<u8>,
#[prost(string, tag = "4")]
pub signature_name: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Status {
#[prost(int32, tag = "1")]
pub code: i32,
#[prost(string, tag = "2")]
pub message: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Credentials {
#[prost(string, tag = "1")]
pub identifier: std::string::String,
#[prost(string, tag = "2")]
pub secret: std::string::String,
#[prost(message, optional, tag = "3")]
pub signature: ::std::option::Option<Signature>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KeyValue {
#[prost(string, tag = "1")]
pub key: std::string::String,
#[prost(string, tag = "2")]
pub value: std::string::String,
}
#[doc = r" Generated client implementations."]
pub mod greeter_service_client {
#![allow(unused_variables, dead_code, missing_docs)]
use tonic::codegen::*;
#[doc = " The GreeterService defines the gRPC requests for greeting AxonServer. "]
pub struct GreeterServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl GreeterServiceClient<tonic::transport::Channel> {
#[doc = r" Attempt to create a new client by connecting to a given endpoint."]
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> GreeterServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + HttpBody + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as HttpBody>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor(inner: T, interceptor: impl Into<tonic::Interceptor>) -> Self {
let inner = tonic::client::Grpc::with_interceptor(inner, interceptor);
Self { inner }
}
pub async fn greet(
&mut self,
request: impl tonic::IntoRequest<super::Greeting>,
) -> Result<tonic::Response<super::Acknowledgement>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/grpc_example.GreeterService/Greet");
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn record(
&mut self,
request: impl tonic::IntoRequest<super::Empty>,
) -> Result<tonic::Response<super::Empty>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/grpc_example.GreeterService/Record");
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn stop(
&mut self,
request: impl tonic::IntoRequest<super::Empty>,
) -> Result<tonic::Response<super::Empty>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/grpc_example.GreeterService/Stop");
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn greetings(
&mut self,
request: impl tonic::IntoRequest<super::Empty>,
) -> Result<tonic::Response<tonic::codec::Streaming<super::Greeting>>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/grpc_example.GreeterService/Greetings");
self.inner
.server_streaming(request.into_request(), path, codec)
.await
}
pub async fn search(
&mut self,
request: impl tonic::IntoRequest<super::SearchQuery>,
) -> Result<tonic::Response<tonic::codec::Streaming<super::Greeting>>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/grpc_example.GreeterService/Search");
self.inner
.server_streaming(request.into_request(), path, codec)
.await
}
}
impl<T: Clone> Clone for GreeterServiceClient<T> {
fn clone(&self) -> Self {
Self {
inner: self.inner.clone(),
}
}
}
impl<T> std::fmt::Debug for GreeterServiceClient<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "GreeterServiceClient {{ ... }}")
}
}
}
#[doc = r" Generated server implementations."]
pub mod greeter_service_server {
#![allow(unused_variables, dead_code, missing_docs)]
use tonic::codegen::*;
#[doc = "Generated trait containing gRPC methods that should be implemented for use with GreeterServiceServer."]
#[async_trait]
pub trait GreeterService: Send + Sync + 'static {
async fn greet(
&self,
request: tonic::Request<super::Greeting>,
) -> Result<tonic::Response<super::Acknowledgement>, tonic::Status>;
async fn record(
&self,
request: tonic::Request<super::Empty>,
) -> Result<tonic::Response<super::Empty>, tonic::Status>;
async fn stop(
&self,
request: tonic::Request<super::Empty>,
) -> Result<tonic::Response<super::Empty>, tonic::Status>;
#[doc = "Server streaming response type for the Greetings method."]
type GreetingsStream: Stream<Item = Result<super::Greeting, tonic::Status>>
+ Send
+ Sync
+ 'static;
async fn greetings(
&self,
request: tonic::Request<super::Empty>,
) -> Result<tonic::Response<Self::GreetingsStream>, tonic::Status>;
#[doc = "Server streaming response type for the Search method."]
type SearchStream: Stream<Item = Result<super::Greeting, tonic::Status>>
+ Send
+ Sync
+ 'static;
async fn search(
&self,
request: tonic::Request<super::SearchQuery>,
) -> Result<tonic::Response<Self::SearchStream>, tonic::Status>;
}
#[doc = " The GreeterService defines the gRPC requests for greeting AxonServer. "]
#[derive(Debug)]
#[doc(hidden)]
pub struct GreeterServiceServer<T: GreeterService> {
inner: _Inner<T>,
}
struct _Inner<T>(Arc<T>, Option<tonic::Interceptor>);
impl<T: GreeterService> GreeterServiceServer<T> {
pub fn new(inner: T) -> Self {
let inner = Arc::new(inner);
let inner = _Inner(inner, None);
Self { inner }
}
pub fn with_interceptor(inner: T, interceptor: impl Into<tonic::Interceptor>) -> Self {
let inner = Arc::new(inner);
let inner = _Inner(inner, Some(interceptor.into()));
Self { inner }
}
}
impl<T, B> Service<http::Request<B>> for GreeterServiceServer<T>
where
T: GreeterService,
B: HttpBody + Send + Sync + 'static,
B::Error: Into<StdError> + Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = Never;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/grpc_example.GreeterService/Greet" => {
#[allow(non_camel_case_types)]
struct GreetSvc<T: GreeterService>(pub Arc<T>);
impl<T: GreeterService> tonic::server::UnaryService<super::Greeting> for GreetSvc<T> {
type Response = super::Acknowledgement;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::Greeting>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { inner.greet(request).await };
Box::pin(fut)
}
}
let inner = self.inner.clone();
let fut = async move {
let interceptor = inner.1.clone();
let inner = inner.0;
let method = GreetSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = if let Some(interceptor) = interceptor {
tonic::server::Grpc::with_interceptor(codec, interceptor)
} else {
tonic::server::Grpc::new(codec)
};
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/grpc_example.GreeterService/Record" => {
#[allow(non_camel_case_types)]
struct RecordSvc<T: GreeterService>(pub Arc<T>);
impl<T: GreeterService> tonic::server::UnaryService<super::Empty> for RecordSvc<T> {
type Response = super::Empty;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(&mut self, request: tonic::Request<super::Empty>) -> Self::Future {
let inner = self.0.clone();
let fut = async move { inner.record(request).await };
Box::pin(fut)
}
}
let inner = self.inner.clone();
let fut = async move {
let interceptor = inner.1.clone();
let inner = inner.0;
let method = RecordSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = if let Some(interceptor) = interceptor {
tonic::server::Grpc::with_interceptor(codec, interceptor)
} else {
tonic::server::Grpc::new(codec)
};
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/grpc_example.GreeterService/Stop" => {
#[allow(non_camel_case_types)]
struct StopSvc<T: GreeterService>(pub Arc<T>);
impl<T: GreeterService> tonic::server::UnaryService<super::Empty> for StopSvc<T> {
type Response = super::Empty;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(&mut self, request: tonic::Request<super::Empty>) -> Self::Future {
let inner = self.0.clone();
let fut = async move { inner.stop(request).await };
Box::pin(fut)
}
}
let inner = self.inner.clone();
let fut = async move {
let interceptor = inner.1.clone();
let inner = inner.0;
let method = StopSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = if let Some(interceptor) = interceptor {
tonic::server::Grpc::with_interceptor(codec, interceptor)
} else {
tonic::server::Grpc::new(codec)
};
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/grpc_example.GreeterService/Greetings" => {
#[allow(non_camel_case_types)]
struct GreetingsSvc<T: GreeterService>(pub Arc<T>);
impl<T: GreeterService> tonic::server::ServerStreamingService<super::Empty> for GreetingsSvc<T> {
type Response = super::Greeting;
type ResponseStream = T::GreetingsStream;
type Future =
BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
fn call(&mut self, request: tonic::Request<super::Empty>) -> Self::Future {
let inner = self.0.clone();
let fut = async move { inner.greetings(request).await };
Box::pin(fut)
}
}
let inner = self.inner.clone();
let fut = async move {
let interceptor = inner.1;
let inner = inner.0;
let method = GreetingsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = if let Some(interceptor) = interceptor {
tonic::server::Grpc::with_interceptor(codec, interceptor)
} else {
tonic::server::Grpc::new(codec)
};
let res = grpc.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/grpc_example.GreeterService/Search" => {
#[allow(non_camel_case_types)]
struct SearchSvc<T: GreeterService>(pub Arc<T>);
impl<T: GreeterService>
tonic::server::ServerStreamingService<super::SearchQuery> for SearchSvc<T>
{
type Response = super::Greeting;
type ResponseStream = T::SearchStream;
type Future =
BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::SearchQuery>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { inner.search(request).await };
Box::pin(fut)
}
}
let inner = self.inner.clone();
let fut = async move {
let interceptor = inner.1;
let inner = inner.0;
let method = SearchSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = if let Some(interceptor) = interceptor {
tonic::server::Grpc::with_interceptor(codec, interceptor)
} else {
tonic::server::Grpc::new(codec)
};
let res = grpc.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => Box::pin(async move {
Ok(http::Response::builder()
.status(200)
.header("grpc-status", "12")
.body(tonic::body::BoxBody::empty())
.unwrap())
}),
}
}
}
impl<T: GreeterService> Clone for GreeterServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self { inner }
}
}
impl<T: GreeterService> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(self.0.clone(), self.1.clone())
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T: GreeterService> tonic::transport::NamedService for GreeterServiceServer<T> {
const NAME: &'static str = "grpc_example.GreeterService";
}
}