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<()>
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
§Errors
Returns an error if the database insert fails.
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)
§Errors
Returns an error if the database update fails.
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<()>
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>>
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
§Errors
Returns an error if the database query fails or data is invalid.
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
§Errors
Returns an error if the database query fails or data is invalid.
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
§Errors
Returns an error if the database query fails or data is invalid.
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 UnsafeUnpin for PromotionService
impl !UnwindSafe for PromotionService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§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