pub struct PromotionService { /* private fields */ }Expand description
Promotion service for managing promotions between environments
Implementations§
Source§impl PromotionService
impl PromotionService
Sourcepub fn with_gitops(db: Pool<Sqlite>, gitops: PromotionGitOpsConfig) -> Self
pub fn with_gitops(db: Pool<Sqlite>, gitops: PromotionGitOpsConfig) -> Self
Create a new promotion service with GitOps support
Sourcepub async fn run_migrations(&self) -> Result<()>
pub async fn run_migrations(&self) -> Result<()>
Run database migrations for promotion tables
This ensures the promotion_history and environment_permission_policies tables exist.
Should be called during service initialization.
Sourcepub async fn record_promotion(
&self,
request: &PromotionRequest,
promoted_by: Uuid,
status: PromotionStatus,
workspace_config: Option<Value>,
) -> Result<Uuid>
pub async fn record_promotion( &self, request: &PromotionRequest, promoted_by: Uuid, status: PromotionStatus, workspace_config: Option<Value>, ) -> Result<Uuid>
Record a promotion in the history and optionally create a GitOps PR
Sourcepub async fn update_promotion_status(
&self,
promotion_id: Uuid,
status: PromotionStatus,
approved_by: Option<Uuid>,
) -> Result<()>
pub async fn update_promotion_status( &self, promotion_id: Uuid, status: PromotionStatus, approved_by: Option<Uuid>, ) -> Result<()>
Update promotion status (e.g., when approved or rejected)
Sourcepub async fn update_promotion_pr_url(
&self,
promotion_id: Uuid,
pr_url: String,
) -> Result<()>
pub async fn update_promotion_pr_url( &self, promotion_id: Uuid, pr_url: String, ) -> Result<()>
Update promotion with GitOps PR URL
Sourcepub async fn get_promotion_by_id(
&self,
promotion_id: Uuid,
) -> Result<Option<PromotionHistoryEntry>>
pub async fn get_promotion_by_id( &self, promotion_id: Uuid, ) -> Result<Option<PromotionHistoryEntry>>
Get a promotion by ID
Sourcepub async fn get_promotion_history(
&self,
workspace_id: &str,
entity_type: PromotionEntityType,
entity_id: &str,
) -> Result<PromotionHistory>
pub async fn get_promotion_history( &self, workspace_id: &str, entity_type: PromotionEntityType, entity_id: &str, ) -> Result<PromotionHistory>
Get promotion history for an entity
Sourcepub async fn get_workspace_promotions(
&self,
workspace_id: &str,
limit: Option<i64>,
) -> Result<Vec<PromotionHistoryEntry>>
pub async fn get_workspace_promotions( &self, workspace_id: &str, limit: Option<i64>, ) -> Result<Vec<PromotionHistoryEntry>>
Get all promotions for a workspace
Sourcepub async fn get_pending_promotions(
&self,
workspace_id: Option<&str>,
) -> Result<Vec<PromotionHistoryEntry>>
pub async fn get_pending_promotions( &self, workspace_id: Option<&str>, ) -> Result<Vec<PromotionHistoryEntry>>
Get pending promotions requiring approval
Trait Implementations§
Source§impl PromotionService for PromotionService
impl PromotionService for PromotionService
Source§fn promote_entity<'life0, 'async_trait>(
&'life0 self,
workspace_id: Uuid,
entity_type: PromotionEntityType,
entity_id: String,
entity_version: Option<String>,
from_environment: MockEnvironmentName,
to_environment: MockEnvironmentName,
promoted_by: Uuid,
comments: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn promote_entity<'life0, 'async_trait>(
&'life0 self,
workspace_id: Uuid,
entity_type: PromotionEntityType,
entity_id: String,
entity_version: Option<String>,
from_environment: MockEnvironmentName,
to_environment: MockEnvironmentName,
promoted_by: Uuid,
comments: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Promote an entity from one environment to another
Auto Trait Implementations§
impl Freeze for PromotionService
impl !RefUnwindSafe for PromotionService
impl Send for PromotionService
impl Sync for PromotionService
impl Unpin for PromotionService
impl !UnwindSafe for PromotionService
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more