unitycatalog_server/codegen/catalogs/handler.rs
1// @generated — do not edit by hand.
2//! Handler trait for [`CatalogHandler`].
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 catalogs and schemas in the service.
14use crate::Result;
15use async_trait::async_trait;
16use unitycatalog_common::models::catalogs::v1::*;
17#[async_trait]
18pub trait CatalogHandler<Cx = crate::api::RequestContext>: Send + Sync + 'static {
19 /// List catalogs
20 ///
21 /// Gets an array of catalogs in the metastore. If the caller is the metastore admin,
22 /// all catalogs will be retrieved. Otherwise, only catalogs owned by the caller
23 /// (or for which the caller has the USE_CATALOG privilege) will be retrieved.
24 /// There is no guarantee of a specific ordering of the elements in the array.
25 async fn list_catalogs(
26 &self,
27 request: ListCatalogsRequest,
28 context: Cx,
29 ) -> Result<ListCatalogsResponse>;
30 /// Create a new catalog
31 ///
32 /// Creates a new catalog instance in the parent metastore if the caller
33 /// is a metastore admin or has the CREATE_CATALOG privilege.
34 async fn create_catalog(&self, request: CreateCatalogRequest, context: Cx) -> Result<Catalog>;
35 /// Get a catalog
36 ///
37 /// Gets the specified catalog in a metastore. The caller must be a metastore admin,
38 /// the owner of the catalog, or a user that has the USE_CATALOG privilege set for their account.
39 async fn get_catalog(&self, request: GetCatalogRequest, context: Cx) -> Result<Catalog>;
40 /// Update a catalog
41 ///
42 /// Updates the catalog that matches the supplied name. The caller must be either
43 /// the owner of the catalog, or a metastore admin (when changing the owner field of the catalog).
44 async fn update_catalog(&self, request: UpdateCatalogRequest, context: Cx) -> Result<Catalog>;
45 /// Delete a catalog
46 ///
47 /// Deletes the catalog that matches the supplied name. The caller must
48 /// be a metastore admin or the owner of the catalog.
49 async fn delete_catalog(&self, request: DeleteCatalogRequest, context: Cx) -> Result<()>;
50}