schemas_v1_db_queries_provider - OmniCloudOrg/OmniOrchestrator GitHub Wiki
Path: src/schemas/v1/db/queries/provider.rs
- async fn get_providers_paginated
- async fn get_provider_count
- async fn get_provider_audit_logs_paginated
- async fn get_provider_audit_log_count
- async fn get_provider_instances
- async fn get_provider_instance_count
pub async fn get_providers_paginated(
pool: &Pool<MySql>,
page: i64,
page_size: i64,
) -> anyhow::Result<Vec<Provider>> {
// ... function body
}
Retrieves a paginated list of providers from the database.
pub async fn get_provider_count(pool: &Pool<MySql>) -> anyhow::Result<i64> {
let query = sqlx::query_scalar::<_, i64>("SELECT COUNT(*) FROM providers");
Counts the total number of providers in the database.
pub async fn get_provider_audit_logs_paginated(
pool: &Pool<MySql>,
provider_id: i64,
page: i64,
per_page: i64,
) -> anyhow::Result<Vec<ProviderAuditLog>> {
// ... function body
}
Retrieves a pagnated list of audit logs for a specific provider.
-
pool
- The database connection pool. -
provider_id
- The ID of the provider to retrieve audit logs for. -
page
- The page number to retrieve. -
per_page
- The number of audit logs to retrieve per page.
A JSON response containing the list of audit logs and pagination information.
pub async fn get_provider_audit_log_count(
pool: &Pool<MySql>,
provider_id: i64,
) -> anyhow::Result<i64> {
// ... function body
}
Counts the total number of audit logs for a given provider.
pub async fn get_provider_instances(
pool: &Pool<MySql>,
provider_id: i64,
page: i64,
page_size: i64,
) -> anyhow::Result<Vec<Instance>> {
// ... function body
}
Fetch all the instances a provider is responsible for via the regions table between them, with pagination
pub async fn get_provider_instance_count(
pool: &Pool<MySql>,
provider_id: i64,
) -> anyhow::Result<i64> {
// ... function body
}
Counts the total number of instances associated with a provider.