OpenFactory Infrastructure Schemas#
Pydantic schemas for validating OpenFactory infrastructure configuration files.
- class openfactory.schemas.infra.IPAM(**data)[source]#
Bases:
BaseModelIPAM Schema.
-
config:
list[IPAMConfig]#
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
config:
- class openfactory.schemas.infra.IPAMConfig(**data)[source]#
Bases:
BaseModelIPAM Configuration Schema.
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class openfactory.schemas.infra.InfrastructureSchema(**data)[source]#
Bases:
BaseModelInfrastructure Schema.
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class openfactory.schemas.infra.Managers(root=PydanticUndefined, **data)[source]#
Bases:
RootModel[Dict[str, Node]]Docker Swarm Managers Schema.
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class openfactory.schemas.infra.Network(**data)[source]#
Bases:
BaseModelNetwork Schema.
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class openfactory.schemas.infra.Networks(**data)[source]#
Bases:
BaseModelNetworks Schema.
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class openfactory.schemas.infra.Node(**data)[source]#
Bases:
BaseModelDocker Swarm Node Schema.
-
ip:
IPv4Address#
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
ip:
- class openfactory.schemas.infra.Nodes(**data)[source]#
Bases:
BaseModelDocker Swarm Nodes Schema.
- classmethod check_unique_ips(values)[source]#
Validates that IP addresses are unique across managers and workers.
- Return type:
- Parameters:
values (Dict) – Dictionary of values to validate.
- Returns:
Dict – Validated values.
- Raises:
ValueError – If IP addresses are not unique.
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class openfactory.schemas.infra.Volume(**data)[source]#
Bases:
BaseModelVolume Schema.
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class openfactory.schemas.infra.Volumes(root=PydanticUndefined, **data)[source]#
Bases:
RootModel[Dict[str, Union[Volume, NoneType]]]Volumes Schema.
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class openfactory.schemas.infra.Workers(root=PydanticUndefined, **data)[source]#
Bases:
RootModel[Dict[str, Node]]Docker Swarm Workers Schema.
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- openfactory.schemas.infra.get_infrastructure_from_config_file(infra_yaml_config_file)[source]#
Load and validate infrastructure configuration from a YAML file.
This function reads a YAML file containing infrastructure configuration, validates its content using the
InfrastructureSchemaPydantic model, and returns the parsed data as a dictionary.- Return type:
- Parameters:
infra_yaml_config_file (str) – Path to the YAML file defining the infrastructure configuration.
- Returns:
Optional[Dict[str, InfrastructureSchema]] –
- A dictionary of validated infrastructure configuration data,
or None if validation fails.
Note
In case of validation errors, user notifications will be triggered and None will be returned.