Skip to main content

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    ///
24    /// The metastore must have the `external_access_enabled` flag set to true
25    /// (default false). The caller must have the `EXTERNAL_USE_SCHEMA`
26    /// privilege on the parent schema (granted by a catalog owner).
27    async fn generate_temporary_table_credentials(
28        &self,
29        request: GenerateTemporaryTableCredentialsRequest,
30        context: Cx,
31    ) -> Result<TemporaryCredential>;
32    /// Generate a new set of credentials for a path.
33    ///
34    /// Only external storage paths (external locations and external tables) are
35    /// supported; managed tables are not. The metastore must have the
36    /// `external_access_enabled` flag set to true (default false). The caller must
37    /// have the `EXTERNAL_USE_LOCATION` privilege on the external location
38    /// (granted by its owner) and, for existing external tables, the
39    /// `EXTERNAL_USE_SCHEMA` privilege on the parent schema.
40    async fn generate_temporary_path_credentials(
41        &self,
42        request: GenerateTemporaryPathCredentialsRequest,
43        context: Cx,
44    ) -> Result<TemporaryCredential>;
45    /// Generate a new set of credentials for a volume.
46    ///
47    /// The metastore must have the `external_access_enabled` flag set to true
48    /// (default false). The caller must have the `EXTERNAL_USE_SCHEMA`
49    /// privilege on the parent schema (granted by a catalog owner).
50    async fn generate_temporary_volume_credentials(
51        &self,
52        request: GenerateTemporaryVolumeCredentialsRequest,
53        context: Cx,
54    ) -> Result<TemporaryCredential>;
55    /// Generate a new set of credentials for a model version.
56    ///
57    /// The metastore must have the `external_access_enabled` flag set to true
58    /// (default false). The caller must have the `EXTERNAL_USE_SCHEMA`
59    /// privilege on the parent schema (granted by a catalog owner).
60    async fn generate_temporary_model_version_credentials(
61        &self,
62        request: GenerateTemporaryModelVersionCredentialsRequest,
63        context: Cx,
64    ) -> Result<TemporaryCredential>;
65}