From 94b575a5d86274bdbcc5989e26420dacda89c0b2 Mon Sep 17 00:00:00 2001 From: Paul Masurel Date: Mon, 4 Nov 2024 11:06:57 +0900 Subject: [PATCH] renamed to authorization --- quickwit/Cargo.lock | 10 +- quickwit/Cargo.toml | 6 +- .../Cargo.toml | 2 +- .../src/authorization_layer.rs | 0 .../src/community.rs | 0 .../src/enterprise.rs | 0 .../src/lib.rs | 0 quickwit/quickwit-codegen/example/Cargo.toml | 4 +- .../example/src/authorization.rs | 10 +- .../example/src/codegen/hello.rs | 22 +- .../quickwit-codegen/example/src/error.rs | 2 +- quickwit/quickwit-codegen/src/codegen.rs | 8 +- quickwit/quickwit-ingest/Cargo.toml | 4 +- quickwit/quickwit-ingest/src/authorize.rs | 2 +- .../src/codegen/ingest_service.rs | 24 +- quickwit/quickwit-ingest/src/error.rs | 2 +- quickwit/quickwit-metastore/Cargo.toml | 2 +- quickwit/quickwit-metastore/src/error.rs | 2 +- quickwit/quickwit-proto/Cargo.toml | 4 +- quickwit/quickwit-proto/src/authorization.rs | 2 +- quickwit/quickwit-proto/src/cluster/mod.rs | 2 +- .../src/codegen/quickwit/quickwit.cluster.rs | 8 +- .../quickwit/quickwit.control_plane.rs | 72 ++++-- .../codegen/quickwit/quickwit.developer.rs | 8 +- .../src/codegen/quickwit/quickwit.indexing.rs | 8 +- .../quickwit/quickwit.ingest.ingester.rs | 70 +++-- .../quickwit/quickwit.ingest.router.rs | 8 +- .../codegen/quickwit/quickwit.metastore.rs | 240 +++++++++++------- .../quickwit-proto/src/control_plane/mod.rs | 2 +- quickwit/quickwit-proto/src/developer/mod.rs | 2 +- quickwit/quickwit-proto/src/error.rs | 2 +- quickwit/quickwit-proto/src/indexing/mod.rs | 2 +- quickwit/quickwit-proto/src/ingest/mod.rs | 2 +- quickwit/quickwit-proto/src/metastore/mod.rs | 2 +- 34 files changed, 323 insertions(+), 211 deletions(-) rename quickwit/{quickwit-auth => quickwit-authorize}/Cargo.toml (95%) rename quickwit/{quickwit-auth => quickwit-authorize}/src/authorization_layer.rs (100%) rename quickwit/{quickwit-auth => quickwit-authorize}/src/community.rs (100%) rename quickwit/{quickwit-auth => quickwit-authorize}/src/enterprise.rs (100%) rename quickwit/{quickwit-auth => quickwit-authorize}/src/lib.rs (100%) diff --git a/quickwit/Cargo.lock b/quickwit/Cargo.lock index 5521cdc4ebf..905e999110a 100644 --- a/quickwit/Cargo.lock +++ b/quickwit/Cargo.lock @@ -5948,7 +5948,7 @@ dependencies = [ ] [[package]] -name = "quickwit-auth" +name = "quickwit-authorize" version = "0.8.0" dependencies = [ "biscuit-auth", @@ -6089,7 +6089,7 @@ dependencies = [ "mockall", "prost 0.11.9", "quickwit-actors", - "quickwit-auth", + "quickwit-authorize", "quickwit-codegen", "quickwit-common", "quickwit-proto", @@ -6368,7 +6368,7 @@ dependencies = [ "once_cell", "prost 0.11.9", "quickwit-actors", - "quickwit-auth", + "quickwit-authorize", "quickwit-cluster", "quickwit-codegen", "quickwit-common", @@ -6563,7 +6563,7 @@ dependencies = [ "mockall", "once_cell", "ouroboros", - "quickwit-auth", + "quickwit-authorize", "quickwit-common", "quickwit-config", "quickwit-doc-mapper", @@ -6633,7 +6633,7 @@ dependencies = [ "prost-build", "prost-types 0.11.9", "quickwit-actors", - "quickwit-auth", + "quickwit-authorize", "quickwit-codegen", "quickwit-common", "sea-query", diff --git a/quickwit/Cargo.toml b/quickwit/Cargo.toml index 12bdd18eae4..c8878d3c515 100644 --- a/quickwit/Cargo.toml +++ b/quickwit/Cargo.toml @@ -2,7 +2,7 @@ resolver = "2" members = [ "quickwit-actors", - "quickwit-auth", + "quickwit-authorize", "quickwit-aws", "quickwit-cli", "quickwit-cluster", @@ -42,7 +42,7 @@ members = [ # from the default member to ease build/deps. default-members = [ "quickwit-actors", - "quickwit-auth", + "quickwit-authorize", "quickwit-aws", "quickwit-cli", "quickwit-cluster", @@ -305,7 +305,7 @@ opendal = { version = "0.44", default-features = false } reqsign = { version = "0.14", default-features = false } quickwit-actors = { path = "quickwit-actors" } -quickwit-auth = { path = "quickwit-auth" } +quickwit-authorize = { path = "quickwit-authorize" } quickwit-aws = { path = "quickwit-aws" } quickwit-cli = { path = "quickwit-cli" } quickwit-cluster = { path = "quickwit-cluster" } diff --git a/quickwit/quickwit-auth/Cargo.toml b/quickwit/quickwit-authorize/Cargo.toml similarity index 95% rename from quickwit/quickwit-auth/Cargo.toml rename to quickwit/quickwit-authorize/Cargo.toml index 3ffdef60696..4c3985fcff3 100644 --- a/quickwit/quickwit-auth/Cargo.toml +++ b/quickwit/quickwit-authorize/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "quickwit-auth" +name = "quickwit-authorize" version.workspace = true edition.workspace = true homepage.workspace = true diff --git a/quickwit/quickwit-auth/src/authorization_layer.rs b/quickwit/quickwit-authorize/src/authorization_layer.rs similarity index 100% rename from quickwit/quickwit-auth/src/authorization_layer.rs rename to quickwit/quickwit-authorize/src/authorization_layer.rs diff --git a/quickwit/quickwit-auth/src/community.rs b/quickwit/quickwit-authorize/src/community.rs similarity index 100% rename from quickwit/quickwit-auth/src/community.rs rename to quickwit/quickwit-authorize/src/community.rs diff --git a/quickwit/quickwit-auth/src/enterprise.rs b/quickwit/quickwit-authorize/src/enterprise.rs similarity index 100% rename from quickwit/quickwit-auth/src/enterprise.rs rename to quickwit/quickwit-authorize/src/enterprise.rs diff --git a/quickwit/quickwit-auth/src/lib.rs b/quickwit/quickwit-authorize/src/lib.rs similarity index 100% rename from quickwit/quickwit-auth/src/lib.rs rename to quickwit/quickwit-authorize/src/lib.rs diff --git a/quickwit/quickwit-codegen/example/Cargo.toml b/quickwit/quickwit-codegen/example/Cargo.toml index f678d0cadc2..b51d7456b5d 100644 --- a/quickwit/quickwit-codegen/example/Cargo.toml +++ b/quickwit/quickwit-codegen/example/Cargo.toml @@ -27,7 +27,7 @@ tower = { workspace = true } utoipa = { workspace = true } quickwit-actors = { workspace = true } -quickwit-auth = { workspace = true } +quickwit-authorize = { workspace = true } quickwit-common = { workspace = true } quickwit-proto = { workspace = true } @@ -41,4 +41,4 @@ quickwit-codegen = { workspace = true } [features] testsuite = ["mockall"] -enterprise = [ "quickwit-auth/enterprise" ] +enterprise = [ "quickwit-authorize/enterprise" ] diff --git a/quickwit/quickwit-codegen/example/src/authorization.rs b/quickwit/quickwit-codegen/example/src/authorization.rs index b58c6bea026..509fed82f0f 100644 --- a/quickwit/quickwit-codegen/example/src/authorization.rs +++ b/quickwit/quickwit-codegen/example/src/authorization.rs @@ -15,15 +15,15 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -use quickwit_auth::{Authorization, AuthorizationError, AuthorizationToken, StreamAuthorization}; +use quickwit_authorize::{Authorization, AuthorizationError, AuthorizationToken, StreamAuthorization}; use crate::{GoodbyeRequest, HelloRequest, PingRequest}; impl Authorization for HelloRequest { fn attenuate( &self, - auth_token: quickwit_auth::AuthorizationToken, - ) -> Result { + auth_token: AuthorizationToken, + ) -> Result { Ok(auth_token) } } @@ -31,7 +31,7 @@ impl Authorization for HelloRequest { impl Authorization for GoodbyeRequest { fn attenuate( &self, - auth_token: quickwit_auth::AuthorizationToken, + auth_token: AuthorizationToken, ) -> Result { Ok(auth_token) } @@ -39,7 +39,7 @@ impl Authorization for GoodbyeRequest { impl StreamAuthorization for PingRequest { fn attenuate( - auth_token: quickwit_auth::AuthorizationToken, + auth_token: AuthorizationToken, ) -> Result { Ok(auth_token) } diff --git a/quickwit/quickwit-codegen/example/src/codegen/hello.rs b/quickwit/quickwit-codegen/example/src/codegen/hello.rs index c12d635e581..4eb3a2dc8c7 100644 --- a/quickwit/quickwit-codegen/example/src/codegen/hello.rs +++ b/quickwit/quickwit-codegen/example/src/codegen/hello.rs @@ -723,7 +723,9 @@ where T::Future: Send, { async fn hello(&self, request: HelloRequest) -> crate::HelloResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .hello(tonic_request) @@ -738,7 +740,9 @@ where &self, request: GoodbyeRequest, ) -> crate::HelloResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .goodbye(tonic_request) @@ -753,7 +757,7 @@ where &self, request: quickwit_common::ServiceStream, ) -> crate::HelloResult> { - let tonic_request = quickwit_auth::build_tonic_stream_request_with_auth_token( + let tonic_request = quickwit_authorize::build_tonic_stream_request_with_auth_token( request, )?; self.inner @@ -810,8 +814,8 @@ impl hello_grpc_server::HelloGrpc for HelloGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.hello(request.into_inner()), ) @@ -823,8 +827,8 @@ impl hello_grpc_server::HelloGrpc for HelloGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.goodbye(request.into_inner()), ) @@ -837,8 +841,8 @@ impl hello_grpc_server::HelloGrpc for HelloGrpcServerAdapter { &self, request: tonic::Request>, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self .inner diff --git a/quickwit/quickwit-codegen/example/src/error.rs b/quickwit/quickwit-codegen/example/src/error.rs index 9d3a9dbde19..ec67efb3250 100644 --- a/quickwit/quickwit-codegen/example/src/error.rs +++ b/quickwit/quickwit-codegen/example/src/error.rs @@ -20,7 +20,7 @@ use std::fmt; use quickwit_actors::AskError; -use quickwit_auth::AuthorizationError; +use quickwit_authorize::AuthorizationError; use quickwit_proto::error::GrpcServiceError; pub use quickwit_proto::error::{grpc_error_to_grpc_status, grpc_status_to_service_error}; use quickwit_proto::{ServiceError, ServiceErrorCode}; diff --git a/quickwit/quickwit-codegen/src/codegen.rs b/quickwit/quickwit-codegen/src/codegen.rs index 361cd21189b..4143cafd15b 100644 --- a/quickwit/quickwit-codegen/src/codegen.rs +++ b/quickwit/quickwit-codegen/src/codegen.rs @@ -1170,7 +1170,7 @@ fn generate_grpc_client_adapter_methods(context: &CodegenContext) -> TokenStream let method = if syn_method.client_streaming { quote! { async fn #method_name(&self, request: #request_type) -> #result_type<#response_type> { - let tonic_request = quickwit_auth::build_tonic_stream_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_stream_request_with_auth_token(request)?; self.inner .clone() .#method_name(tonic_request) @@ -1182,7 +1182,7 @@ fn generate_grpc_client_adapter_methods(context: &CodegenContext) -> TokenStream } else { quote! { async fn #method_name(&self, request: #request_type) -> #result_type<#response_type> { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token(request)?; self.inner .clone() .#method_name(tonic_request) @@ -1273,8 +1273,8 @@ fn generate_grpc_server_adapter_methods(context: &CodegenContext) -> TokenStream #associated_type async fn #method_name(&self, request: tonic::Request<#request_type>) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization(auth_token, self.inner.0.#method_name(#method_arg)).await + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization(auth_token, self.inner.0.#method_name(#method_arg)).await .map(#into_response_type) .map_err(crate::error::grpc_error_to_grpc_status) } diff --git a/quickwit/quickwit-ingest/Cargo.toml b/quickwit/quickwit-ingest/Cargo.toml index 2fdb7195555..f1325278622 100644 --- a/quickwit/quickwit-ingest/Cargo.toml +++ b/quickwit/quickwit-ingest/Cargo.toml @@ -36,7 +36,7 @@ ulid = { workspace = true } utoipa = { workspace = true } quickwit-actors = { workspace = true } -quickwit-auth = { workspace = true } +quickwit-authorize = { workspace = true } quickwit-cluster = { workspace = true } quickwit-common = { workspace = true, features = ["testsuite"] } quickwit-config = { workspace = true } @@ -63,4 +63,4 @@ quickwit-codegen = { workspace = true } failpoints = ["fail/failpoints"] no-failpoints = [] testsuite = ["mockall"] -enterprise = ["quickwit-auth/enterprise"] +enterprise = ["quickwit-authorize/enterprise"] diff --git a/quickwit/quickwit-ingest/src/authorize.rs b/quickwit/quickwit-ingest/src/authorize.rs index 8b1b9287ce0..57ad079867a 100644 --- a/quickwit/quickwit-ingest/src/authorize.rs +++ b/quickwit/quickwit-ingest/src/authorize.rs @@ -15,7 +15,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -use quickwit_auth::{Authorization, AuthorizationError, AuthorizationToken}; +use quickwit_authorize::::{Authorization, AuthorizationError, AuthorizationToken}; use crate::{FetchRequest, IngestRequest, TailRequest}; diff --git a/quickwit/quickwit-ingest/src/codegen/ingest_service.rs b/quickwit/quickwit-ingest/src/codegen/ingest_service.rs index 65992ccaa2e..8b7e4b4c7ea 100644 --- a/quickwit/quickwit-ingest/src/codegen/ingest_service.rs +++ b/quickwit/quickwit-ingest/src/codegen/ingest_service.rs @@ -819,7 +819,9 @@ where T::Future: Send, { async fn ingest(&self, request: IngestRequest) -> crate::Result { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .ingest(tonic_request) @@ -831,7 +833,9 @@ where )) } async fn fetch(&self, request: FetchRequest) -> crate::Result { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .fetch(tonic_request) @@ -843,7 +847,9 @@ where )) } async fn tail(&self, request: TailRequest) -> crate::Result { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .tail(tonic_request) @@ -875,8 +881,8 @@ impl ingest_service_grpc_server::IngestServiceGrpc for IngestServiceGrpcServerAd &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.ingest(request.into_inner()), ) @@ -888,8 +894,8 @@ impl ingest_service_grpc_server::IngestServiceGrpc for IngestServiceGrpcServerAd &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.fetch(request.into_inner()), ) @@ -901,8 +907,8 @@ impl ingest_service_grpc_server::IngestServiceGrpc for IngestServiceGrpcServerAd &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.tail(request.into_inner()), ) diff --git a/quickwit/quickwit-ingest/src/error.rs b/quickwit/quickwit-ingest/src/error.rs index 0b99ba27c95..c951bdd6380 100644 --- a/quickwit/quickwit-ingest/src/error.rs +++ b/quickwit/quickwit-ingest/src/error.rs @@ -21,7 +21,7 @@ use std::io; use mrecordlog::error::*; use quickwit_actors::AskError; -use quickwit_auth::AuthorizationError; +use quickwit_authorize::AuthorizationError; use quickwit_common::rate_limited_error; use quickwit_common::tower::BufferError; pub(crate) use quickwit_proto::error::{grpc_error_to_grpc_status, grpc_status_to_service_error}; diff --git a/quickwit/quickwit-metastore/Cargo.toml b/quickwit/quickwit-metastore/Cargo.toml index 4e4c7ec98aa..82aa67af806 100644 --- a/quickwit/quickwit-metastore/Cargo.toml +++ b/quickwit/quickwit-metastore/Cargo.toml @@ -39,7 +39,7 @@ tracing = { workspace = true } ulid = { workspace = true, features = ["serde"] } utoipa = { workspace = true } -quickwit-auth = { workspace = true } +quickwit-authorize = { workspace = true } quickwit-common = { workspace = true } quickwit-config = { workspace = true } quickwit-doc-mapper = { workspace = true } diff --git a/quickwit/quickwit-metastore/src/error.rs b/quickwit/quickwit-metastore/src/error.rs index 43c7f4b6ec9..2f317d695b7 100644 --- a/quickwit/quickwit-metastore/src/error.rs +++ b/quickwit/quickwit-metastore/src/error.rs @@ -42,5 +42,5 @@ pub enum MetastoreResolverError { /// The requested operation is not authorized. #[error("unauthorized: `{0}`")] - Unauthorized(#[from] quickwit_auth::AuthorizationError), + Unauthorized(#[from] quickwit_authorize::AuthorizationError), } diff --git a/quickwit/quickwit-proto/Cargo.toml b/quickwit/quickwit-proto/Cargo.toml index 6f5aedb6724..e76a7a539af 100644 --- a/quickwit/quickwit-proto/Cargo.toml +++ b/quickwit/quickwit-proto/Cargo.toml @@ -36,7 +36,7 @@ utoipa = { workspace = true } zstd = { workspace = true } quickwit-actors = { workspace = true } -quickwit-auth = { workspace = true } +quickwit-authorize = { workspace = true } quickwit-common = { workspace = true } [dev-dependencies] @@ -53,4 +53,4 @@ quickwit-codegen = { workspace = true } [features] postgres = ["sea-query", "sqlx"] testsuite = ["mockall", "futures"] -enterprise = [ "quickwit-auth/enterprise"] +enterprise = [ "quickwit-authorize/enterprise"] diff --git a/quickwit/quickwit-proto/src/authorization.rs b/quickwit/quickwit-proto/src/authorization.rs index a7887ab339d..54882b7cfbc 100644 --- a/quickwit/quickwit-proto/src/authorization.rs +++ b/quickwit/quickwit-proto/src/authorization.rs @@ -2,7 +2,7 @@ use std::time::{Duration, SystemTime}; use biscuit_auth::builder_ext::BuilderExt; use biscuit_auth::macros::*; -use quickwit_auth::{Authorization, AuthorizationError, AuthorizationToken, StreamAuthorization}; +use quickwit_authorize::::{Authorization, AuthorizationError, AuthorizationToken, StreamAuthorization}; use crate::cluster::FetchClusterStateRequest; use crate::control_plane::{AdviseResetShardsRequest, GetOrCreateOpenShardsRequest}; diff --git a/quickwit/quickwit-proto/src/cluster/mod.rs b/quickwit/quickwit-proto/src/cluster/mod.rs index 7f0a25ecf7a..4bd227c8e1e 100644 --- a/quickwit/quickwit-proto/src/cluster/mod.rs +++ b/quickwit/quickwit-proto/src/cluster/mod.rs @@ -40,7 +40,7 @@ pub enum ClusterError { #[error("service unavailable: {0}")] Unavailable(String), #[error("unauthorized: {0}")] - Unauthorized(#[from] quickwit_auth::AuthorizationError), + Unauthorized(#[from] quickwit_authorize::AuthorizationError), } impl ServiceError for ClusterError { diff --git a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.cluster.rs b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.cluster.rs index a7a4e2388d0..28762ff59e5 100644 --- a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.cluster.rs +++ b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.cluster.rs @@ -510,7 +510,9 @@ where &self, request: FetchClusterStateRequest, ) -> crate::cluster::ClusterResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .fetch_cluster_state(tonic_request) @@ -543,8 +545,8 @@ for ClusterServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.fetch_cluster_state(request.into_inner()), ) diff --git a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.control_plane.rs b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.control_plane.rs index b6449a8bd42..f1ddb3925fa 100644 --- a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.control_plane.rs +++ b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.control_plane.rs @@ -1633,7 +1633,9 @@ where ) -> crate::control_plane::ControlPlaneResult< super::metastore::CreateIndexResponse, > { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .create_index(tonic_request) @@ -1650,7 +1652,9 @@ where ) -> crate::control_plane::ControlPlaneResult< super::metastore::IndexMetadataResponse, > { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .update_index(tonic_request) @@ -1665,7 +1669,9 @@ where &self, request: super::metastore::DeleteIndexRequest, ) -> crate::control_plane::ControlPlaneResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .delete_index(tonic_request) @@ -1680,7 +1686,9 @@ where &self, request: super::metastore::AddSourceRequest, ) -> crate::control_plane::ControlPlaneResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .add_source(tonic_request) @@ -1695,7 +1703,9 @@ where &self, request: super::metastore::ToggleSourceRequest, ) -> crate::control_plane::ControlPlaneResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .toggle_source(tonic_request) @@ -1710,7 +1720,9 @@ where &self, request: super::metastore::DeleteSourceRequest, ) -> crate::control_plane::ControlPlaneResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .delete_source(tonic_request) @@ -1725,7 +1737,9 @@ where &self, request: GetOrCreateOpenShardsRequest, ) -> crate::control_plane::ControlPlaneResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .get_or_create_open_shards(tonic_request) @@ -1740,7 +1754,9 @@ where &self, request: AdviseResetShardsRequest, ) -> crate::control_plane::ControlPlaneResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .advise_reset_shards(tonic_request) @@ -1755,7 +1771,9 @@ where &self, request: super::metastore::PruneShardsRequest, ) -> crate::control_plane::ControlPlaneResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .prune_shards(tonic_request) @@ -1788,8 +1806,8 @@ for ControlPlaneServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.create_index(request.into_inner()), ) @@ -1804,8 +1822,8 @@ for ControlPlaneServiceGrpcServerAdapter { tonic::Response, tonic::Status, > { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.update_index(request.into_inner()), ) @@ -1817,8 +1835,8 @@ for ControlPlaneServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.delete_index(request.into_inner()), ) @@ -1830,8 +1848,8 @@ for ControlPlaneServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.add_source(request.into_inner()), ) @@ -1843,8 +1861,8 @@ for ControlPlaneServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.toggle_source(request.into_inner()), ) @@ -1856,8 +1874,8 @@ for ControlPlaneServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.delete_source(request.into_inner()), ) @@ -1869,8 +1887,8 @@ for ControlPlaneServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.get_or_create_open_shards(request.into_inner()), ) @@ -1882,8 +1900,8 @@ for ControlPlaneServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.advise_reset_shards(request.into_inner()), ) @@ -1895,8 +1913,8 @@ for ControlPlaneServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.prune_shards(request.into_inner()), ) diff --git a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.developer.rs b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.developer.rs index 1a98a47df7b..5d99aaa7532 100644 --- a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.developer.rs +++ b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.developer.rs @@ -446,7 +446,9 @@ where &self, request: GetDebugInfoRequest, ) -> crate::developer::DeveloperResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .get_debug_info(tonic_request) @@ -479,8 +481,8 @@ for DeveloperServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.get_debug_info(request.into_inner()), ) diff --git a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.indexing.rs b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.indexing.rs index 793f4bffa72..46c66feec09 100644 --- a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.indexing.rs +++ b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.indexing.rs @@ -459,7 +459,9 @@ where &self, request: ApplyIndexingPlanRequest, ) -> crate::indexing::IndexingResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .apply_indexing_plan(tonic_request) @@ -492,8 +494,8 @@ for IndexingServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.apply_indexing_plan(request.into_inner()), ) diff --git a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.ingest.ingester.rs b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.ingest.ingester.rs index bc5ae585cdf..1d8294510ec 100644 --- a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.ingest.ingester.rs +++ b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.ingest.ingester.rs @@ -2044,7 +2044,9 @@ where &self, request: PersistRequest, ) -> crate::ingest::IngestV2Result { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .persist(tonic_request) @@ -2059,7 +2061,7 @@ where &self, request: quickwit_common::ServiceStream, ) -> crate::ingest::IngestV2Result> { - let tonic_request = quickwit_auth::build_tonic_stream_request_with_auth_token( + let tonic_request = quickwit_authorize::build_tonic_stream_request_with_auth_token( request, )?; self.inner @@ -2084,7 +2086,9 @@ where &self, request: OpenFetchStreamRequest, ) -> crate::ingest::IngestV2Result> { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .open_fetch_stream(tonic_request) @@ -2107,7 +2111,9 @@ where &self, request: OpenObservationStreamRequest, ) -> crate::ingest::IngestV2Result> { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .open_observation_stream(tonic_request) @@ -2130,7 +2136,9 @@ where &self, request: InitShardsRequest, ) -> crate::ingest::IngestV2Result { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .init_shards(tonic_request) @@ -2145,7 +2153,9 @@ where &self, request: RetainShardsRequest, ) -> crate::ingest::IngestV2Result { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .retain_shards(tonic_request) @@ -2160,7 +2170,9 @@ where &self, request: TruncateShardsRequest, ) -> crate::ingest::IngestV2Result { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .truncate_shards(tonic_request) @@ -2175,7 +2187,9 @@ where &self, request: CloseShardsRequest, ) -> crate::ingest::IngestV2Result { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .close_shards(tonic_request) @@ -2190,7 +2204,9 @@ where &self, request: DecommissionRequest, ) -> crate::ingest::IngestV2Result { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .decommission(tonic_request) @@ -2223,8 +2239,8 @@ for IngesterServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.persist(request.into_inner()), ) @@ -2239,8 +2255,8 @@ for IngesterServiceGrpcServerAdapter { &self, request: tonic::Request>, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self .inner @@ -2263,8 +2279,8 @@ for IngesterServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.open_fetch_stream(request.into_inner()), ) @@ -2281,8 +2297,8 @@ for IngesterServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.open_observation_stream(request.into_inner()), ) @@ -2296,8 +2312,8 @@ for IngesterServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.init_shards(request.into_inner()), ) @@ -2309,8 +2325,8 @@ for IngesterServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.retain_shards(request.into_inner()), ) @@ -2322,8 +2338,8 @@ for IngesterServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.truncate_shards(request.into_inner()), ) @@ -2335,8 +2351,8 @@ for IngesterServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.close_shards(request.into_inner()), ) @@ -2348,8 +2364,8 @@ for IngesterServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.decommission(request.into_inner()), ) diff --git a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.ingest.router.rs b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.ingest.router.rs index 45440087454..3c99756ac7f 100644 --- a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.ingest.router.rs +++ b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.ingest.router.rs @@ -572,7 +572,9 @@ where &self, request: IngestRequestV2, ) -> crate::ingest::IngestV2Result { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .ingest(tonic_request) @@ -605,8 +607,8 @@ for IngestRouterServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.ingest(request.into_inner()), ) diff --git a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.metastore.rs b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.metastore.rs index 80ae0c04490..9b32e28bd91 100644 --- a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.metastore.rs +++ b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.metastore.rs @@ -4866,7 +4866,9 @@ where &self, request: CreateIndexRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .create_index(tonic_request) @@ -4881,7 +4883,9 @@ where &self, request: UpdateIndexRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .update_index(tonic_request) @@ -4896,7 +4900,9 @@ where &self, request: IndexMetadataRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .index_metadata(tonic_request) @@ -4911,7 +4917,9 @@ where &self, request: IndexesMetadataRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .indexes_metadata(tonic_request) @@ -4926,7 +4934,9 @@ where &self, request: ListIndexesMetadataRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .list_indexes_metadata(tonic_request) @@ -4941,7 +4951,9 @@ where &self, request: DeleteIndexRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .delete_index(tonic_request) @@ -4956,7 +4968,9 @@ where &self, request: ListSplitsRequest, ) -> crate::metastore::MetastoreResult> { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .list_splits(tonic_request) @@ -4979,7 +4993,9 @@ where &self, request: StageSplitsRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .stage_splits(tonic_request) @@ -4994,7 +5010,9 @@ where &self, request: PublishSplitsRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .publish_splits(tonic_request) @@ -5009,7 +5027,9 @@ where &self, request: MarkSplitsForDeletionRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .mark_splits_for_deletion(tonic_request) @@ -5024,7 +5044,9 @@ where &self, request: DeleteSplitsRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .delete_splits(tonic_request) @@ -5039,7 +5061,9 @@ where &self, request: AddSourceRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .add_source(tonic_request) @@ -5054,7 +5078,9 @@ where &self, request: ToggleSourceRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .toggle_source(tonic_request) @@ -5069,7 +5095,9 @@ where &self, request: DeleteSourceRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .delete_source(tonic_request) @@ -5084,7 +5112,9 @@ where &self, request: ResetSourceCheckpointRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .reset_source_checkpoint(tonic_request) @@ -5099,7 +5129,9 @@ where &self, request: LastDeleteOpstampRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .last_delete_opstamp(tonic_request) @@ -5114,7 +5146,9 @@ where &self, request: DeleteQuery, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .create_delete_task(tonic_request) @@ -5129,7 +5163,9 @@ where &self, request: UpdateSplitsDeleteOpstampRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .update_splits_delete_opstamp(tonic_request) @@ -5144,7 +5180,9 @@ where &self, request: ListDeleteTasksRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .list_delete_tasks(tonic_request) @@ -5159,7 +5197,9 @@ where &self, request: ListStaleSplitsRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .list_stale_splits(tonic_request) @@ -5174,7 +5214,9 @@ where &self, request: OpenShardsRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .open_shards(tonic_request) @@ -5189,7 +5231,9 @@ where &self, request: AcquireShardsRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .acquire_shards(tonic_request) @@ -5204,7 +5248,9 @@ where &self, request: DeleteShardsRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .delete_shards(tonic_request) @@ -5219,7 +5265,9 @@ where &self, request: PruneShardsRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .prune_shards(tonic_request) @@ -5234,7 +5282,9 @@ where &self, request: ListShardsRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .list_shards(tonic_request) @@ -5249,7 +5299,9 @@ where &self, request: CreateIndexTemplateRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .create_index_template(tonic_request) @@ -5264,7 +5316,9 @@ where &self, request: GetIndexTemplateRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .get_index_template(tonic_request) @@ -5279,7 +5333,9 @@ where &self, request: FindIndexTemplateMatchesRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .find_index_template_matches(tonic_request) @@ -5294,7 +5350,9 @@ where &self, request: ListIndexTemplatesRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .list_index_templates(tonic_request) @@ -5309,7 +5367,9 @@ where &self, request: DeleteIndexTemplatesRequest, ) -> crate::metastore::MetastoreResult { - let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?; + let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token( + request, + )?; self.inner .clone() .delete_index_templates(tonic_request) @@ -5357,8 +5417,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.create_index(request.into_inner()), ) @@ -5370,8 +5430,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.update_index(request.into_inner()), ) @@ -5383,8 +5443,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.index_metadata(request.into_inner()), ) @@ -5396,8 +5456,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.indexes_metadata(request.into_inner()), ) @@ -5409,8 +5469,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.list_indexes_metadata(request.into_inner()), ) @@ -5422,8 +5482,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.delete_index(request.into_inner()), ) @@ -5438,8 +5498,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.list_splits(request.into_inner()), ) @@ -5453,8 +5513,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.stage_splits(request.into_inner()), ) @@ -5466,8 +5526,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.publish_splits(request.into_inner()), ) @@ -5479,8 +5539,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.mark_splits_for_deletion(request.into_inner()), ) @@ -5492,8 +5552,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.delete_splits(request.into_inner()), ) @@ -5505,8 +5565,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.add_source(request.into_inner()), ) @@ -5518,8 +5578,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.toggle_source(request.into_inner()), ) @@ -5531,8 +5591,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.delete_source(request.into_inner()), ) @@ -5544,8 +5604,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.reset_source_checkpoint(request.into_inner()), ) @@ -5557,8 +5617,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.last_delete_opstamp(request.into_inner()), ) @@ -5570,8 +5630,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.create_delete_task(request.into_inner()), ) @@ -5583,8 +5643,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.update_splits_delete_opstamp(request.into_inner()), ) @@ -5596,8 +5656,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.list_delete_tasks(request.into_inner()), ) @@ -5609,8 +5669,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.list_stale_splits(request.into_inner()), ) @@ -5622,8 +5682,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.open_shards(request.into_inner()), ) @@ -5635,8 +5695,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.acquire_shards(request.into_inner()), ) @@ -5648,8 +5708,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.delete_shards(request.into_inner()), ) @@ -5661,8 +5721,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.prune_shards(request.into_inner()), ) @@ -5674,8 +5734,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.list_shards(request.into_inner()), ) @@ -5687,8 +5747,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.create_index_template(request.into_inner()), ) @@ -5700,8 +5760,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.get_index_template(request.into_inner()), ) @@ -5713,8 +5773,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.find_index_template_matches(request.into_inner()), ) @@ -5726,8 +5786,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.list_index_templates(request.into_inner()), ) @@ -5739,8 +5799,8 @@ for MetastoreServiceGrpcServerAdapter { &self, request: tonic::Request, ) -> Result, tonic::Status> { - let auth_token = quickwit_auth::get_auth_token(request.metadata())?; - quickwit_auth::execute_with_authorization( + let auth_token = quickwit_authorize::get_auth_token(request.metadata())?; + quickwit_authorize::execute_with_authorization( auth_token, self.inner.0.delete_index_templates(request.into_inner()), ) diff --git a/quickwit/quickwit-proto/src/control_plane/mod.rs b/quickwit/quickwit-proto/src/control_plane/mod.rs index 34306229a2a..5a72abea10f 100644 --- a/quickwit/quickwit-proto/src/control_plane/mod.rs +++ b/quickwit/quickwit-proto/src/control_plane/mod.rs @@ -43,7 +43,7 @@ pub enum ControlPlaneError { #[error("service unavailable: {0}")] Unavailable(String), #[error("unauthorized: {0}")] - Unauthorized(#[from] quickwit_auth::AuthorizationError), + Unauthorized(#[from] quickwit_authorize::AuthorizationError), } impl From for ControlPlaneError { diff --git a/quickwit/quickwit-proto/src/developer/mod.rs b/quickwit/quickwit-proto/src/developer/mod.rs index 90595b6d60a..0c1c7aa6273 100644 --- a/quickwit/quickwit-proto/src/developer/mod.rs +++ b/quickwit/quickwit-proto/src/developer/mod.rs @@ -39,7 +39,7 @@ pub enum DeveloperError { #[error("service unavailable: {0}")] Unavailable(String), #[error("unauthorized: {0}")] - Unauthorized(#[from] quickwit_auth::AuthorizationError), + Unauthorized(#[from] quickwit_authorize::AuthorizationError), } impl ServiceError for DeveloperError { diff --git a/quickwit/quickwit-proto/src/error.rs b/quickwit/quickwit-proto/src/error.rs index 828e33efe0a..08b2657b378 100644 --- a/quickwit/quickwit-proto/src/error.rs +++ b/quickwit/quickwit-proto/src/error.rs @@ -23,7 +23,7 @@ use std::fmt::Debug; use anyhow::Context; use quickwit_actors::AskError; -use quickwit_auth::AuthorizationError; +use quickwit_authorize::AuthorizationError; use serde::de::DeserializeOwned; use serde::Serialize; use tonic::metadata::BinaryMetadataValue; diff --git a/quickwit/quickwit-proto/src/indexing/mod.rs b/quickwit/quickwit-proto/src/indexing/mod.rs index 449d7f9efae..b57c7e9db8c 100644 --- a/quickwit/quickwit-proto/src/indexing/mod.rs +++ b/quickwit/quickwit-proto/src/indexing/mod.rs @@ -52,7 +52,7 @@ pub enum IndexingError { #[error("service unavailable: {0}")] Unavailable(String), #[error("unauthorized: {0}")] - Unauthorized(#[from] quickwit_auth::AuthorizationError), + Unauthorized(#[from] quickwit_authorize::AuthorizationError), } impl From for IndexingError { diff --git a/quickwit/quickwit-proto/src/ingest/mod.rs b/quickwit/quickwit-proto/src/ingest/mod.rs index 3722c5fbd87..ef01a705396 100644 --- a/quickwit/quickwit-proto/src/ingest/mod.rs +++ b/quickwit/quickwit-proto/src/ingest/mod.rs @@ -66,7 +66,7 @@ pub enum IngestV2Error { #[error("service unavailable: {0}")] Unavailable(String), #[error("unauthorized: {0}")] - Unauthorized(#[from] quickwit_auth::AuthorizationError), + Unauthorized(#[from] quickwit_authorize::AuthorizationError), } impl From for IngestV2Error { diff --git a/quickwit/quickwit-proto/src/metastore/mod.rs b/quickwit/quickwit-proto/src/metastore/mod.rs index 530f5ec0c79..0b795a91b9b 100644 --- a/quickwit/quickwit-proto/src/metastore/mod.rs +++ b/quickwit/quickwit-proto/src/metastore/mod.rs @@ -157,7 +157,7 @@ pub enum MetastoreError { Unavailable(String), #[error("unauthorized: {0}")] - Unauthorized(#[from] quickwit_auth::AuthorizationError), + Unauthorized(#[from] quickwit_authorize::AuthorizationError), } impl MetastoreError {