pub struct EcsState {Show 14 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>,
}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.
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.
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.