#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StringMatch {
#[prost(oneof = "string_match::Match", tags = "1, 2, 3")]
pub r#match: ::core::option::Option<string_match::Match>,
}
pub mod string_match {
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct InList {
#[prost(string, repeated, tag = "1")]
pub values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum Match {
#[prost(string, tag = "1")]
Equals(::prost::alloc::string::String),
#[prost(string, tag = "2")]
Contains(::prost::alloc::string::String),
#[prost(message, tag = "3")]
In(InList),
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FileFilter {
#[prost(message, optional, tag = "1")]
pub path: ::core::option::Option<StringMatch>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListFilesRequest {
#[prost(string, tag = "1")]
pub store_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub filter: ::core::option::Option<FileFilter>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListFilesResponse {
#[prost(int64, tag = "1")]
pub store_version: i64,
#[prost(string, repeated, tag = "2")]
pub files: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetFilesRequest {
#[prost(string, tag = "1")]
pub store_id: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "2")]
pub files: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct File {
#[prost(string, tag = "1")]
pub path: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "2")]
pub contents: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetFilesResponse {
#[prost(int64, tag = "1")]
pub store_version: i64,
#[prost(message, repeated, tag = "2")]
pub files: ::prost::alloc::vec::Vec<File>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChangeDetails {
#[prost(string, tag = "1")]
pub description: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub uploader: ::core::option::Option<change_details::Uploader>,
#[prost(oneof = "change_details::Origin", tags = "3, 4")]
pub origin: ::core::option::Option<change_details::Origin>,
}
pub mod change_details {
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Git {
#[prost(string, tag = "1")]
pub repo: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub r#ref: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub hash: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub message: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub committer: ::prost::alloc::string::String,
#[prost(message, optional, tag = "6")]
pub commit_date: ::core::option::Option<
super::super::super::super::super::google::protobuf::Timestamp,
>,
#[prost(string, tag = "7")]
pub author: ::prost::alloc::string::String,
#[prost(message, optional, tag = "8")]
pub author_date: ::core::option::Option<
super::super::super::super::super::google::protobuf::Timestamp,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Internal {
#[prost(string, tag = "1")]
pub source: ::prost::alloc::string::String,
#[prost(map = "string, message", tag = "2")]
pub metadata: ::std::collections::HashMap<
::prost::alloc::string::String,
super::super::super::super::super::google::protobuf::Value,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Uploader {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(map = "string, message", tag = "2")]
pub metadata: ::std::collections::HashMap<
::prost::alloc::string::String,
super::super::super::super::super::google::protobuf::Value,
>,
}
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Origin {
#[prost(message, tag = "3")]
Git(Git),
#[prost(message, tag = "4")]
Internal(Internal),
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FileOp {
#[prost(oneof = "file_op::Op", tags = "1, 2")]
pub op: ::core::option::Option<file_op::Op>,
}
pub mod file_op {
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum Op {
#[prost(message, tag = "1")]
AddOrUpdate(super::File),
#[prost(string, tag = "2")]
Delete(::prost::alloc::string::String),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModifyFilesRequest {
#[prost(string, tag = "1")]
pub store_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub condition: ::core::option::Option<modify_files_request::Condition>,
#[prost(message, repeated, tag = "3")]
pub operations: ::prost::alloc::vec::Vec<FileOp>,
#[prost(message, optional, tag = "4")]
pub change_details: ::core::option::Option<ChangeDetails>,
}
pub mod modify_files_request {
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Condition {
#[prost(int64, tag = "1")]
pub store_version_must_equal: i64,
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FileError {
#[prost(string, tag = "1")]
pub file: ::prost::alloc::string::String,
#[prost(enumeration = "file_error::Cause", tag = "2")]
pub cause: i32,
#[prost(string, tag = "3")]
pub details: ::prost::alloc::string::String,
}
pub mod file_error {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Cause {
Unspecified = 0,
InvalidFilePath = 1,
UnsupportedFileExtension = 2,
InvalidFileContents = 3,
DuplicateFilePath = 4,
FileTooLarge = 5,
}
impl Cause {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "CAUSE_UNSPECIFIED",
Self::InvalidFilePath => "CAUSE_INVALID_FILE_PATH",
Self::UnsupportedFileExtension => "CAUSE_UNSUPPORTED_FILE_EXTENSION",
Self::InvalidFileContents => "CAUSE_INVALID_FILE_CONTENTS",
Self::DuplicateFilePath => "CAUSE_DUPLICATE_FILE_PATH",
Self::FileTooLarge => "CAUSE_FILE_TOO_LARGE",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CAUSE_UNSPECIFIED" => Some(Self::Unspecified),
"CAUSE_INVALID_FILE_PATH" => Some(Self::InvalidFilePath),
"CAUSE_UNSUPPORTED_FILE_EXTENSION" => {
Some(Self::UnsupportedFileExtension)
}
"CAUSE_INVALID_FILE_CONTENTS" => Some(Self::InvalidFileContents),
"CAUSE_DUPLICATE_FILE_PATH" => Some(Self::DuplicateFilePath),
"CAUSE_FILE_TOO_LARGE" => Some(Self::FileTooLarge),
_ => None,
}
}
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ModifyFilesResponse {
#[prost(int64, tag = "1")]
pub new_store_version: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReplaceFilesRequest {
#[prost(string, tag = "1")]
pub store_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub condition: ::core::option::Option<replace_files_request::Condition>,
#[prost(message, optional, tag = "4")]
pub change_details: ::core::option::Option<ChangeDetails>,
#[prost(oneof = "replace_files_request::Contents", tags = "3, 5")]
pub contents: ::core::option::Option<replace_files_request::Contents>,
}
pub mod replace_files_request {
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Condition {
#[prost(int64, tag = "1")]
pub store_version_must_equal: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Files {
#[prost(message, repeated, tag = "1")]
pub files: ::prost::alloc::vec::Vec<super::File>,
}
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Contents {
#[prost(bytes, tag = "3")]
ZippedContents(::prost::alloc::vec::Vec<u8>),
#[prost(message, tag = "5")]
Files(Files),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ErrDetailValidationFailure {
#[prost(message, repeated, tag = "1")]
pub errors: ::prost::alloc::vec::Vec<FileError>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ErrDetailNoUsableFiles {
#[prost(string, repeated, tag = "1")]
pub ignored_files: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ErrDetailConditionUnsatisfied {
#[prost(int64, tag = "1")]
pub current_store_version: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ErrDetailOperationDiscarded {
#[prost(int64, tag = "1")]
pub current_store_version: i64,
#[prost(string, repeated, tag = "2")]
pub ignored_files: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ErrDetailCannotModifyGitConnectedStore {}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReplaceFilesResponse {
#[prost(int64, tag = "1")]
pub new_store_version: i64,
#[prost(string, repeated, tag = "2")]
pub ignored_files: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
pub mod cerbos_store_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 CerbosStoreServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl CerbosStoreServiceClient<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> CerbosStoreServiceClient<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,
) -> CerbosStoreServiceClient<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,
{
CerbosStoreServiceClient::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 list_files(
&mut self,
request: impl tonic::IntoRequest<super::ListFilesRequest>,
) -> std::result::Result<
tonic::Response<super::ListFilesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/cerbos.cloud.store.v1.CerbosStoreService/ListFiles",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cerbos.cloud.store.v1.CerbosStoreService",
"ListFiles",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_files(
&mut self,
request: impl tonic::IntoRequest<super::GetFilesRequest>,
) -> std::result::Result<
tonic::Response<super::GetFilesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/cerbos.cloud.store.v1.CerbosStoreService/GetFiles",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cerbos.cloud.store.v1.CerbosStoreService",
"GetFiles",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn modify_files(
&mut self,
request: impl tonic::IntoRequest<super::ModifyFilesRequest>,
) -> std::result::Result<
tonic::Response<super::ModifyFilesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/cerbos.cloud.store.v1.CerbosStoreService/ModifyFiles",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cerbos.cloud.store.v1.CerbosStoreService",
"ModifyFiles",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn replace_files(
&mut self,
request: impl tonic::IntoRequest<super::ReplaceFilesRequest>,
) -> std::result::Result<
tonic::Response<super::ReplaceFilesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/cerbos.cloud.store.v1.CerbosStoreService/ReplaceFiles",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cerbos.cloud.store.v1.CerbosStoreService",
"ReplaceFiles",
),
);
self.inner.unary(req, path, codec).await
}
}
}