Skip to main content

unitycatalog_server/codegen/registered_models/
handler.rs

1// @generated — do not edit by hand.
2//! Handler trait for [`RegisteredModelHandler`].
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 registered models in the service.
14//!
15//! A registered model is a securable in the three-level namespace
16//! (catalog.schema.model) that groups a collection of model versions.
17use crate::Result;
18use async_trait::async_trait;
19use unitycatalog_common::models::registered_models::v1::*;
20#[async_trait]
21pub trait RegisteredModelHandler<Cx = crate::api::RequestContext>: Send + Sync + 'static {
22    /// List registered models
23    ///
24    /// List registered models within the specified parent catalog and schema. If
25    /// the caller is the metastore admin, all registered models are returned in the
26    /// response. Otherwise, the caller must have USE_CATALOG on the parent catalog
27    /// and USE_SCHEMA on the parent schema, and the model must either be owned by
28    /// the caller or the caller must have a privilege on the model.
29    async fn list_registered_models(
30        &self,
31        request: ListRegisteredModelsRequest,
32        context: Cx,
33    ) -> Result<ListRegisteredModelsResponse>;
34    /// Create a registered model
35    ///
36    /// Creates a new registered model. The caller must be a metastore admin or have
37    /// the CREATE_MODEL privilege on the parent catalog and schema.
38    async fn create_registered_model(
39        &self,
40        request: CreateRegisteredModelRequest,
41        context: Cx,
42    ) -> Result<RegisteredModel>;
43    /// Get a registered model
44    ///
45    /// Gets a registered model from within a parent catalog and schema. For the
46    /// fetch to succeed, the caller must be a metastore admin, the owner of the
47    /// registered model, or have a privilege on the registered model.
48    async fn get_registered_model(
49        &self,
50        request: GetRegisteredModelRequest,
51        context: Cx,
52    ) -> Result<RegisteredModel>;
53    /// Update a registered model
54    ///
55    /// Updates the registered model that matches the supplied name.
56    async fn update_registered_model(
57        &self,
58        request: UpdateRegisteredModelRequest,
59        context: Cx,
60    ) -> Result<RegisteredModel>;
61    /// Delete a registered model
62    ///
63    /// Deletes the registered model that matches the supplied name. For the deletion
64    /// to succeed, the caller must be the owner of the registered model.
65    async fn delete_registered_model(
66        &self,
67        request: DeleteRegisteredModelRequest,
68        context: Cx,
69    ) -> Result<()>;
70}