unitycatalog_server/codegen/temporary_credentials/handler.rs
1// @generated — do not edit by hand.
2//! Handler trait for [`TemporaryCredentialHandler`].
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//! Service for generating temporary credentials to access tables and storage paths.
14//! Credentials are short-lived and scoped to a specific operation (read or read/write).
15use crate::Result;
16use async_trait::async_trait;
17use unitycatalog_common::models::temporary_credentials::v1::*;
18#[async_trait]
19pub trait TemporaryCredentialHandler<Cx = crate::api::RequestContext>:
20 Send + Sync + 'static
21{
22 /// Generate a new set of credentials for a table.
23 async fn generate_temporary_table_credentials(
24 &self,
25 request: GenerateTemporaryTableCredentialsRequest,
26 context: Cx,
27 ) -> Result<TemporaryCredential>;
28 /// Generate a new set of credentials for a path.
29 async fn generate_temporary_path_credentials(
30 &self,
31 request: GenerateTemporaryPathCredentialsRequest,
32 context: Cx,
33 ) -> Result<TemporaryCredential>;
34 /// Generate a new set of credentials for a volume.
35 ///
36 /// The metastore must have the `external_access_enabled` flag set to true
37 /// (default false). The caller must have the `EXTERNAL_USE_SCHEMA`
38 /// privilege on the parent schema (granted by a catalog owner).
39 async fn generate_temporary_volume_credentials(
40 &self,
41 request: GenerateTemporaryVolumeCredentialsRequest,
42 context: Cx,
43 ) -> Result<TemporaryCredential>;
44 /// Generate a new set of credentials for a model version.
45 ///
46 /// The metastore must have the `external_access_enabled` flag set to true
47 /// (default false). The caller must have the `EXTERNAL_USE_SCHEMA`
48 /// privilege on the parent schema (granted by a catalog owner).
49 async fn generate_temporary_model_version_credentials(
50 &self,
51 request: GenerateTemporaryModelVersionCredentialsRequest,
52 context: Cx,
53 ) -> Result<TemporaryCredential>;
54}