xml/schema/projects/aif.xsd

295 lines
18 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema targetNamespace="https://aif-ng.io/"
xmlns="https://aif-ng.io/"
xmlns:aif="https://aif-ng.io/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:include schemaLocation="../lib/types/aif.xsd"/>
<!-- ROOT -->
<xs:element name="aif">
<xs:complexType>
<xs:all>
<!-- BEGIN BOOTSTRAP -->
<xs:element name="bootstrap" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element name="tarball" minOccurs="1" maxOccurs="1" type="t_net_generic_resource"/>
<xs:element name="verify" minOccurs="0" maxOccurs="1" type="t_sys_verifyfile"/>
</xs:all>
</xs:complexType>
</xs:element>
<!-- END BOOTSTRAP -->
<!-- BEGIN STORAGE -->
<xs:element name="storage" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:all>
<!-- BEGIN BLOCKDEVICES -->
<xs:element name="blockDevices" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="disk" minOccurs="1" maxOccurs="unbounded" type="t_linux_disk">
<xs:unique name="uniq_diskdev">
<xs:selector xpath="aif:disk"/>
<xs:field xpath="@device"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- END DISK -->
<!-- BEGIN FILESYSTEMS -->
<xs:element name="fileSystems" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="fs" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="opt" minOccurs="0" maxOccurs="unbounded"
type="t_std_cmdopts"/>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="source" type="xs:IDREF" use="required"/>
<!-- We validate this in-code because there's way too many and
it's way too variable per-host. -->
<xs:attribute name="type" type="t_std_nonempty" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- END FILESYSTEMS -->
<!-- BEGIN LUKS -->
<xs:element name="luks" minOccurs="0" maxOccurs="1" type="t_linux_luks">
<xs:unique name="uniq_luks_name">
<xs:selector xpath="aif:luksDev"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
<!-- END LUKS -->
<!-- BEGIN LVM -->
<xs:element name="lvm" minOccurs="0" maxOccurs="1" type="t_linux_lvm">
<xs:unique name="uniq_vg_names">
<xs:selector xpath="aif:volumeGroup"/>
<xs:field xpath="@name"/>
</xs:unique>
<xs:unique name="uniq_vg_lv">
<xs:selector xpath=".//aif:lv"/>
<xs:field xpath="@name"/>
</xs:unique>
<xs:unique name="uniq_vg_pv">
<xs:selector xpath=".//aif:pv"/>
<xs:field xpath="@source"/>
</xs:unique>
</xs:element>
<!-- END LVM -->
<!-- BEGIN MDADM -->
<xs:element name="mdadm" minOccurs="0" maxOccurs="1" type="t_linux_mdadm">
<xs:unique name="uniq_array_name">
<xs:selector xpath="aif:array"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
<!-- END MDADM -->
<!-- BEGIN MOUNTPOINTS -->
<xs:element name="mountPoints" minOccurs="1" maxOccurs="1" type="t_linux_mounts">
<xs:unique name="uniq_mnts_src">
<xs:selector xpath="aif:mount"/>
<xs:field xpath="@source"/>
</xs:unique>
<xs:unique name="uniq_mnts_tgt">
<xs:selector xpath="aif:mount"/>
<xs:field xpath="@target"/>
</xs:unique>
</xs:element>
<!-- END MOUNTPOINTS -->
</xs:all>
</xs:complexType>
</xs:element>
<!-- END STORAGE -->
<!-- BEGIN NETWORK -->
<xs:element name="network" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="ethernet" type="t_aif_iface" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="wireless" type="t_aif_iface_wifi" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
<!-- It's nearly impossible to validate FQDNs/hostnames in XSD, so we do it in-code. -->
<xs:attribute name="hostname" type="t_std_nonempty" use="required"/>
<xs:attribute name="provider" type="t_aif_netprov" use="optional" default="networkd"/>
<xs:attribute name="dhcpClient" type="t_aif_dhcp_clients" use="optional" default="dhcpcd"/>
</xs:complexType>
<xs:unique name="uniq_iface_eth">
<xs:selector xpath="aif:ethernet|aif:wireless"/>
<xs:field xpath="@device"/>
</xs:unique>
</xs:element>
<!-- END NETWORK -->
<!-- BEGIN SYSTEM -->
<xs:element name="system" maxOccurs="1" minOccurs="1">
<xs:complexType>
<xs:all>
<xs:element name="rootPassword" minOccurs="0" maxOccurs="1" type="t_linux_nixpass"/>
<xs:element name="locales" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="locale" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attribute name="name" type="t_std_nonempty" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="console" minOccurs="0" maxOccurs="1">
<!-- vconsole.conf(5) -->
<!-- timezone and kbd/xkbd are validated in-code. -->
<xs:complexType>
<xs:all minOccurs="1">
<!-- These are validated in-code -->
<xs:element name="keyboard" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:choice>
<xs:element name="map" minOccurs="0" maxOccurs="1"
type="t_std_nonempty" default="us"/>
<xs:element name="toggle" minOccurs="0" maxOccurs="1"
type="t_std_nonempty"/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="text" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="3">
<xs:element name="font" minOccurs="0" maxOccurs="1"
type="t_std_nonempty"/>
<xs:element name="map" minOccurs="0" maxOccurs="1"
type="t_std_nonempty"/>
<xs:element name="unicodeMap" minOccurs="0" maxOccurs="1"
type="t_std_nonempty"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="users" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="user" minOccurs="1" maxOccurs="unbounded"
type="t_linux_user"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniq_usr">
<xs:selector xpath="aif:user"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
<xs:element name="services" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="service" minOccurs="1" maxOccurs="unbounded"
type="t_linux_service"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniq_svc">
<xs:selector xpath="aif:service"/>
<xs:field xpath="@name"/>
<xs:field xpath="@status"/>
</xs:unique>
</xs:element>
</xs:all>
<xs:attribute name="timezone" type="t_std_nonempty" use="optional" default="UTC"/>
</xs:complexType>
</xs:element>
<!-- END SYSTEM -->
<!-- BEGIN PACMAN -->
<xs:element name="pacman" maxOccurs="1" minOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="mirrorList" maxOccurs="1" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="mirror" type="t_aif_pacuri" maxOccurs="unbounded"
minOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="repos" maxOccurs="1" minOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="repo" maxOccurs="unbounded" minOccurs="1">
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="include" minOccurs="0" maxOccurs="unbounded"
type="t_aif_pacuri"/>
<xs:element name="mirror" minOccurs="0" maxOccurs="unbounded"
type="t_aif_pacuri"/>
</xs:choice>
<xs:attribute name="name" type="t_std_nonempty" use="required"/>
<xs:attribute name="enabled" type="xs:boolean" use="optional"
default="true"/>
<xs:attribute name="sigLevel" type="t_std_nonempty" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniq_repo">
<xs:selector xpath="aif:repo"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
<xs:element name="software" maxOccurs="1" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="package" maxOccurs="unbounded" minOccurs="1"
type="t_linux_package"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniq_mirror">
<xs:selector xpath="aif:mirrorList"/>
<xs:field xpath="mirror"/>
</xs:unique>
<xs:unique name="uniq_pkg">
<xs:selector xpath="aif:software"/>
<xs:field xpath="package"/>
</xs:unique>
</xs:element>
</xs:sequence>
<xs:attribute name="command" type="t_std_nonempty" use="optional" default="pacman -S"/>
</xs:complexType>
</xs:element>
<!-- END PACMAN -->
<!-- BEGIN BOOTLOADER -->
<xs:element name="bootloader" maxOccurs="1" minOccurs="1">
<xs:complexType>
<xs:attribute name="type" type="t_aif_bootloaders" use="required"/>
<xs:attribute name="target" type="t_std_nonempty" use="required"/>
<xs:attribute name="efi" type="xs:boolean" use="optional" default="true"/>
</xs:complexType>
</xs:element>
<!-- END BOOTLOADER -->
<!--- BEGIN SCRIPTS -->
<xs:element name="scripts" maxOccurs="1" minOccurs="0">
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="pre" minOccurs="0" maxOccurs="unbounded" type="t_aif_script"/>
<xs:element name="pkg" minOccurs="0" maxOccurs="unbounded" type="t_aif_script"/>
<xs:element name="post" minOccurs="0" maxOccurs="unbounded" type="t_aif_script"/>
</xs:choice>
</xs:complexType>
</xs:element>
<!-- END SCRIPTS -->
</xs:all>
<xs:attribute name="chrootPath" type="t_unix_filepath" use="required"/>
<xs:attribute name="reboot" type="xs:boolean" use="optional" default="false"/>
</xs:complexType>
</xs:element>
</xs:schema>