mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-11 03:39:49 +08:00
feat: add routing profile scheduling policies
This commit is contained in:
@@ -64,6 +64,14 @@ impl<'a> AdminAppState<'a> {
|
||||
self.app.has_global_model_data_writer()
|
||||
}
|
||||
|
||||
pub(crate) fn has_routing_group_data_reader(&self) -> bool {
|
||||
self.app.has_routing_group_data_reader()
|
||||
}
|
||||
|
||||
pub(crate) fn has_routing_group_data_writer(&self) -> bool {
|
||||
self.app.has_routing_group_data_writer()
|
||||
}
|
||||
|
||||
pub(crate) fn has_usage_data_reader(&self) -> bool {
|
||||
self.app.has_usage_data_reader()
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ mod observability;
|
||||
mod provider;
|
||||
mod provider_oauth;
|
||||
mod route_request;
|
||||
mod routing_profiles;
|
||||
mod state;
|
||||
mod system;
|
||||
mod users;
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
use aether_data_contracts::repository::routing_profiles::{
|
||||
CreateRoutingGroupBindingRecord, CreateRoutingGroupRecord, CreateRoutingGroupVersionRecord,
|
||||
RoutingGroupBindingQuery, RoutingGroupLookupKey, StoredRoutingGroup, StoredRoutingGroupBinding,
|
||||
StoredRoutingGroupVersion, UpdateRoutingGroupBindingRecord, UpdateRoutingGroupRecord,
|
||||
};
|
||||
|
||||
use super::AdminAppState;
|
||||
use crate::GatewayError;
|
||||
|
||||
impl<'a> AdminAppState<'a> {
|
||||
pub(crate) async fn list_routing_groups(
|
||||
&self,
|
||||
) -> Result<Vec<StoredRoutingGroup>, GatewayError> {
|
||||
self.app.list_routing_groups().await
|
||||
}
|
||||
|
||||
pub(crate) async fn find_routing_group(
|
||||
&self,
|
||||
lookup: RoutingGroupLookupKey<'_>,
|
||||
) -> Result<Option<StoredRoutingGroup>, GatewayError> {
|
||||
self.app.find_routing_group(lookup).await
|
||||
}
|
||||
|
||||
pub(crate) async fn list_routing_group_bindings(
|
||||
&self,
|
||||
query: &RoutingGroupBindingQuery,
|
||||
) -> Result<Vec<StoredRoutingGroupBinding>, GatewayError> {
|
||||
self.app.list_routing_group_bindings(query).await
|
||||
}
|
||||
|
||||
pub(crate) async fn list_routing_group_versions(
|
||||
&self,
|
||||
group_id: &str,
|
||||
) -> Result<Vec<StoredRoutingGroupVersion>, GatewayError> {
|
||||
self.app.list_routing_group_versions(group_id).await
|
||||
}
|
||||
|
||||
pub(crate) async fn create_routing_group(
|
||||
&self,
|
||||
record: CreateRoutingGroupRecord,
|
||||
) -> Result<Option<StoredRoutingGroup>, GatewayError> {
|
||||
self.app.create_routing_group(record).await
|
||||
}
|
||||
|
||||
pub(crate) async fn update_routing_group(
|
||||
&self,
|
||||
id: &str,
|
||||
patch: UpdateRoutingGroupRecord,
|
||||
) -> Result<Option<StoredRoutingGroup>, GatewayError> {
|
||||
self.app.update_routing_group(id, patch).await
|
||||
}
|
||||
|
||||
pub(crate) async fn delete_routing_group(&self, id: &str) -> Result<bool, GatewayError> {
|
||||
self.app.delete_routing_group(id).await
|
||||
}
|
||||
|
||||
pub(crate) async fn create_routing_group_binding(
|
||||
&self,
|
||||
record: CreateRoutingGroupBindingRecord,
|
||||
) -> Result<Option<StoredRoutingGroupBinding>, GatewayError> {
|
||||
self.app.create_routing_group_binding(record).await
|
||||
}
|
||||
|
||||
pub(crate) async fn update_routing_group_binding(
|
||||
&self,
|
||||
id: &str,
|
||||
patch: UpdateRoutingGroupBindingRecord,
|
||||
) -> Result<Option<StoredRoutingGroupBinding>, GatewayError> {
|
||||
self.app.update_routing_group_binding(id, patch).await
|
||||
}
|
||||
|
||||
pub(crate) async fn delete_routing_group_binding(
|
||||
&self,
|
||||
id: &str,
|
||||
) -> Result<bool, GatewayError> {
|
||||
self.app.delete_routing_group_binding(id).await
|
||||
}
|
||||
|
||||
pub(crate) async fn create_routing_group_version(
|
||||
&self,
|
||||
record: CreateRoutingGroupVersionRecord,
|
||||
) -> Result<Option<StoredRoutingGroupVersion>, GatewayError> {
|
||||
self.app.create_routing_group_version(record).await
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user