Skip to main content

unitycatalog_server/codegen/policies/
handler.rs

1// @generated — do not edit by hand.
2//! Handler trait for [`PolicyHandler`].
3//!
4//! Implement this trait to provide a custom backend for this service, then mount the
5//! generated handler functions (in the sibling `server` module) onto an `axum::Router`
6//! with your implementation as state.
7//!
8//! # Composability
9//!
10//! A single struct can implement multiple handler traits to serve multiple
11//! services. Use [`axum::Router::merge`] to compose per-service routers together.
12//!
13//! Manage ABAC row-filter and column-mask policies bound to Unity Catalog securables.
14use crate::Result;
15use async_trait::async_trait;
16use unitycatalog_common::models::policies::v1::*;
17#[async_trait]
18pub trait PolicyHandler<Cx = crate::api::RequestContext>: Send + Sync + 'static {
19    /// List policies
20    ///
21    /// Gets an array of policies defined on the specified securable. There is no guarantee
22    /// of a specific ordering of the elements in the array.
23    async fn list_policies(
24        &self,
25        request: ListPoliciesRequest,
26        context: Cx,
27    ) -> Result<ListPoliciesResponse>;
28    /// Create a new policy
29    ///
30    /// Creates a new row-filter or column-mask policy on the specified securable.
31    async fn create_policy(&self, request: CreatePolicyRequest, context: Cx) -> Result<PolicyInfo>;
32    /// Get a policy
33    ///
34    /// Gets the policy that matches the supplied name, defined on the specified securable.
35    async fn get_policy(&self, request: GetPolicyRequest, context: Cx) -> Result<PolicyInfo>;
36    /// Update a policy
37    ///
38    /// Updates the policy that matches the supplied name, defined on the specified securable.
39    async fn update_policy(&self, request: UpdatePolicyRequest, context: Cx) -> Result<PolicyInfo>;
40    /// Delete a policy
41    ///
42    /// Deletes the policy that matches the supplied name, defined on the specified securable.
43    async fn delete_policy(&self, request: DeletePolicyRequest, context: Cx) -> Result<()>;
44}