infrahub_sdk.spec.object
Functions
validate_list_of_scalars
validate_list_of_scalars(value: list[Any]) -> bool
validate_list_of_hfids
validate_list_of_hfids(value: list[Any]) -> bool
validate_list_of_data_dicts
validate_list_of_data_dicts(value: list[Any]) -> bool
validate_list_of_objects
validate_list_of_objects(value: list[Any]) -> bool
get_relationship_info
get_relationship_info(client: InfrahubClient, schema: MainSchemaTypesAPI, name: str, value: Any, branch: str | None = None) -> RelationshipInfo
Get the relationship info for a given relationship name.
Classes
RelationshipDataFormat
RelationshipInfo
Methods:
is_bidirectional
is_bidirectional(self) -> bool
Indicate if a relationship with the same identifier exists on the other side
is_mandatory
is_mandatory(self) -> bool
is_valid
is_valid(self) -> bool
is_reference
is_reference(self) -> bool
get_context
get_context(self, value: Any) -> dict
Return a dict to insert to the context if the relationship is mandatory
find_matching_relationship
find_matching_relationship(self, peer_schema: MainSchemaTypesAPI, force: bool = False) -> RelationshipSchema | None
Find the matching relationship on the other side of the relationship
InfrahubObjectFileData
Methods:
validate_format
validate_format(self, client: InfrahubClient, branch: str | None = None) -> list[ObjectValidationError]
process
process(self, client: InfrahubClient, branch: str | None = None) -> None
validate_object
validate_object(cls, client: InfrahubClient, schema: MainSchemaTypesAPI, data: dict, position: list[int | str], context: dict | None = None, branch: str | None = None, default_schema_kind: str | None = None) -> list[ObjectValidationError]
validate_related_nodes
validate_related_nodes(cls, client: InfrahubClient, position: list[int | str], rel_info: RelationshipInfo, data: dict | list[dict], context: dict | None = None, branch: str | None = None, default_schema_kind: str | None = None) -> list[ObjectValidationError]
enrich_node
enrich_node(cls, data: dict, context: dict) -> dict
create_node
create_node(cls, client: InfrahubClient, schema: MainSchemaTypesAPI, data: dict, position: list[int | str], context: dict | None = None, branch: str | None = None, default_schema_kind: str | None = None) -> InfrahubNode
create_related_nodes
create_related_nodes(cls, client: InfrahubClient, rel_info: RelationshipInfo, position: list[int | str], data: dict | list[dict], parent_node: InfrahubNode | None = None, context: dict | None = None, branch: str | None = None, default_schema_kind: str | None = None) -> list[InfrahubNode]
get_peer_schema
get_peer_schema(cls, client: InfrahubClient, peer_kind: str, branch: str | None = None, default_schema_kind: str | None = None) -> MainSchemaTypesAPI
ObjectFile
Methods:
spec
spec(self) -> InfrahubObjectFileData
validate_content
validate_content(self) -> None
validate_format
validate_format(self, client: InfrahubClient, branch: str | None = None) -> None
process
process(self, client: InfrahubClient, branch: str | None = None) -> None