pub struct EcsService { /* private fields */ }Implementations§
Source§impl EcsService
impl EcsService
Sourcepub fn run_task_external(
&self,
account_id: &str,
cluster: &str,
task_definition: &str,
launch_type: Option<&str>,
count: usize,
) -> Result<(), String>
pub fn run_task_external( &self, account_id: &str, cluster: &str, task_definition: &str, launch_type: Option<&str>, count: usize, ) -> Result<(), String>
Spawn a task from a cross-service caller (EventBridge Scheduler /
EventBridge Rules) without going through the AwsRequest dispatch
path. Builds the JSON body and reuses Self::run_task so all
the existing validation / runtime spawn logic runs identically.
Returns Err with a human-readable message on validation failures —
the caller decides whether to surface the failure (e.g. DLQ).
pub fn run_task( &self, request: &AwsRequest, ) -> Result<AwsResponse, AwsServiceError>
Source§impl EcsService
impl EcsService
pub fn new(state: SharedEcsState) -> Self
pub fn with_snapshot_store(self, store: Arc<dyn SnapshotStore>) -> Self
pub fn with_runtime(self, runtime: Arc<EcsRuntime>) -> Self
pub fn with_role_trust_validator( self, validator: Arc<dyn RoleTrustValidator>, ) -> Self
pub fn state_handle(&self) -> &SharedEcsState
Sourcepub fn snapshot_hook(&self) -> Option<SnapshotHook>
pub fn snapshot_hook(&self) -> Option<SnapshotHook>
Build a hook that persists the current state when invoked, or None in
memory mode. The CloudFormation provisioner mutates state directly and
uses this to write a CFN-provisioned resource through to disk.
Sourcepub async fn reconcile_persisted_tasks(&self)
pub async fn reconcile_persisted_tasks(&self)
Reconcile persisted task state with reality after a fakecloud
restart. Same bug class as RDS #1338: tasks were persisted with
lastStatus = RUNNING but their docker containers are gone, so
DescribeTasks reported phantom-running tasks and docker exec
(for ECS Exec) would fail.
Mark every non-STOPPED task as STOPPED with a stoppedReason
that explains the restart, and reset service runningCount /
pendingCount to zero. The service scheduler ticker then
reconciles desiredCount and launches fresh tasks. Standalone
RunTask tasks aren’t auto-respawned because we don’t have
enough context to replay them safely; callers re-invoke.
Sourcepub async fn reconcile_service_desired_counts(&self)
pub async fn reconcile_service_desired_counts(&self)
Converge every ACTIVE service toward its desiredCount, launching
replacement tasks for any shortfall. Real ECS maintains desiredCount
autonomously; reconcile_persisted_tasks STOPs all tasks and zeroes
counts on restart “trusting a scheduler ticker,” but no such ticker
existed, so services with desiredCount=N stayed at runningCount=0
forever. This is that ticker. It also re-launches tasks lost to crashed
containers during normal operation. bug-audit 2026-06-15, 4.7.
One pass: for each service, count its non-STOPPED tasks (matched by the
ecs-svc/<name> started_by tag, same as recompute_service_counts);
if that count is below desiredCount, spawn the difference via the
shared spawn_service_tasks path and hand the new task IDs to the
runtime. Persist only when something was launched.
Trait Implementations§
Source§impl AwsService for EcsService
impl AwsService for EcsService
Source§fn service_name(&self) -> &str
fn service_name(&self) -> &str
Source§fn handle<'life0, 'async_trait>(
&'life0 self,
request: AwsRequest,
) -> Pin<Box<dyn Future<Output = Result<AwsResponse, AwsServiceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle<'life0, 'async_trait>(
&'life0 self,
request: AwsRequest,
) -> Pin<Box<dyn Future<Output = Result<AwsResponse, AwsServiceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn supported_actions(&self) -> &[&str]
fn supported_actions(&self) -> &[&str]
Source§fn iam_enforceable(&self) -> bool
fn iam_enforceable(&self) -> bool
FAKECLOUD_IAM=soft|strict). Read moreSource§fn iam_action_for(&self, _request: &AwsRequest) -> Option<IamAction>
fn iam_action_for(&self, _request: &AwsRequest) -> Option<IamAction>
Source§fn iam_condition_keys_for(
&self,
_request: &AwsRequest,
_action: &IamAction,
) -> BTreeMap<String, Vec<String>>
fn iam_condition_keys_for( &self, _request: &AwsRequest, _action: &IamAction, ) -> BTreeMap<String, Vec<String>>
resource_arn. Read morex-amz-tagging, TagResource). Read moreAuto Trait Implementations§
impl !RefUnwindSafe for EcsService
impl !UnwindSafe for EcsService
impl Freeze for EcsService
impl Send for EcsService
impl Sync for EcsService
impl Unpin for EcsService
impl UnsafeUnpin for EcsService
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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>
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>
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