infrahub_sdk.node.attribute
Classes
Attribute
Represents an attribute of a Node, including its schema, value, and properties.
An Attribute wraps a single attribute on an :class:InfrahubNode. It tracks the
current value, the metadata properties (source, owner, is_protected, ...),
and whether the value has been mutated since the node was loaded. Mutation tracking is
used by InfrahubNode.update() to send only the changed fields to the API.
Attributes:
name: The name of the attribute.id: The unique identifier of the attribute, when known.value: The current attribute value. Setting this marks the attribute as mutated.value_has_been_mutated: True whenvaluehas been assigned after construction.is_default: True when the value comes from the schema default.is_from_profile: True when the value is inherited from a profile.is_inherited: True when the attribute is inherited from a generic.is_protected: True when the attribute is protected from modification.updated_at: ISO-8601 timestamp of the most recent update.source: The node that supplied this attribute value.owner: The node that owns this attribute.updated_by: The account that performed the most recent update.
Methods:
value
value(self) -> Any
value
value(self, value: Any) -> None
is_from_pool_attribute
is_from_pool_attribute(self) -> bool
Check whether this attribute's value is sourced from a resource pool.
Returns:
- True if the attribute value is a resource pool node or was explicitly allocated from a pool.
is_unresolved_pool_attribute
is_unresolved_pool_attribute(self) -> bool
Return True when pool-backed but no concrete scalar value is available yet.
A pool-backed attribute is unresolved when:
- its value is a pool node object (the pool reference itself, not an allocated scalar), or
- its value is None and the from_pool allocation dict is set.
An attribute whose _from_pool dict is set but whose value has already been populated with the allocated scalar (e.g. after a prior save) is considered resolved.