Skip to main content

EcsRuntime

Struct EcsRuntime 

Source
pub struct EcsRuntime { /* private fields */ }
Expand description

Docker/Podman executor for ECS tasks.

Implementations§

Source§

impl EcsRuntime

Source

pub fn with_secretsmanager(self, state: SharedSecretsManagerState) -> Self

Wire SecretsManager state so secrets[].valueFrom entries pointing at SecretsManager ARNs resolve at task launch.

Source

pub fn with_ssm(self, state: SharedSsmState) -> Self

Wire SSM state so secrets[].valueFrom entries pointing at Parameter Store ARNs resolve at task launch.

Source§

impl EcsRuntime

Source

pub fn run_task( self: Arc<Self>, state: SharedEcsState, task_id: String, account_id: String, )

Spawn the task asynchronously. Returns immediately after transitioning the task to PENDING; the background task advances it to RUNNING once the container is created and to STOPPED once the container exits.

Source

pub async fn run_task_inner( &self, state: &SharedEcsState, task_id: &str, account_id: &str, ) -> Result<(), RuntimeError>

Source

pub async fn stop_task(&self, task_id: &str, reason: &str) -> bool

Kill every container behind a task with the configured stop timeout. Returns true if at least one container was killed. Called synchronously from StopTask; the wait loop in run_task_inner observes the exits and transitions the task to STOPPED.

Source

pub async fn stop_all(&self)

Kill every running container the runtime owns. Called on reset / shutdown so docker state matches fakecloud state after a fresh boot.

Source§

impl EcsRuntime

Source

pub fn new(server_port: u16) -> Option<Self>

Auto-detect Docker or Podman. Returns None if neither is available. Honours FAKECLOUD_CONTAINER_CLI for explicit override. server_port is the port the main fakecloud server bound to; needed to resolve AWS ECR URIs against the local OCI v2 registry.

Source

pub async fn new_k8s(server_port: u16) -> Result<Self, BackendInitError>

Construct the Kubernetes backend. server_port is fakecloud’s bound port (used when FAKECLOUD_K8S_SELF_URL omits one). Fails fast on misconfiguration — never silently degrades to Docker.

Source

pub fn cli_name(&self) -> &str

Backend name for logging.

Source

pub async fn reap_stale(&self)

Sweep task Pods orphaned by a previous process (k8s only; no-op on the Docker backend, handled by the shared container reaper).

Source

pub fn with_delivery_bus(self, bus: Arc<DeliveryBus>) -> Self

Wire EventBridge delivery so task state transitions emit aws.ecs / ECS Task State Change events.

Source

pub fn with_logs(self, logs: SharedLogsState) -> Self

Wire CloudWatch Logs state so tasks using the awslogs driver get their captured stdout/stderr forwarded.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more