infrahub_sdk.node.related_node
Classes
RelatedNodeBase
Base class for representing a related node in a relationship.
Methods:
id
id(self) -> str | None
Return the parsed peer id without triggering a store lookup.
Returns None when the response carried only hfid_str (no id, no peer) — in that case .peer.id would resolve through the store and yield a non-None id, so .id and .peer.id are NOT interchangeable.
hfid
hfid(self) -> list[Any] | None
hfid_str
hfid_str(self) -> str | None
is_resource_pool
is_resource_pool(self) -> bool
initialized
initialized(self) -> bool
display_label
display_label(self) -> str | None
typename
typename(self) -> str | None
kind
kind(self) -> str | None
is_from_profile
is_from_profile(self) -> bool
Return whether this relationship was set from a profile. Done by checking if the source is of a profile kind.
get_relationship_metadata
get_relationship_metadata(self) -> RelationshipMetadata | None
Returns the relationship metadata (updated_at, updated_by) if fetched.
RelatedNode
Represents a RelatedNodeBase in an asynchronous context.
Methods:
fetch
fetch(self, timeout: int | None = None) -> None
peer
peer(self) -> InfrahubNode
Return the peer node, or raise ValueError if no identifier is available.
get
get(self) -> InfrahubNode
Return the peer node, performing a store lookup if not materialized.
When resolving via hfid_str the returned node has a non-None id even when this RelatedNode's .id is None — that is the case in which .peer.id and .id diverge.
Raises:
ValueError: when neither a peer, (_id, _typename), nor hfid_str is available.
RelatedNodeSync
Represents a related node in a synchronous context.
Methods:
fetch
fetch(self, timeout: int | None = None) -> None
peer
peer(self) -> InfrahubNodeSync
Return the peer node, or raise ValueError if no identifier is available.
get
get(self) -> InfrahubNodeSync
Return the peer node, performing a store lookup if not materialized.
When resolving via hfid_str the returned node has a non-None id even when this RelatedNode's .id is None — that is the case in which .peer.id and .id diverge.
Raises:
ValueError: when neither a peer, (_id, _typename), nor hfid_str is available.