pub struct EcsState {Show 19 fields
pub account_id: String,
pub region: String,
pub clusters: BTreeMap<String, Cluster>,
pub task_definitions: BTreeMap<String, BTreeMap<i32, TaskDefinition>>,
pub next_revision: BTreeMap<String, i32>,
pub account_setting_defaults: BTreeMap<String, String>,
pub principal_account_settings: BTreeMap<String, BTreeMap<String, String>>,
pub tasks: BTreeMap<String, Task>,
pub events: Vec<LifecycleEvent>,
pub services: BTreeMap<String, Service>,
pub container_instances: BTreeMap<String, ContainerInstance>,
pub attributes: BTreeMap<String, Attribute>,
pub capacity_providers: BTreeMap<String, CapacityProvider>,
pub task_sets: BTreeMap<String, TaskSet>,
pub daemon_task_definitions: BTreeMap<String, BTreeMap<i32, DaemonTaskDefinition>>,
pub next_daemon_revision: BTreeMap<String, i32>,
pub daemons: BTreeMap<String, Daemon>,
pub daemon_deployments: BTreeMap<String, DaemonDeployment>,
pub express_gateway_services: BTreeMap<String, ExpressGatewayService>,
}Fields§
§account_id: String§region: String§clusters: BTreeMap<String, Cluster>Cluster state keyed by cluster name.
task_definitions: BTreeMap<String, BTreeMap<i32, TaskDefinition>>Task definitions keyed by family -> revision -> definition.
ECS revisions monotonically increase per-family regardless of
deregistration, so we track the running counter separately.
next_revision: BTreeMap<String, i32>Running revision counter per family. Grows monotonically even after task definitions are deregistered or deleted.
account_setting_defaults: BTreeMap<String, String>Account-default settings (PutAccountSettingDefault). Keyed by
setting name (e.g. serviceLongArnFormat).
principal_account_settings: BTreeMap<String, BTreeMap<String, String>>Per-principal account settings (PutAccountSetting). Keyed by principal ARN, then setting name.
tasks: BTreeMap<String, Task>Tasks keyed by task ID (the trailing segment of the task ARN).
events: Vec<LifecycleEvent>Lifecycle event log for introspection. Bounded at 1024 entries (oldest dropped) so long-running servers don’t grow unboundedly.
services: BTreeMap<String, Service>Services keyed by service name within an account. ECS requires
unique service names per cluster, and since service names are
already unique per-cluster globally we scope keys by
cluster_name:service_name in EcsState::service_key.
container_instances: BTreeMap<String, ContainerInstance>Container instances keyed by cluster/arn-suffix. Users register
EC2 hosts here; fakecloud still runs tasks via Docker regardless,
but the control-plane records remain so DescribeContainerInstances
round-trips.
attributes: BTreeMap<String, Attribute>Custom attributes keyed by cluster/target-arn-or-id/name.
capacity_providers: BTreeMap<String, CapacityProvider>Capacity providers keyed by name.
task_sets: BTreeMap<String, TaskSet>Task sets keyed by cluster/service/task-set-id.
daemon_task_definitions: BTreeMap<String, BTreeMap<i32, DaemonTaskDefinition>>Daemon task definitions keyed by family -> revision -> definition.
Same shape as task_definitions but isolated since daemon defs use
the dedicated RegisterDaemonTaskDefinition op and have their own
revision counter.
next_daemon_revision: BTreeMap<String, i32>Per-family monotonic revision counter for daemon task defs.
daemons: BTreeMap<String, Daemon>Daemons keyed by cluster/daemon-name. Daemons are cluster-scoped
and run one task per matching capacity provider per AWS spec.
daemon_deployments: BTreeMap<String, DaemonDeployment>Daemon deployment history keyed by deployment ARN. Each CreateDaemon / UpdateDaemon mints a new deployment record.
express_gateway_services: BTreeMap<String, ExpressGatewayService>Express Gateway services keyed by cluster/service-name. The
2026 Express Gateway feature is a serverless container service
with built-in load balancing and autoscaling.
Implementations§
Source§impl EcsState
impl EcsState
pub fn new(account_id: &str, region: &str) -> Self
pub fn reset(&mut self)
Sourcepub fn service_key(cluster_name: &str, service_name: &str) -> String
pub fn service_key(cluster_name: &str, service_name: &str) -> String
Services are uniquely identified by (cluster, name) within an
account; this helper composes the storage key used in
self.services.
pub fn service_arn(&self, cluster_name: &str, service_name: &str) -> String
pub fn task_arn(&self, cluster_name: &str, task_id: &str) -> String
pub fn container_instance_arn( &self, cluster_name: &str, instance_id: &str, ) -> String
Sourcepub fn effective_account_setting(
&self,
name: &str,
principal_arn: Option<&str>,
) -> Option<String>
pub fn effective_account_setting( &self, name: &str, principal_arn: Option<&str>, ) -> Option<String>
Resolve the effective value of an account setting. Principal
overrides win over account-level defaults, matching AWS’s
PutAccountSetting / PutAccountSettingDefault layering. With no
principal_arn argument the caller gets the account default.
Sourcepub fn push_event(&mut self, event: LifecycleEvent)
pub fn push_event(&mut self, event: LifecycleEvent)
Append a lifecycle event, trimming the oldest when the cap is hit.
pub fn cluster_arn(&self, cluster_name: &str) -> String
pub fn task_definition_arn(&self, family: &str, revision: i32) -> String
Sourcepub fn resolve_cluster_name(input: Option<&str>) -> String
pub fn resolve_cluster_name(input: Option<&str>) -> String
Given a user-supplied cluster reference (name or ARN), return the
cluster name. Defaults to "default" when None/empty, matching
the AWS CLI behaviour.
Sourcepub fn allocate_revision(&mut self, family: &str) -> i32
pub fn allocate_revision(&mut self, family: &str) -> i32
Bump and return the next revision number for a family. Never reused: monotonically increases even across deregistration.
Source§impl EcsState
impl EcsState
Sourcepub fn daemon_key(cluster: &str, name: &str) -> String
pub fn daemon_key(cluster: &str, name: &str) -> String
Composite key for daemon storage (cluster_name/daemon_name).
Sourcepub fn express_gateway_key(cluster: &str, name: &str) -> String
pub fn express_gateway_key(cluster: &str, name: &str) -> String
Composite key for express-gateway storage (cluster_name/service_name).
Sourcepub fn allocate_daemon_revision(&mut self, family: &str) -> i32
pub fn allocate_daemon_revision(&mut self, family: &str) -> i32
Allocate the next monotonic revision for a daemon task family.
Sourcepub fn daemon_arn(&self, cluster: &str, name: &str) -> String
pub fn daemon_arn(&self, cluster: &str, name: &str) -> String
Build a daemon ARN for a (cluster, name) pair under this account/region.
Sourcepub fn express_gateway_arn(&self, cluster: &str, name: &str) -> String
pub fn express_gateway_arn(&self, cluster: &str, name: &str) -> String
Build an express-gateway service ARN.
Sourcepub fn daemon_task_definition_arn(&self, family: &str, revision: i32) -> String
pub fn daemon_task_definition_arn(&self, family: &str, revision: i32) -> String
Build a daemon task definition ARN for a family:revision pair.
Sourcepub fn daemon_deployment_arn(
&self,
daemon_name: &str,
deployment_id: &str,
) -> String
pub fn daemon_deployment_arn( &self, daemon_name: &str, deployment_id: &str, ) -> String
Build a daemon deployment ARN.
Trait Implementations§
Source§impl AccountState for EcsState
impl AccountState for EcsState
Source§fn new_for_account(account_id: &str, region: &str, _endpoint: &str) -> Self
fn new_for_account(account_id: &str, region: &str, _endpoint: &str) -> Self
Source§fn inherit_from(&mut self, _sibling: &Self)
fn inherit_from(&mut self, _sibling: &Self)
MultiAccountState::get_or_create,
with a reference to an existing sibling state. Services can override
this to propagate shared resources (e.g. body caches) to the new state.Source§impl<'de> Deserialize<'de> for EcsState
impl<'de> Deserialize<'de> for EcsState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for EcsState
impl RefUnwindSafe for EcsState
impl Send for EcsState
impl Sync for EcsState
impl Unpin for EcsState
impl UnsafeUnpin for EcsState
impl UnwindSafe for EcsState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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