Skip to main content

SemanticModel

Struct SemanticModel 

Source
pub struct SemanticModel {
Show 27 fields pub arena: Arena, pub span_index: HashMap<String, SourceSpan>, pub format_version: Option<String>, pub description: Option<String>, pub transforms: Vec<String>, pub raw_top_level_keys: Vec<String>, pub template_metadata: Option<Value>, pub rules: Option<Value>, pub parsed_rules: Vec<TemplateRule>, pub parameters: HashMap<String, ParameterInfo>, pub mappings: HashMap<String, HashMap<String, HashMap<String, Value>>>, pub conditions: ConditionModel, pub resources: HashMap<String, ResolvedResource>, pub outputs: HashMap<String, ResolvedOutput>, pub graph: ReferenceGraph, pub resources_by_type: HashMap<String, Vec<String>>, pub diagnostics: Vec<ParseDefect>, pub output_empty_joins: Vec<String>, pub sam_globals: HashMap<String, HashMap<String, Value>>, pub sam_implicit_resources: HashSet<String>, pub globals_param_refs: Vec<String>, pub is_cdk: bool, pub fn_if_conditions: Vec<String>, pub find_in_map_names: HashSet<String>, pub params_referenced_in_definitions: HashSet<String>, pub has_dynamic_findinmap_name: bool, pub resolution_sources: HashMap<(String, String), String>, /* private fields */
}

Fields§

§arena: Arena§span_index: HashMap<String, SourceSpan>§format_version: Option<String>§description: Option<String>§transforms: Vec<String>§raw_top_level_keys: Vec<String>§template_metadata: Option<Value>§rules: Option<Value>§parsed_rules: Vec<TemplateRule>§parameters: HashMap<String, ParameterInfo>§mappings: HashMap<String, HashMap<String, HashMap<String, Value>>>§conditions: ConditionModel§resources: HashMap<String, ResolvedResource>§outputs: HashMap<String, ResolvedOutput>§graph: ReferenceGraph§resources_by_type: HashMap<String, Vec<String>>§diagnostics: Vec<ParseDefect>§output_empty_joins: Vec<String>§sam_globals: HashMap<String, HashMap<String, Value>>§sam_implicit_resources: HashSet<String>§globals_param_refs: Vec<String>§is_cdk: bool§fn_if_conditions: Vec<String>§find_in_map_names: HashSet<String>

Mapping names referenced by an Fn::FindInMap with a literal map name, collected template-wide (resources, outputs, conditions, ForEach bodies).

§params_referenced_in_definitions: HashSet<String>

Parameter names referenced from within another parameter’s definition (e.g. a Default of !Ref OtherParam); these still count as usage.

§has_dynamic_findinmap_name: bool

True when any Fn::FindInMap uses a non-literal map name, which disables the unused-mapping check because usage can no longer be attributed to a specific mapping.

§resolution_sources: HashMap<(String, String), String>

Implementations§

Source§

impl SemanticModel

Source

pub fn from_bytes(bytes: &[u8]) -> Result<SemanticModel, ParseError>

Source

pub fn parse( bytes: &[u8], config: ParseConfig, ) -> Result<ParseResult, ParseError>

Source

pub fn resource(&self, id: &str) -> Option<&ResolvedResource>

Source

pub fn lifecycle_attribute_status( &self, resource_id: &str, attribute: &str, ) -> LifecycleAttributeStatus

Reports whether a lifecycle attribute can legally survive condition evaluation, and whether any reachable authored value has a non-object shape. Only UpdatePolicy permits Fn::If to remove the whole attribute with AWS::NoValue; illegal values on the other attributes remain present for downstream diagnostics.

Source

pub fn lifecycle_policy_scenarios( &self, resource_id: &str, attribute: &str, ) -> Vec<(Value, HashMap<String, bool>)>

Expands a lifecycle policy into reachable values while preserving the assumptions for each branch. Whole dynamic leaves are deferred, while a list or object remains invalid regardless of dynamic values nested inside it.

Source

pub fn resources_of_type(&self, type_name: &str) -> &[String]

Source

pub fn resource_condition_is_valid(&self, resource_id: &str) -> bool

Source

pub fn primary_identifier_conflicts( &self, resource_type: &str, identifier_properties: &[String], ) -> Vec<(Vec<String>, BTreeSet<String>)>

Groups resources that can simultaneously resolve to the same primary-identifier tuple. Each displayed tuple is paired with the ordered set of resources participating in at least one satisfiable collision for the corresponding comparison identity.

Source

pub fn condition_is_valid_for_reachability(&self, condition: &str) -> bool

Source

pub fn resolve(&self, resource_id: &str, path: &str) -> Option<&ResolvedValue>

Source

pub fn resolve_deep( &self, resource_id: &str, path: &str, ) -> Option<ResolvedValue>

Source

pub fn is_from_parameter(&self, resource_id: &str, path: &str) -> bool

Source

pub fn parameter_name_at(&self, resource_id: &str, path: &str) -> Option<&str>

The parameter whose declaration stood in for the value at path, or None when the value came from somewhere else. A value that is only known at deployment is not necessarily a parameter - a cross-stack import and a dynamic reference are equally unknown - so callers that describe a value to a reader must ask rather than assume.

Source

pub fn value_identity(&self, resource_id: &str, path: &str) -> Option<String>

A key that two values share only when they are provably the same value, or None when nothing about the value settles the question.

A value that resolves before deployment is keyed by its contents, so the authored form does not matter. A value that stays opaque is keyed by the expression that produces it, because that is the only thing that can show two such values are one value. Callers that compare keys must treat None and two differing keys alike: neither proves the values differ, so neither permits a claim that they are the same.

