1#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct ResourceIdentifier {
5 #[prost(string, tag = "1")]
6 pub rid: ::prost::alloc::string::String,
7}
8#[derive(Clone, PartialEq, ::prost::Message)]
13pub struct UploadBlobStreamRequest {
14 #[prost(message, optional, tag = "1")]
15 pub owning_rid: ::core::option::Option<ResourceIdentifier>,
16 #[prost(string, tag = "2")]
17 pub file_name: ::prost::alloc::string::String,
18 #[prost(bool, tag = "3")]
21 pub ensure_unique: bool,
22 #[prost(bytes = "vec", tag = "4")]
23 pub content: ::prost::alloc::vec::Vec<u8>,
24}
25#[derive(Clone, PartialEq, ::prost::Message)]
26pub struct UploadBlobStreamResponse {
27 #[prost(string, tag = "1")]
31 pub file_name: ::prost::alloc::string::String,
32}
33#[derive(Clone, PartialEq, ::prost::Message)]
34pub struct GetSignedUrlForBlobRequest {
35 #[prost(message, optional, tag = "1")]
36 pub owning_rid: ::core::option::Option<ResourceIdentifier>,
37 #[prost(string, tag = "2")]
38 pub file_name: ::prost::alloc::string::String,
39}
40#[derive(Clone, PartialEq, ::prost::Message)]
41pub struct GetSignedUrlForBlobResponse {
42 #[prost(string, tag = "1")]
45 pub url: ::prost::alloc::string::String,
46}
47pub mod blob_storage_service_client {
49 #![allow(
50 unused_variables,
51 dead_code,
52 missing_docs,
53 clippy::wildcard_imports,
54 clippy::let_unit_value,
55 )]
56 use tonic::codegen::*;
57 use tonic::codegen::http::Uri;
58 #[derive(Debug, Clone)]
60 pub struct BlobStorageServiceClient<T> {
61 inner: tonic::client::Grpc<T>,
62 }
63 impl BlobStorageServiceClient<tonic::transport::Channel> {
64 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
66 where
67 D: TryInto<tonic::transport::Endpoint>,
68 D::Error: Into<StdError>,
69 {
70 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
71 Ok(Self::new(conn))
72 }
73 }
74 impl<T> BlobStorageServiceClient<T>
75 where
76 T: tonic::client::GrpcService<tonic::body::Body>,
77 T::Error: Into<StdError>,
78 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
79 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
80 {
81 pub fn new(inner: T) -> Self {
82 let inner = tonic::client::Grpc::new(inner);
83 Self { inner }
84 }
85 pub fn with_origin(inner: T, origin: Uri) -> Self {
86 let inner = tonic::client::Grpc::with_origin(inner, origin);
87 Self { inner }
88 }
89 pub fn with_interceptor<F>(
90 inner: T,
91 interceptor: F,
92 ) -> BlobStorageServiceClient<InterceptedService<T, F>>
93 where
94 F: tonic::service::Interceptor,
95 T::ResponseBody: Default,
96 T: tonic::codegen::Service<
97 http::Request<tonic::body::Body>,
98 Response = http::Response<
99 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
100 >,
101 >,
102 <T as tonic::codegen::Service<
103 http::Request<tonic::body::Body>,
104 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
105 {
106 BlobStorageServiceClient::new(InterceptedService::new(inner, interceptor))
107 }
108 #[must_use]
113 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
114 self.inner = self.inner.send_compressed(encoding);
115 self
116 }
117 #[must_use]
119 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
120 self.inner = self.inner.accept_compressed(encoding);
121 self
122 }
123 #[must_use]
127 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
128 self.inner = self.inner.max_decoding_message_size(limit);
129 self
130 }
131 #[must_use]
135 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
136 self.inner = self.inner.max_encoding_message_size(limit);
137 self
138 }
139 pub async fn upload_blob_stream(
142 &mut self,
143 request: impl tonic::IntoStreamingRequest<
144 Message = super::UploadBlobStreamRequest,
145 >,
146 ) -> std::result::Result<
147 tonic::Response<super::UploadBlobStreamResponse>,
148 tonic::Status,
149 > {
150 self.inner
151 .ready()
152 .await
153 .map_err(|e| {
154 tonic::Status::unknown(
155 format!("Service was not ready: {}", e.into()),
156 )
157 })?;
158 let codec = tonic::codec::ProstCodec::default();
159 let path = http::uri::PathAndQuery::from_static(
160 "/nominal.blob_storage_service.v1.BlobStorageService/UploadBlobStream",
161 );
162 let mut req = request.into_streaming_request();
163 req.extensions_mut()
164 .insert(
165 GrpcMethod::new(
166 "nominal.blob_storage_service.v1.BlobStorageService",
167 "UploadBlobStream",
168 ),
169 );
170 self.inner.client_streaming(req, path, codec).await
171 }
172 pub async fn get_signed_url_for_blob(
174 &mut self,
175 request: impl tonic::IntoRequest<super::GetSignedUrlForBlobRequest>,
176 ) -> std::result::Result<
177 tonic::Response<super::GetSignedUrlForBlobResponse>,
178 tonic::Status,
179 > {
180 self.inner
181 .ready()
182 .await
183 .map_err(|e| {
184 tonic::Status::unknown(
185 format!("Service was not ready: {}", e.into()),
186 )
187 })?;
188 let codec = tonic::codec::ProstCodec::default();
189 let path = http::uri::PathAndQuery::from_static(
190 "/nominal.blob_storage_service.v1.BlobStorageService/GetSignedUrlForBlob",
191 );
192 let mut req = request.into_request();
193 req.extensions_mut()
194 .insert(
195 GrpcMethod::new(
196 "nominal.blob_storage_service.v1.BlobStorageService",
197 "GetSignedUrlForBlob",
198 ),
199 );
200 self.inner.unary(req, path, codec).await
201 }
202 }
203}