unitycatalog_server/codegen/functions/handler.rs
1// @generated — do not edit by hand.
2//! Handler trait for [`FunctionHandler`].
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 User-Defined Functions (UDFs) in the service.
14use crate::Result;
15use async_trait::async_trait;
16use unitycatalog_common::models::functions::v1::*;
17#[async_trait]
18pub trait FunctionHandler<Cx = crate::api::RequestContext>: Send + Sync + 'static {
19 /// List functions
20 ///
21 /// List functions within the specified parent catalog and schema. If the caller is the metastore
22 /// admin, all functions are returned in the response. Otherwise, the caller must have USE_CATALOG
23 /// on the parent catalog and USE_SCHEMA on the parent schema, and the function must either be
24 /// owned by the caller or have SELECT on the function.
25 async fn list_functions(
26 &self,
27 request: ListFunctionsRequest,
28 context: Cx,
29 ) -> Result<ListFunctionsResponse>;
30 /// Create a function
31 ///
32 /// Creates a new function. The caller must be a metastore admin or have the CREATE_FUNCTION
33 /// privilege on the parent catalog and schema.
34 async fn create_function(
35 &self,
36 request: CreateFunctionRequest,
37 context: Cx,
38 ) -> Result<Function>;
39 /// Get a function
40 ///
41 /// Gets a function from within a parent catalog and schema. For the fetch to succeed,
42 /// the caller must be a metastore admin, the owner of the function, or have SELECT on
43 /// the function.
44 async fn get_function(&self, request: GetFunctionRequest, context: Cx) -> Result<Function>;
45 /// Update a function
46 ///
47 /// Updates the function that matches the supplied name. Only the owner of the function
48 /// can be updated.
49 async fn update_function(
50 &self,
51 request: UpdateFunctionRequest,
52 context: Cx,
53 ) -> Result<Function>;
54 /// Delete a function
55 ///
56 /// Deletes the function that matches the supplied name. For the deletion to succeed,
57 /// the caller must be the owner of the function.
58 async fn delete_function(&self, request: DeleteFunctionRequest, context: Cx) -> Result<()>;
59}