summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-16 13:27:37 -0600
committermo khan <mo@mokhan.ca>2025-07-16 13:27:37 -0600
commit6099a0a9ff1323e8bca426eb57651fac47dce0e9 (patch)
tree83e9e349befdbc369a62a61f2705691ead49e603
parent7db4022711af526ed7606fef65d3ffa0017e8b25 (diff)
chore: add google type protos
-rw-r--r--Cargo.lock30
-rw-r--r--buf.gen.yaml2
-rw-r--r--buf.yaml1
-rw-r--r--src/rpc/mod.rs68
4 files changed, 56 insertions, 45 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 63ea22e8..bdbfc073 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -157,9 +157,10 @@ version = "0.1.0"
dependencies = [
"cedar-policy",
"clap",
- "envoy-types",
"log",
"please",
+ "prost 0.12.6",
+ "prost-types",
"reqwest",
"serde",
"serde_json",
@@ -635,17 +636,6 @@ dependencies = [
]
[[package]]
-name = "envoy-types"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "065b6b0018b25902cab074d44c0e2098205329b6b5a309a33cc688bc0ac9573d"
-dependencies = [
- "futures-core",
- "prost 0.13.5",
- "tonic",
-]
-
-[[package]]
name = "equivalent"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1667,7 +1657,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29"
dependencies = [
"bytes",
- "prost-derive 0.12.6",
+ "prost-derive",
]
[[package]]
@@ -1677,7 +1667,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5"
dependencies = [
"bytes",
- "prost-derive 0.13.5",
]
[[package]]
@@ -1715,19 +1704,6 @@ dependencies = [
]
[[package]]
-name = "prost-derive"
-version = "0.13.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d"
-dependencies = [
- "anyhow",
- "itertools 0.14.0",
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
name = "prost-types"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/buf.gen.yaml b/buf.gen.yaml
index b35aa545..b342ba98 100644
--- a/buf.gen.yaml
+++ b/buf.gen.yaml
@@ -2,6 +2,7 @@ version: v2
inputs:
- module: buf.build/authzed/api
- module: buf.build/envoyproxy/envoy
+ - module: buf.build/googleapis/googleapis
plugins:
- remote: buf.build/community/neoeinstein-prost:v0.4.0
out: src/rpc
@@ -11,3 +12,4 @@ plugins:
out: src/rpc
opt:
- compile_well_known_types
+ - compile_well_known_types
diff --git a/buf.yaml b/buf.yaml
index 20b8f98e..a4fc1ba6 100644
--- a/buf.yaml
+++ b/buf.yaml
@@ -3,6 +3,7 @@ version: v2
deps:
- buf.build/authzed/api
- buf.build/envoyproxy/envoy
+ - buf.build/googleapis/googleapis
lint:
use:
- STANDARD
diff --git a/src/rpc/mod.rs b/src/rpc/mod.rs
index 44edacca..cbab1fb2 100644
--- a/src/rpc/mod.rs
+++ b/src/rpc/mod.rs
@@ -1,24 +1,56 @@
-// Simplified SpiceDB types for dependency injection demo
-#[derive(Debug, Clone, Default)]
-pub struct CheckPermissionRequest {
- pub resource: Option<ObjectReference>,
- pub permission: String,
- pub subject: Option<SubjectReference>,
+// Generated protobuf modules
+pub mod authzed {
+ pub mod api {
+ pub mod v1 {
+ include!("authzed.api.v1.rs");
+ }
+ pub mod materialize {
+ pub mod v0 {
+ include!("authzed.api.materialize.v0.rs");
+ }
+ }
+ }
}
-#[derive(Debug, Clone, Default)]
-pub struct CheckPermissionResponse {
- pub permissionship: i32, // 1 = HAS_PERMISSION, 2 = NO_PERMISSION
+pub mod envoy {
+ pub mod service {
+ pub mod auth {
+ pub mod v3 {
+ include!("envoy.service.auth.v3.rs");
+ }
+ }
+ }
+ pub mod extensions {
+ pub mod filters {
+ pub mod http {
+ pub mod ext_authz {
+ pub mod v3 {
+ include!("envoy.extensions.filters.http.ext_authz.v3.rs");
+ }
+ }
+ }
+ }
+ }
+ pub mod r#type {
+ pub mod v3 {
+ include!("envoy.type.v3.rs");
+ }
+ }
}
-#[derive(Debug, Clone, Default)]
-pub struct ObjectReference {
- pub object_type: String,
- pub object_id: String,
+// Use prost-types for Google protobuf types
+pub mod google {
+ pub mod protobuf {
+ // Re-export prost-types to match the generated code expectations
+ pub use prost_types::*;
+ }
+ pub mod rpc {
+ pub use prost_types::*;
+ }
}
-#[derive(Debug, Clone, Default)]
-pub struct SubjectReference {
- pub object: Option<ObjectReference>,
- pub optional_relation: String,
-} \ No newline at end of file
+// Re-export commonly used types
+pub use authzed::api::v1::*;
+pub use envoy::service::auth::v3::*;
+pub use google::protobuf::*;
+pub use google::rpc::*; \ No newline at end of file