class ESXVirtualMachineCpuSchemaItem(ComplexSchemaItem): """ Configurtation Schema Item for ESX Virtual Machine CPU """ title = "ESX Virtual Machine Memory Configuration" description = "ESX Virtual Machine memory property" required = True count = IntegerItem( title="CPU core count", description="CPU core count", required=True ) cores_per_socket = IntegerItem( title="CPU cores per socket", description="CPU cores per socket count", required=False, ) nested = BooleanItem( title="Virtual Machine Nested Property", description="Nested virtualization support", default=False, ) hotadd = BooleanItem( title="Virtual Machine CPU hot add", description="CPU hot add", default=False ) hotremove = BooleanItem( title="Virtual Machine CPU hot remove", description="CPU hot remove", default=False, )
class AdmissionControlPolicyItem(ComplexSchemaItem): """ Schema item of the HA admission control policy """ title = "Admission Control Policy" cpu_failover_percent = IntegerItem(title="CPU Failover Percent", minimum=0, maximum=100) memory_failover_percent = IntegerItem(title="Memory Failover Percent", minimum=0, maximum=100)
class AdmissionControlPolicyItem(ComplexSchemaItem): ''' Schema item of the HA admission control policy ''' title = 'Admission Control Policy' cpu_failover_percent = IntegerItem(title='CPU Failover Percent', minimum=0, maximum=100) memory_failover_percent = IntegerItem(title='Memory Failover Percent', minimum=0, maximum=100)
class SimpleHostCacheSchema(Schema): ''' Simplified Schema of ESXi host cache ''' title = 'Simple Host Cache Schema' description = 'Simplified schema of the ESXi host cache' enabled = BooleanItem(title='Enabled', required=True) datastore_name = StringItem(title='Datastore Name', required=True) swap_size_MiB = IntegerItem(title='Host cache swap size in MiB', minimum=1)
class SimpleHostCacheSchema(Schema): """ Simplified Schema of ESXi host cache """ title = "Simple Host Cache Schema" description = "Simplified schema of the ESXi host cache" enabled = BooleanItem(title="Enabled", required=True) datastore_name = StringItem(title="Datastore Name", required=True) swap_size_MiB = IntegerItem(title="Host cache swap size in MiB", minimum=1)
class RosterEntryConfig(Schema): ''' Schema definition of a Salt SSH Roster entry ''' title = 'Roster Entry' description = 'Salt SSH roster entry definition' host = StringItem( title='Host', description='The IP address or DNS name of the remote host', # Pretty naive pattern matching pattern= r'^((\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|([A-Za-z0-9][A-Za-z0-9\.\-]{1,255}))$', min_length=1, required=True) port = PortItem(title='Port', description='The target system\'s ssh port number', default=22) user = StringItem(title='User', description='The user to log in as. Defaults to root', default='root', min_length=1, required=True) passwd = SecretItem(title='Password', description='The password to log in with', min_length=1) priv = StringItem( title='Private Key', description='File path to ssh private key, defaults to salt-ssh.rsa', min_length=1) priv_passwd = SecretItem(title='Private Key passphrase', description='Passphrase for private key file', min_length=1) passwd_or_priv_requirement = AnyOfItem( items=(RequirementsItem(requirements=['passwd']), RequirementsItem(requirements=['priv'])))(flatten=True) sudo = BooleanItem(title='Sudo', description='run command via sudo. Defaults to False', default=False) timeout = IntegerItem( title='Timeout', description=('Number of seconds to wait for response ' 'when establishing an SSH connection')) thin_dir = StringItem( title='Thin Directory', description=('The target system\'s storage directory for Salt ' 'components. Defaults to /tmp/salt-<hash>.')) minion_opts = DictItem(title='Minion Options', description='Dictionary of minion options', properties=MinionConfiguration())
class ESXVirtualMachineCpuSchemaItem(ComplexSchemaItem): ''' Configurtation Schema Item for ESX Virtual Machine CPU ''' title = 'ESX Virtual Machine Memory Configuration' description = 'ESX Virtual Machine memory property' required = True count = IntegerItem(title='CPU core count', description='CPU core count', required=True) cores_per_socket = IntegerItem(title='CPU cores per socket', description='CPU cores per socket count', required=False) nested = BooleanItem(title='Virtual Machine Nested Property', description='Nested virtualization support', default=False) hotadd = BooleanItem(title='Virtual Machine CPU hot add', description='CPU hot add', default=False) hotremove = BooleanItem(title='Virtual Machine CPU hot remove', description='CPU hot remove', default=False)
class VCenterProxySchema(Schema): ''' Schema for the configuration for the proxy to connect to a VCenter. ''' title = 'VCenter Proxy Connection Schema' description = 'Schema that describes the connection to a VCenter' additional_properties = False proxytype = StringItem(required=True, enum=['vcenter']) vcenter = StringItem(required=True, pattern=r'[^\s]+') mechanism = StringItem(required=True, enum=['userpass', 'sspi']) username = StringItem() passwords = ArrayItem(min_items=1, items=StringItem(), unique_items=True) domain = StringItem() principal = StringItem(default='host') protocol = StringItem(default='https') port = IntegerItem(minimum=1)
class VmfsDatastoreDiskScsiAddressItem(ComplexSchemaItem): ''' Schema item of a VMFS datastore referencing a backing disk SCSI address ''' title = 'VMFS Datastore Disk Scsi Address Item' description = 'VMFS datastore item referencing a backing disk SCSI address' name = StringItem(title='Name', description='Specifies the name of the VMFS datastore', required=True) backing_disk_scsi_addr = VMwareScsiAddressItem( title='Backing Disk Scsi Address', description=('Specifies the SCSI address of the disk backing the VMFS ' 'datastore'), required=True) vmfs_version = IntegerItem(title='VMFS Version', description='VMFS version', enum=[1, 2, 3, 5])
class VCenterProxySchema(Schema): """ Schema for the configuration for the proxy to connect to a VCenter. """ title = "VCenter Proxy Connection Schema" description = "Schema that describes the connection to a VCenter" additional_properties = False proxytype = StringItem(required=True, enum=["vcenter"]) vcenter = StringItem(required=True, pattern=r"[^\s]+") mechanism = StringItem(required=True, enum=["userpass", "sspi"]) username = StringItem() passwords = ArrayItem(min_items=1, items=StringItem(), unique_items=True) domain = StringItem() principal = StringItem(default="host") protocol = StringItem(default="https") port = IntegerItem(minimum=1)
class VmfsDatastoreDiskIdItem(ComplexSchemaItem): ''' Schema item of a VMFS datastore referencing a backing disk id ''' title = 'VMFS Datastore Disk Id Item' description = 'VMFS datastore item referencing a backing disk id' name = StringItem(title='Name', description='Specifies the name of the VMFS datastore', required=True) backing_disk_id = StringItem( title='Backing Disk Id', description=('Specifies the id of the disk backing the VMFS ' 'datastore'), pattern=r'[^\s]+', required=True) vmfs_version = IntegerItem(title='VMFS Version', description='VMFS version', enum=[1, 2, 3, 5])
class EsxdatacenterProxySchema(Schema): ''' Schema of the esxdatacenter proxy input ''' title = 'Esxdatacenter Proxy Schema' description = 'Esxdatacenter proxy schema' additional_properties = False proxytype = StringItem(required=True, enum=['esxdatacenter']) vcenter = StringItem(required=True, pattern=r'[^\s]+') datacenter = StringItem(required=True) mechanism = StringItem(required=True, enum=['userpass', 'sspi']) username = StringItem() passwords = ArrayItem(min_items=1, items=StringItem(), unique_items=True) # TODO Should be changed when anyOf is supported for schemas domain = StringItem() principal = StringItem() protocol = StringItem() port = IntegerItem(minimum=1)
class EsxdatacenterProxySchema(Schema): """ Schema of the esxdatacenter proxy input """ title = "Esxdatacenter Proxy Schema" description = "Esxdatacenter proxy schema" additional_properties = False proxytype = StringItem(required=True, enum=["esxdatacenter"]) vcenter = StringItem(required=True, pattern=r"[^\s]+") datacenter = StringItem(required=True) mechanism = StringItem(required=True, enum=["userpass", "sspi"]) username = StringItem() passwords = ArrayItem(min_items=1, items=StringItem(), unique_items=True) # TODO Should be changed when anyOf is supported for schemas domain = StringItem() principal = StringItem() protocol = StringItem() port = IntegerItem(minimum=1)
class DRSConfigItem(ComplexSchemaItem): ''' Schema item of the ESX cluster DRS configuration ''' title = 'DRS Configuration' description = 'ESX cluster DRS configuration item' enabled = BooleanItem(title='Enabled', description='Specifies if DRS should be enabled') vmotion_rate = IntegerItem( title='vMotion rate', description='Aggressiveness to do automatic vMotions: ' '1 (least aggressive) - 5 (most aggressive)', minimum=1, maximum=5) default_vm_behavior = StringItem( title='Default VM DRS Behavior', description='Specifies the default VM DRS behavior', enum=['fullyAutomated', 'partiallyAutomated', 'manual'])
class ESXVirtualMachineMemorySchemaItem(ComplexSchemaItem): ''' Configurtation Schema Item for ESX Virtual Machine Memory ''' title = 'ESX Virtual Machine Memory Configuration' description = 'ESX Virtual Machine memory property' required = True size = IntegerItem(title='Memory size', description='Size of the memory', required=True) unit = StringItem(title='Memory unit', description='Unit of the memory, to VMware a ' 'GB is the same as GiB = 1024MiB', required=False, default='MB', enum=('MB', 'GB')) hotadd = BooleanItem(required=False, default=False) reservation_max = BooleanItem(required=False, default=False)
class VmfsDatastoreDiskScsiAddressItem(ComplexSchemaItem): """ Schema item of a VMFS datastore referencing a backing disk SCSI address """ title = "VMFS Datastore Disk Scsi Address Item" description = "VMFS datastore item referencing a backing disk SCSI address" name = StringItem( title="Name", description="Specifies the name of the VMFS datastore", required=True, ) backing_disk_scsi_addr = VMwareScsiAddressItem( title="Backing Disk Scsi Address", description= "Specifies the SCSI address of the disk backing the VMFS datastore", required=True, ) vmfs_version = IntegerItem(title="VMFS Version", description="VMFS version", enum=[1, 2, 3, 5])
class VmfsDatastoreDiskIdItem(ComplexSchemaItem): """ Schema item of a VMFS datastore referencing a backing disk id """ title = "VMFS Datastore Disk Id Item" description = "VMFS datastore item referencing a backing disk id" name = StringItem( title="Name", description="Specifies the name of the VMFS datastore", required=True, ) backing_disk_id = StringItem( title="Backing Disk Id", description="Specifies the id of the disk backing the VMFS datastore", pattern=r"[^\s]+", required=True, ) vmfs_version = IntegerItem(title="VMFS Version", description="VMFS version", enum=[1, 2, 3, 5])
class DRSConfigItem(ComplexSchemaItem): """ Schema item of the ESX cluster DRS configuration """ title = "DRS Configuration" description = "ESX cluster DRS configuration item" enabled = BooleanItem(title="Enabled", description="Specifies if DRS should be enabled") vmotion_rate = IntegerItem( title="vMotion rate", description="Aggressiveness to do automatic vMotions: " "1 (least aggressive) - 5 (most aggressive)", minimum=1, maximum=5, ) default_vm_behavior = StringItem( title="Default VM DRS Behavior", description="Specifies the default VM DRS behavior", enum=["fullyAutomated", "partiallyAutomated", "manual"], )
class ESXVirtualMachineMemorySchemaItem(ComplexSchemaItem): """ Configurtation Schema Item for ESX Virtual Machine Memory """ title = "ESX Virtual Machine Memory Configuration" description = "ESX Virtual Machine memory property" required = True size = IntegerItem( title="Memory size", description="Size of the memory", required=True ) unit = StringItem( title="Memory unit", description="Unit of the memory, to VMware a " "GB is the same as GiB = 1024MiB", required=False, default="MB", enum=("MB", "GB"), ) hotadd = BooleanItem(required=False, default=False) reservation_max = BooleanItem(required=False, default=False)
class RosterEntryConfig(Schema): """ Schema definition of a Salt SSH Roster entry """ title = "Roster Entry" description = "Salt SSH roster entry definition" host = StringItem( title="Host", description="The IP address or DNS name of the remote host", # Pretty naive pattern matching pattern= r"^((\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|([A-Za-z0-9][A-Za-z0-9\.\-]{1,255}))$", min_length=1, required=True, ) port = PortItem(title="Port", description="The target system's ssh port number", default=22) user = StringItem( title="User", description="The user to log in as. Defaults to root", default="root", min_length=1, required=True, ) passwd = SecretItem(title="Password", description="The password to log in with", min_length=1) priv = StringItem( title="Private Key", description="File path to ssh private key, defaults to salt-ssh.rsa", min_length=1, ) priv_passwd = SecretItem( title="Private Key passphrase", description="Passphrase for private key file", min_length=1, ) passwd_or_priv_requirement = AnyOfItem(items=( RequirementsItem(requirements=["passwd"]), RequirementsItem(requirements=["priv"]), ))(flatten=True) sudo = BooleanItem( title="Sudo", description="run command via sudo. Defaults to False", default=False, ) timeout = IntegerItem( title="Timeout", description=("Number of seconds to wait for response " "when establishing an SSH connection"), ) thin_dir = StringItem( title="Thin Directory", description=("The target system's storage directory for Salt " "components. Defaults to /tmp/salt-<hash>."), ) minion_opts = DictItem( title="Minion Options", description="Dictionary of minion options", properties=MinionConfiguration(), )
class OptionValueItem(ComplexSchemaItem): '''Sechma item of the OptionValue''' title = 'OptionValue' key = StringItem(title='Key', required=True) value = AnyOfItem(items=[StringItem(), BooleanItem(), IntegerItem()])
class OptionValueItem(ComplexSchemaItem): """Sechma item of the OptionValue""" title = "OptionValue" key = StringItem(title="Key", required=True) value = AnyOfItem(items=[StringItem(), BooleanItem(), IntegerItem()])