#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MultipartUpload {
#[prost(string, tag = "1")]
pub upload_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub object_key: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub file_name: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub content_type: ::prost::alloc::string::String,
#[prost(string, optional, tag = "5")]
pub workspace_rid: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "6")]
pub target_resource_rid: ::core::option::Option<::prost::alloc::string::String>,
#[prost(enumeration = "UploadDestination", tag = "7")]
pub destination: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UploadPart {
#[prost(int32, tag = "1")]
pub part_number: i32,
#[prost(string, tag = "2")]
pub etag: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub size_bytes: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UploadPartUrl {
#[prost(string, tag = "1")]
pub url: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub expires_in_seconds: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DownloadUrl {
#[prost(string, tag = "1")]
pub source_path: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub url: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub expire_time: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateMultipartUploadRequest {
#[prost(message, optional, tag = "1")]
pub multipart_upload: ::core::option::Option<MultipartUpload>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateMultipartUploadResponse {
#[prost(message, optional, tag = "1")]
pub multipart_upload: ::core::option::Option<MultipartUpload>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListUploadPartsRequest {
#[prost(string, tag = "1")]
pub upload_id: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListUploadPartsResponse {
#[prost(message, repeated, tag = "1")]
pub parts: ::prost::alloc::vec::Vec<UploadPart>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateUploadPartUrlRequest {
#[prost(string, tag = "1")]
pub upload_id: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub part_number: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateUploadPartUrlResponse {
#[prost(message, optional, tag = "1")]
pub upload_part_url: ::core::option::Option<UploadPartUrl>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompleteMultipartUploadRequest {
#[prost(string, tag = "1")]
pub upload_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub parts: ::prost::alloc::vec::Vec<UploadPart>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompleteMultipartUploadResponse {
#[prost(string, tag = "1")]
pub object_path: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteMultipartUploadRequest {
#[prost(string, tag = "1")]
pub upload_id: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DeleteMultipartUploadResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateDownloadUrlRequest {
#[prost(message, optional, tag = "1")]
pub download_url: ::core::option::Option<DownloadUrl>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateDownloadUrlResponse {
#[prost(message, optional, tag = "1")]
pub download_url: ::core::option::Option<DownloadUrl>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UploadFileMetadata {
#[prost(string, tag = "1")]
pub file_name: ::prost::alloc::string::String,
#[prost(int64, optional, tag = "2")]
pub size_bytes: ::core::option::Option<i64>,
#[prost(string, optional, tag = "3")]
pub workspace_rid: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UploadedFile {
#[prost(string, tag = "1")]
pub object_path: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UploadFileRequest {
#[prost(oneof = "upload_file_request::Content", tags = "1, 2")]
pub content: ::core::option::Option<upload_file_request::Content>,
}
pub mod upload_file_request {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Content {
#[prost(message, tag = "1")]
Metadata(super::UploadFileMetadata),
#[prost(bytes, tag = "2")]
Data(::prost::alloc::vec::Vec<u8>),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UploadFileResponse {
#[prost(message, optional, tag = "1")]
pub file: ::core::option::Option<UploadedFile>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum UploadError {
Unspecified = 0,
InvalidPageToken = 1,
InvalidUploadId = 2,
InvalidUploadStream = 3,
UploadSizeMismatch = 4,
UploadStreamIdle = 5,
TooManyActiveUploads = 6,
}
impl UploadError {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "UPLOAD_ERROR_UNSPECIFIED",
Self::InvalidPageToken => "UPLOAD_ERROR_INVALID_PAGE_TOKEN",
Self::InvalidUploadId => "UPLOAD_ERROR_INVALID_UPLOAD_ID",
Self::InvalidUploadStream => "UPLOAD_ERROR_INVALID_UPLOAD_STREAM",
Self::UploadSizeMismatch => "UPLOAD_ERROR_UPLOAD_SIZE_MISMATCH",
Self::UploadStreamIdle => "UPLOAD_ERROR_UPLOAD_STREAM_IDLE",
Self::TooManyActiveUploads => "UPLOAD_ERROR_TOO_MANY_ACTIVE_UPLOADS",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UPLOAD_ERROR_UNSPECIFIED" => Some(Self::Unspecified),
"UPLOAD_ERROR_INVALID_PAGE_TOKEN" => Some(Self::InvalidPageToken),
"UPLOAD_ERROR_INVALID_UPLOAD_ID" => Some(Self::InvalidUploadId),
"UPLOAD_ERROR_INVALID_UPLOAD_STREAM" => Some(Self::InvalidUploadStream),
"UPLOAD_ERROR_UPLOAD_SIZE_MISMATCH" => Some(Self::UploadSizeMismatch),
"UPLOAD_ERROR_UPLOAD_STREAM_IDLE" => Some(Self::UploadStreamIdle),
"UPLOAD_ERROR_TOO_MANY_ACTIVE_UPLOADS" => Some(Self::TooManyActiveUploads),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum UploadDestination {
Unspecified = 0,
StandaloneObject = 1,
FileStore = 2,
}
impl UploadDestination {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "UPLOAD_DESTINATION_UNSPECIFIED",
Self::StandaloneObject => "UPLOAD_DESTINATION_STANDALONE_OBJECT",
Self::FileStore => "UPLOAD_DESTINATION_FILE_STORE",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UPLOAD_DESTINATION_UNSPECIFIED" => Some(Self::Unspecified),
"UPLOAD_DESTINATION_STANDALONE_OBJECT" => Some(Self::StandaloneObject),
"UPLOAD_DESTINATION_FILE_STORE" => Some(Self::FileStore),
_ => None,
}
}
}
pub mod upload_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct UploadServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl UploadServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> UploadServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> UploadServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
UploadServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn upload_file(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::UploadFileRequest>,
) -> std::result::Result<
tonic::Response<super::UploadFileResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.uploads.v1.UploadService/UploadFile",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new("nominal.uploads.v1.UploadService", "UploadFile"),
);
self.inner.client_streaming(req, path, codec).await
}
pub async fn create_multipart_upload(
&mut self,
request: impl tonic::IntoRequest<super::CreateMultipartUploadRequest>,
) -> std::result::Result<
tonic::Response<super::CreateMultipartUploadResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.uploads.v1.UploadService/CreateMultipartUpload",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.uploads.v1.UploadService",
"CreateMultipartUpload",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn list_upload_parts(
&mut self,
request: impl tonic::IntoRequest<super::ListUploadPartsRequest>,
) -> std::result::Result<
tonic::Response<super::ListUploadPartsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.uploads.v1.UploadService/ListUploadParts",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.uploads.v1.UploadService",
"ListUploadParts",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn create_upload_part_url(
&mut self,
request: impl tonic::IntoRequest<super::CreateUploadPartUrlRequest>,
) -> std::result::Result<
tonic::Response<super::CreateUploadPartUrlResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.uploads.v1.UploadService/CreateUploadPartUrl",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.uploads.v1.UploadService",
"CreateUploadPartUrl",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn complete_multipart_upload(
&mut self,
request: impl tonic::IntoRequest<super::CompleteMultipartUploadRequest>,
) -> std::result::Result<
tonic::Response<super::CompleteMultipartUploadResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.uploads.v1.UploadService/CompleteMultipartUpload",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.uploads.v1.UploadService",
"CompleteMultipartUpload",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn delete_multipart_upload(
&mut self,
request: impl tonic::IntoRequest<super::DeleteMultipartUploadRequest>,
) -> std::result::Result<
tonic::Response<super::DeleteMultipartUploadResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.uploads.v1.UploadService/DeleteMultipartUpload",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.uploads.v1.UploadService",
"DeleteMultipartUpload",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn create_download_url(
&mut self,
request: impl tonic::IntoRequest<super::CreateDownloadUrlRequest>,
) -> std::result::Result<
tonic::Response<super::CreateDownloadUrlResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.uploads.v1.UploadService/CreateDownloadUrl",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.uploads.v1.UploadService",
"CreateDownloadUrl",
),
);
self.inner.unary(req, path, codec).await
}
}
}