Source

pub fn is_from_intrinsic(&self, resource_id: &str, path: &str) -> bool

True when the value at path (or any ancestor up to the resource root) was produced by an intrinsic function. Used by rules that skip hardcoded-literal checks when the property value comes from Fn::GetAZs, Ref, etc.

Source

pub fn substituted_paths_under( &self, resource_id: &str, base_path: &str, ) -> HashSet<String>

Source

pub fn scenario_budget_exhausted(&self) -> bool

Whether this model has spent its cumulative scenario-expansion budget. Mirrors ConditionModel::satisfiability_budget_exhausted for the scenario path: callers that drive many resolve_scenarios queries stop producing new scenarios once further expansion would only be truncated.

Source

pub fn record_budget_exhaustion(&self, kind: BudgetKind)

Record that a budget kind was exhausted. Delegates to the shared tracker.

Source

pub fn exhausted_budget_kinds(&self) -> BTreeSet<BudgetKind>

Returns the set of exhausted budget kinds in deterministic order.

Source

pub fn budget_analysis_incomplete(&self) -> bool

Whether any exhausted budget makes the analysis incomplete.

Source

pub fn scenario_combinations_used(&self) -> u64

Cumulative scenarios materialized by this model so far.

Source

pub fn scenario_expansion_curtailed(&self) -> bool

Whether any scenario expansion for this model omitted possible results because a per-value or model-wide analysis limit was reached. The flag is monotonic so callers can distinguish complete expansion from conservative fallback behavior.

Source

pub fn resolve_properties_scenarios( &self, resource_id: &str, ) -> Vec<(ResolvedValue, HashMap<String, bool>)>

Source

pub fn scenario_source_path( &self, resource_id: &str, effective_path: &str, conditions: &HashMap<String, bool>, ) -> Option<String>

Returns the authored, branch-qualified source path for an effective path in one resolved scenario. The returned path uses the same dotted form as resolver source paths and can be passed to Self::resource_span.

Source

pub fn resolve_scenarios( &self, resource_id: &str, path: &str, ) -> Vec<(ResolvedValue, HashMap<String, bool>)>

Source

pub fn resolve_scenarios_with_limit( &self, resource_id: &str, path: &str, per_value_limit: usize, ) -> (Vec<(ResolvedValue, HashMap<String, bool>)>, bool)

Source

pub fn resolve_scenarios_json( &self, resource_id: &str, path: &str, ) -> Vec<(Value, HashMap<String, bool>)>

Source

pub fn follow_ref(&self, resource_id: &str, path: &str) -> Option<&str>

Source

pub fn source_location(&self, path: &str) -> Option<&SourceSpan>

Source

pub fn resource_span(&self, resource_id: &str, prop_path: &str) -> SourceSpan

Returns the source span for a resource property path, falling back to the resource-level span if the specific path is not found.

The span index is keyed with slash-separated paths, so a dotted, resource-relative path (Properties.BucketName) is normalized to slash form before lookup - the same normalization Self::diagnostic_span applies. Callers pass paths in either form, so accepting only slash form here would silently mislocate every dotted-path diagnostic onto the resource declaration line.

Source

pub fn diagnostic_span( &self, resource_id: Option<&str>, property_path: &str, ) -> Option<SourceSpan>

Best-effort span for a diagnostic identified by its optional resource and property path, walking up to the nearest indexed ancestor.

The path form disambiguates how to root it, which matters because a segment like Metadata names both a top-level section and a resource property:

  • A slash form (Outputs/X/Value, Conditions/C/Fn::And) is already an absolute, section-rooted span-index key and is resolved as written.
  • A bare path with no resource (BogusSection) is a top-level key and is also resolved directly.
  • A dotted or bare form with a resource (Properties.Foo, Metadata) is relative to that resource, so it is rooted at Resources/<rid> before lookup - never matched against a same-named top-level section.

Returns None when nothing along the chosen candidate is indexed, so callers can fall back to a section span.

Source

pub fn estimated_string_length_bounds( &self, resource_id: &str, path: &str, ) -> Option<(usize, usize)>

Bounds on the length of a string value the template does not state literally - one built by an intrinsic, or chosen from a parameter’s AllowedValues. None when the length cannot be pinned for every possibility, and also when the template does state the value literally, because schema validation checks a literal against the constraint directly.

Both engines decide what to report from this one answer, so neither can reach a different conclusion about the same property.

Source§

impl SemanticModel

Trait Implementations§

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> AnyExt for T
where T: Any + ?Sized,

Source§

fn downcast_ref<T>(this: &Self) -> Option<&T>
where T: Any,

Attempts to downcast this to T behind reference
Source§

fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>
where T: Any,

Attempts to downcast this to T behind mutable reference
Source§

fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>
where T: Any,

Attempts to downcast this to T behind Rc pointer
Source§

fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>
where T: Any,

Attempts to downcast this to T behind Arc pointer
Source§

fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>
where T: Any,

Attempts to downcast this to T behind Box pointer
Source§

fn downcast_move<T>(this: Self) -> Option<T>
where T: Any, Self: Sized,

Attempts to downcast owned Self to T, useful only in generic context as a workaround for specialization
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T, X> CoerceTo<T> for X
where T: CoerceFrom<X> + ?Sized,

Source§

fn coerce_rc_to(self: Rc<X>) -> Rc<T>

Source§

fn coerce_box_to(self: Box<X>) -> Box<T>

Source§

fn coerce_ref_to(&self) -> &T

Source§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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