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: boolTrue 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
impl SemanticModel
pub fn from_bytes(bytes: &[u8]) -> Result<SemanticModel, ParseError>
pub fn parse( bytes: &[u8], config: ParseConfig, ) -> Result<ParseResult, ParseError>
pub fn resource(&self, id: &str) -> Option<&ResolvedResource>
Sourcepub fn lifecycle_attribute_status(
&self,
resource_id: &str,
attribute: &str,
) -> LifecycleAttributeStatus
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.
Sourcepub fn lifecycle_policy_scenarios(
&self,
resource_id: &str,
attribute: &str,
) -> Vec<(Value, HashMap<String, bool>)>
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.
pub fn resources_of_type(&self, type_name: &str) -> &[String]
pub fn resource_condition_is_valid(&self, resource_id: &str) -> bool
Sourcepub fn primary_identifier_conflicts(
&self,
resource_type: &str,
identifier_properties: &[String],
) -> Vec<(Vec<String>, BTreeSet<String>)>
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.
pub fn condition_is_valid_for_reachability(&self, condition: &str) -> bool
pub fn resolve(&self, resource_id: &str, path: &str) -> Option<&ResolvedValue>
pub fn resolve_deep( &self, resource_id: &str, path: &str, ) -> Option<ResolvedValue>
pub fn is_from_parameter(&self, resource_id: &str, path: &str) -> bool
Sourcepub fn parameter_name_at(&self, resource_id: &str, path: &str) -> Option<&str>
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.
Sourcepub fn value_identity(&self, resource_id: &str, path: &str) -> Option<String>
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.
Sourcepub fn is_from_intrinsic(&self, resource_id: &str, path: &str) -> bool
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.
pub fn substituted_paths_under( &self, resource_id: &str, base_path: &str, ) -> HashSet<String>
Sourcepub fn scenario_budget_exhausted(&self) -> bool
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.
Sourcepub fn record_budget_exhaustion(&self, kind: BudgetKind)
pub fn record_budget_exhaustion(&self, kind: BudgetKind)
Record that a budget kind was exhausted. Delegates to the shared tracker.
Sourcepub fn exhausted_budget_kinds(&self) -> BTreeSet<BudgetKind>
pub fn exhausted_budget_kinds(&self) -> BTreeSet<BudgetKind>
Returns the set of exhausted budget kinds in deterministic order.
Sourcepub fn budget_analysis_incomplete(&self) -> bool
pub fn budget_analysis_incomplete(&self) -> bool
Whether any exhausted budget makes the analysis incomplete.
Sourcepub fn scenario_combinations_used(&self) -> u64
pub fn scenario_combinations_used(&self) -> u64
Cumulative scenarios materialized by this model so far.
Sourcepub fn scenario_expansion_curtailed(&self) -> bool
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.
pub fn resolve_properties_scenarios( &self, resource_id: &str, ) -> Vec<(ResolvedValue, HashMap<String, bool>)>
Sourcepub fn scenario_source_path(
&self,
resource_id: &str,
effective_path: &str,
conditions: &HashMap<String, bool>,
) -> Option<String>
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.
pub fn resolve_scenarios( &self, resource_id: &str, path: &str, ) -> Vec<(ResolvedValue, HashMap<String, bool>)>
pub fn resolve_scenarios_with_limit( &self, resource_id: &str, path: &str, per_value_limit: usize, ) -> (Vec<(ResolvedValue, HashMap<String, bool>)>, bool)
pub fn resolve_scenarios_json( &self, resource_id: &str, path: &str, ) -> Vec<(Value, HashMap<String, bool>)>
pub fn follow_ref(&self, resource_id: &str, path: &str) -> Option<&str>
pub fn source_location(&self, path: &str) -> Option<&SourceSpan>
Sourcepub fn resource_span(&self, resource_id: &str, prop_path: &str) -> SourceSpan
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.
Sourcepub fn diagnostic_span(
&self,
resource_id: Option<&str>,
property_path: &str,
) -> Option<SourceSpan>
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 atResources/<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.
Sourcepub fn estimated_string_length_bounds(
&self,
resource_id: &str,
path: &str,
) -> Option<(usize, usize)>
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
impl SemanticModel
pub fn to_diagnostic_json(&self) -> DiagnosticModel
Trait Implementations§
Source§impl SpanProvider for SemanticModel
impl SpanProvider for SemanticModel
fn source_location(&self, path: &str) -> Option<SourceSpan>
Auto Trait Implementations§
impl !Freeze for SemanticModel
impl RefUnwindSafe for SemanticModel
impl Send for SemanticModel
impl Sync for SemanticModel
impl Unpin for SemanticModel
impl UnsafeUnpin for SemanticModel
impl UnwindSafe for SemanticModel
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer