import json from peewee import ( Model, SQL, IntegerField, CharField, TextField, DateTimeField, ForeignKeyField, CompositeKey, FloatField, AutoField, DecimalField, ) from settings import database class JSONField(TextField): """ Class to "fake" a JSON field with a text field. Not efficient but works nicely """ def db_value(self, value): """Convert the python value for storage in the database.""" return value if value is None else json.dumps(value) def python_value(self, value): """Convert the database value to a pythonic value.""" return value if value is None else json.loads(value) class UnknownField(object): def __init__(self, *_, **__): pass class BaseModel(Model): class Meta: database = database class AlertSetting(BaseModel): channel = UnknownField(null=True) # json enabled = IntegerField(constraints=[SQL("DEFAULT 1")]) metric = UnknownField(null=True) # json metric_id = CharField(null=True) name = CharField(null=True) class Meta: table_name = 'alert_setting' class AuthAcl(BaseModel): ip_list = UnknownField() # json name = CharField(constraints=[SQL("DEFAULT ''")], unique=True) class Meta: table_name = 'auth_acl' class AuthUser(BaseModel): auth_source = CharField(constraints=[SQL("DEFAULT 'local'")]) avatar = TextField(null=True) avatar_content_type = CharField(null=True) avatar_filename = CharField(null=True) created_date = DateTimeField(null=True) email = CharField(constraints=[SQL("DEFAULT ''")], unique=True) email_confirm = IntegerField(constraints=[SQL("DEFAULT 0")]) full_name = CharField(null=True) ip_list = UnknownField(null=True) # json lang = CharField(constraints=[SQL("DEFAULT 'en'")]) password = CharField(null=True) phone_number = CharField(null=True) property = UnknownField(null=True) # json roles = UnknownField() # json ssh_priv_key = TextField(null=True) ssh_pub_key = TextField(null=True) state = CharField() totp = CharField(null=True) used_demo = IntegerField(constraints=[SQL("DEFAULT 0")]) uuid = CharField(null=True, unique=True) class Meta: table_name = 'auth_user' class AuthConfirmToken(BaseModel): expires_at = DateTimeField(null=True) resend_token_after = DateTimeField(null=True) token = CharField(null=True, unique=True) user = ForeignKeyField(column_name='user', field='id', model=AuthUser, null=True, unique=True) class Meta: table_name = 'auth_confirm_token' class AuthGdprDoc(BaseModel): change_date = DateTimeField(null=True) desc_condition = CharField(null=True) entry_date = DateTimeField(null=True) locale = CharField(null=True) name = CharField(unique=True) required = IntegerField(constraints=[SQL("DEFAULT 0")]) state = CharField() url = CharField(null=True) class Meta: table_name = 'auth_gdpr_doc' class AuthGdprJournal(BaseModel): action_date = DateTimeField(null=True) action_type = CharField() doc = ForeignKeyField( column_name='doc', field='id', model=AuthGdprDoc, null=True ) ip = CharField(null=True) user_email = CharField() class Meta: table_name = 'auth_gdpr_journal' class AuthGeneratedSshkey(BaseModel): generation_date = DateTimeField(null=True) privkey = TextField(null=True) pubkey = TextField(null=True) class Meta: table_name = 'auth_generated_sshkey' class AuthProduct(BaseModel): docker_compose_file = TextField(null=True) name = CharField(null=True) script = TextField(null=True) version = CharField(null=True) class Meta: table_name = 'auth_product' indexes = ( (('name', 'version'), True), ) class AuthInstance(BaseModel): branches = UnknownField(null=True) # json dbkey = TextField(null=True) demo = IntegerField(constraints=[SQL("DEFAULT 0")]) expires_at = DateTimeField(null=True) failure_reason = UnknownField(null=True) # json limits = UnknownField(null=True) # json mysql = UnknownField(null=True) # json name = CharField(null=True) owner = ForeignKeyField( column_name='owner', field='id', model=AuthUser, null=True ) product = ForeignKeyField( column_name='product', field='id', model=AuthProduct, null=True ) roles = UnknownField(null=True) # json started = DateTimeField(null=True) status = CharField() class Meta: table_name = 'auth_instance' class AuthInstanceHistory(BaseModel): create_time = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) event_info = UnknownField(null=True) # json event_type = CharField(null=True) prev_time = DateTimeField(null=True) ref = ForeignKeyField( column_name='ref', field='id', model=AuthInstance, null=True ) request_id = CharField(null=True) request_ip = CharField(null=True) request_owner = CharField(null=True) request_user = CharField(null=True) class Meta: table_name = 'auth_instance_history' class AuthKey(BaseModel): expires_at = DateTimeField(null=True) name = CharField(constraints=[SQL("DEFAULT ''")], unique=True) user = ForeignKeyField(column_name='user', field='id', model=AuthUser) class Meta: table_name = 'auth_key' class AuthLicense(BaseModel): instance = ForeignKeyField( column_name='instance', field='id', model=AuthInstance, null=True, unique=True ) last_update = DateTimeField(null=True) lic_data = UnknownField(null=True) # json lic_request = UnknownField(null=True) # json product = CharField(null=True) signature_expire_date = DateTimeField(null=True) status = CharField() class Meta: table_name = 'auth_license' class AuthPermission(BaseModel): data = UnknownField() # json plugin = CharField(constraints=[SQL("DEFAULT ''")]) service = CharField(constraints=[SQL("DEFAULT ''")]) class Meta: table_name = 'auth_permission' indexes = ( (('service', 'plugin'), True), ) class AuthPricelist(BaseModel): bill_id = IntegerField(null=True, unique=True) name = CharField(null=True) params = UnknownField(null=True) # json class Meta: table_name = 'auth_pricelist' class AuthServer(BaseModel): demo = IntegerField(constraints=[SQL("DEFAULT 0")]) host = CharField(null=True) instance = ForeignKeyField( column_name='instance', field='id', model=AuthInstance, null=True, unique=True ) login = CharField(null=True) machine_id = CharField(null=True) password = CharField(null=True) port = IntegerField(null=True) class Meta: table_name = 'auth_server' indexes = ( (('host', 'port'), True), ) class AuthService(BaseModel): bill_id = IntegerField(null=True, unique=True) info = UnknownField(null=True) # json instance = ForeignKeyField( column_name='instance', field='id', model=AuthInstance, null=True, unique=True ) params = UnknownField(null=True) # json payment_form = TextField(null=True) status = CharField(null=True) class Meta: table_name = 'auth_service' indexes = ( (('instance', 'bill_id'), True), ) class AuthServiceDbkey(BaseModel): dbkey = TextField(null=True) name = CharField(null=True, unique=True) class Meta: table_name = 'auth_service_dbkey' class AuthSession(BaseModel): expires_at = DateTimeField(null=True) is_internal = IntegerField(constraints=[SQL("DEFAULT 0")]) name = CharField(null=True, unique=True) owner = ForeignKeyField( column_name='owner', field='id', model=AuthUser, null=True ) trustee = ForeignKeyField( backref='auth_user_trustee_set', column_name='trustee', field='id', model=AuthUser, null=True ) updated_at = DateTimeField(null=True) xsrf_token = CharField(null=True) class Meta: table_name = 'auth_session' class AuthToken(BaseModel): client_ip = CharField(null=True) description = CharField(constraints=[SQL("DEFAULT ''")]) expires_at = DateTimeField(null=True) last_used = DateTimeField() name = CharField(constraints=[SQL("DEFAULT ''")], unique=True) need_2fa = IntegerField(constraints=[SQL("DEFAULT 0")]) owner = ForeignKeyField(column_name='owner', field='id', model=AuthUser) trustee = ForeignKeyField( backref='auth_user_trustee_set', column_name='trustee', field='id', model=AuthUser ) class Meta: table_name = 'auth_token' class AuthTrusteeUser(BaseModel): instance = ForeignKeyField( column_name='instance', field='id', model=AuthInstance, null=True) role = CharField(null=True) trustee = ForeignKeyField( column_name='trustee', field='id', model=AuthUser, null=True ) user = ForeignKeyField( backref='auth_user_user_set', column_name='user', field='id', model=AuthUser, null=True ) class Meta: table_name = 'auth_trustee_user' indexes = ( (('user', 'trustee', 'instance'), True), ) class AuthUser2Acl(BaseModel): acl = ForeignKeyField(column_name='acl', field='id', model=AuthAcl) user = ForeignKeyField(column_name='user', field='id', model=AuthUser) class Meta: table_name = 'auth_user2acl' indexes = ( (('user', 'acl'), True), ) class AuthUserRole(BaseModel): instance = ForeignKeyField( column_name='instance', field='id', model=AuthInstance, null=True ) roles = UnknownField() # json state = CharField() trustee = ForeignKeyField( column_name='trustee', field='id', model=AuthUser ) user = ForeignKeyField( backref='auth_user_user_set', column_name='user', field='id', model=AuthUser ) class Meta: table_name = 'auth_user_role' indexes = ( (('user', 'trustee', 'instance'), True), ) class AuthUserSetting(BaseModel): data = UnknownField(null=True) # json instance = ForeignKeyField( column_name='instance', field='id', model=AuthInstance, null=True) name = CharField(null=True) user = ForeignKeyField( column_name='user', field='id', model=AuthUser, null=True ) class Meta: table_name = 'auth_user_setting' indexes = ( (('user', 'name', 'instance'), True), ) class AuthUserSshkey(BaseModel): name = CharField() owner = ForeignKeyField( column_name='owner', field='id', model=AuthUser, null=True ) ssh_pub_key = TextField(null=True) class Meta: table_name = 'auth_user_sshkey' indexes = ( (('name', 'owner'), True), ) class AuthUsersLocks(BaseModel): description = CharField(constraints=[SQL("DEFAULT ''")]) service_name = CharField() user = ForeignKeyField(column_name='user', field='id', model=AuthUser) class Meta: table_name = 'auth_users_locks' indexes = ( (('user', 'service_name'), True), ) primary_key = CompositeKey('service_name', 'user') class CsDocuments(BaseModel): lang = CharField(constraints=[SQL("DEFAULT ''")]) name = CharField(constraints=[SQL("DEFAULT ''")]) product = CharField(constraints=[SQL("DEFAULT ''")]) required = IntegerField(constraints=[SQL("DEFAULT 0")]) url = CharField(constraints=[SQL("DEFAULT ''")]) class Meta: table_name = 'cs_documents' indexes = ( (('product', 'lang', 'name'), True), ) class CsSettings(BaseModel): lang = CharField(constraints=[SQL("DEFAULT ''")]) product = CharField(constraints=[SQL("DEFAULT ''")]) prop_key = CharField(constraints=[SQL("DEFAULT ''")]) prop_value = CharField(constraints=[SQL("DEFAULT ''")]) class Meta: table_name = 'cs_settings' indexes = ( (('product', 'lang', 'prop_key'), True), ) class DnsProxyZone(BaseModel): name = CharField(null=True, unique=True) status = CharField(constraints=[SQL("DEFAULT 'in_progress'")]) status_info = UnknownField(null=True) # json class Meta: table_name = 'dns_proxy_zone' class DnsProxyRecord(BaseModel): content = CharField(null=True) first = DecimalField() last = DecimalField() name = CharField(null=True) status = CharField(constraints=[SQL("DEFAULT 'in_progress'")]) status_info = UnknownField(null=True) # json type = CharField() zone = ForeignKeyField( column_name='zone', field='id', model=DnsProxyZone, null=True ) class Meta: table_name = 'dns_proxy_record' indexes = ( (('name', 'type'), True), ) class Dnsbl(BaseModel): name = CharField(null=True, unique=True) class Meta: table_name = 'dnsbl' class Userspace(BaseModel): is_public = IntegerField(constraints=[SQL("DEFAULT 0")]) note = TextField(null=True) class Meta: table_name = 'userspace' class Ipnet(BaseModel): family = IntegerField(null=True) first = DecimalField() gateway = CharField(null=True) last = DecimalField() mask = IntegerField(null=True) name = CharField(null=True) need_reserve = IntegerField(constraints=[SQL("DEFAULT 1")]) note = TextField(null=True) size = DecimalField() userspace = ForeignKeyField( column_name='userspace', field='id', model=Userspace) vlan = CharField(null=True) class Meta: table_name = 'ipnet' class Ippool(BaseModel): name = CharField(null=True) note = TextField(null=True) userspace = ForeignKeyField( column_name='userspace', field='id', model=Userspace, null=True) class Meta: table_name = 'ippool' indexes = ( (('name', 'userspace'), True), ) class Ip(BaseModel): domain = CharField(null=True) family = IntegerField(null=True) first = DecimalField() ipnet = ForeignKeyField(column_name='ipnet', field='id', model=Ipnet) ippool = ForeignKeyField(column_name='ippool', field='id', model=Ippool, null=True) last = DecimalField() locked = IntegerField(constraints=[SQL("DEFAULT 0")]) name = CharField(null=True) note = TextField(null=True) parent = IntegerField(null=True) size = DecimalField() status = CharField() userspace = ForeignKeyField( column_name='userspace', field='id', model=Userspace, null=True) class Meta: table_name = 'ip' indexes = ( (('name', 'ipnet'), True), ) class Ip2Dnsbl(BaseModel): address = CharField(null=True) dnsbl = CharField(null=True) class Meta: table_name = 'ip2dnsbl' class IpHistory(BaseModel): create_time = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) event_info = UnknownField(null=True) # json event_type = CharField(null=True) first = DecimalField() last = DecimalField() name = CharField(null=True) prev_time = DateTimeField(null=True) ref = IntegerField(index=True, null=True) request_id = CharField(null=True) request_ip = CharField(null=True) request_owner = CharField(null=True) request_user = CharField(null=True) class Meta: table_name = 'ip_history' class IpSettings(BaseModel): name = CharField(null=True, unique=True) value = TextField(null=True) class Meta: table_name = 'ip_settings' class IpmgrIpHistory(BaseModel): data = UnknownField(null=True) # json date_time = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) entity = ForeignKeyField(column_name='entity_id', field='id', model=Ip, null=True) entity_name = CharField(null=True) first = DecimalField() instance_id = IntegerField(null=True) ip = CharField(null=True) last = DecimalField() user_email = CharField(null=True) user_id = IntegerField(null=True) userspace = ForeignKeyField( column_name='userspace', field='id', model=Userspace, null=True) class Meta: table_name = 'ipmgr_ip_history' class IppoolRange(BaseModel): family = IntegerField(null=True) first = DecimalField() ippool = ForeignKeyField(column_name='ippool', field='id', model=Ippool) last = DecimalField() name = CharField(null=True) size = DecimalField() class Meta: table_name = 'ippool_range' class IspSettings(BaseModel): name = CharField(primary_key=True) value = TextField() class Meta: table_name = 'isp_settings' class MsgsChannel(BaseModel): comment = TextField(null=True) creation_date = DateTimeField(null=True) delivery_method = CharField() enabled = IntegerField(constraints=[SQL("DEFAULT 1")]) language = CharField() name = CharField() params = UnknownField(null=True) # json state = CharField() class Meta: table_name = 'msgs_channel' class MsgsDeliveryMethod(BaseModel): delivery_method = CharField(primary_key=True) dm_params = UnknownField(null=True) # json class Meta: table_name = 'msgs_delivery_method' class MsgsMessageDesign(BaseModel): design = CharField(primary_key=True) class Meta: table_name = 'msgs_message_design' class MsgsMessageDesignVariant(BaseModel): delivery_method = CharField() design = CharField() design_content = TextField(null=True) language = CharField() class Meta: table_name = 'msgs_message_design_variant' indexes = ( (('design', 'delivery_method', 'language'), True), (('design', 'delivery_method', 'language'), True), ) primary_key = CompositeKey('delivery_method', 'design', 'language') class MsgsNoticeReceiver(BaseModel): delivery_method = CharField() receivers = UnknownField(null=True) # json user = IntegerField(null=True) class Meta: table_name = 'msgs_notice_receiver' indexes = ( (('user', 'delivery_method'), True), ) class MsgsTemplate(BaseModel): priority = CharField() template = CharField(primary_key=True) class Meta: table_name = 'msgs_template' class MsgsTemplate2Category(BaseModel): category = CharField() template = CharField() class Meta: table_name = 'msgs_template2category' indexes = ( (('template', 'category'), True), (('template', 'category'), True), ) primary_key = CompositeKey('category', 'template') class MsgsTemplateVariant(BaseModel): delivery_method = CharField() language = CharField() template = CharField() tv_params = UnknownField(null=True) # json class Meta: table_name = 'msgs_template_variant' indexes = ( (('template', 'delivery_method', 'language'), True), (('template', 'delivery_method', 'language'), True), ) primary_key = CompositeKey('delivery_method', 'language', 'template') class MsgsUser(BaseModel): language = CharField() user = AutoField() class Meta: table_name = 'msgs_user' class MsgsUser2DeliveryMethod(BaseModel): delivery_method = CharField() u2dm_params = UnknownField(null=True) # json user = IntegerField() class Meta: table_name = 'msgs_user2delivery_method' indexes = ( (('user', 'delivery_method'), True), (('user', 'delivery_method'), True), ) primary_key = CompositeKey('delivery_method', 'user') class MsgsUserSubscription(BaseModel): category = CharField() delivery_method = CharField() user = IntegerField() class Meta: table_name = 'msgs_user_subscription' indexes = ( (('user', 'delivery_method', 'category'), True), ) primary_key = CompositeKey('category', 'delivery_method', 'user') class NcNotice(BaseModel): create_timestamp = IntegerField(null=True) entity = UnknownField(null=True) # json params = UnknownField(null=True) # json status = CharField(constraints=[SQL("DEFAULT 'sended'")]) timestamp = IntegerField(null=True) type = CharField(null=True) class Meta: table_name = 'nc_notice' class NcUser(BaseModel): last_notice_timestamp = IntegerField(constraints=[SQL("DEFAULT 0")]) read_timestamp = IntegerField(constraints=[SQL("DEFAULT 0")]) class Meta: table_name = 'nc_user' class NcNotice2User(BaseModel): notice = ForeignKeyField(column_name='notice', field='id', model=NcNotice, null=True) read_timestamp = IntegerField(constraints=[SQL("DEFAULT 0")]) user = ForeignKeyField(column_name='user', field='id', model=NcUser, null=True) class Meta: table_name = 'nc_notice2user' indexes = ( (('user', 'notice'), True), ) class NginxKv(BaseModel): name = CharField(primary_key=True) value = TextField(null=True) class Meta: table_name = 'nginx_kv' class PsPlugin(BaseModel): content = TextField() current_version = CharField(null=True) filename = CharField(null=True) intname = CharField(null=True, unique=True) metadata = UnknownField() # json name = CharField(null=True, unique=True) plugin_requirement = UnknownField(null=True) # json product = CharField() remote = IntegerField(constraints=[SQL("DEFAULT 0")]) status = CharField(constraints=[SQL("DEFAULT 'disabled'")]) version = CharField(null=True) class Meta: table_name = 'ps_plugin' class PsPluginLicense(BaseModel): instance = IntegerField(null=True) license = UnknownField(null=True) # json plugin = IntegerField(null=True) class Meta: table_name = 'ps_plugin_license' indexes = ( (('instance', 'plugin'), True), ) class VmAccount(BaseModel): auth_source = CharField(constraints=[SQL("DEFAULT 'local'")]) email = CharField(unique=True) roles = JSONField() # UnknownField() # json state = CharField(constraints=[SQL("DEFAULT 'active'")]) vm5_data = UnknownField(null=True) # json class Meta: table_name = 'vm_account' class VmBackupLocation(BaseModel): comment = CharField(null=True) connection_params = UnknownField(null=True) # json name = CharField(unique=True) quota_mib = IntegerField(null=True) state = CharField() type = CharField(null=True) class Meta: table_name = 'vm_backup_location' class VmCluster(BaseModel): admin_name = CharField(null=True) admin_password = CharField(null=True) comment = TextField(null=True) cpu_overselling = FloatField(constraints=[SQL("DEFAULT -1")]) datacenter_type = CharField(constraints=[SQL("DEFAULT 'common'")]) dns_servers = UnknownField(null=True) # json domain_change_allowed = IntegerField(constraints=[SQL("DEFAULT 0")]) domain_template = CharField(constraints=[SQL("DEFAULT '.example.com'")]) ha_agent_version = CharField(null=True) ha_checking_host = CharField(null=True) ha_enabled = IntegerField(constraints=[SQL("DEFAULT 0")]) ha_error = CharField(constraints=[SQL("DEFAULT 'no_error'")]) hdd_overselling = FloatField(constraints=[SQL("DEFAULT 1")]) host_distribution_policy = CharField(constraints=[SQL("DEFAULT 'spread'")]) host_filter = UnknownField(null=True) # json host_per_node_limit = IntegerField(constraints=[SQL("DEFAULT -1")]) image_storage_path = CharField(constraints=[SQL("DEFAULT '/images'")]) imported_from = CharField(null=True) interface_count = IntegerField(constraints=[SQL("DEFAULT 1")]) iso_enabled = IntegerField(constraints=[SQL("DEFAULT 1")]) manage_disk_enabled = IntegerField(constraints=[SQL("DEFAULT 0")]) name = CharField(unique=True) net_bandwidth_mbitps = IntegerField(null=True) net_in_mbitps = IntegerField(constraints=[SQL("DEFAULT 0")]) net_out_mbitps = IntegerField(constraints=[SQL("DEFAULT 0")]) node_network_gateway = CharField(null=True) node_network_timeout = IntegerField(constraints=[SQL("DEFAULT 300")]) os_storage_path = CharField(null=True) overselling = FloatField(constraints=[SQL("DEFAULT 1")]) proxy_enabled = IntegerField(constraints=[SQL("DEFAULT 0")]) qemu_version = CharField(null=True) storage_params = UnknownField(null=True) # json storage_type = CharField() time_zone = CharField(constraints=[SQL("DEFAULT 'UTC'")]) type = CharField(constraints=[SQL("DEFAULT 'kvm'")]) virtualization_type = CharField(constraints=[SQL("DEFAULT 'kvm'")]) vm5_data = UnknownField(null=True) # json vm_storage_path = CharField(null=True) vmmgr_url = CharField(null=True) volume_group = CharField(null=True) vxlan_mode = CharField(constraints=[SQL("DEFAULT 'disabled'")]) class Meta: table_name = 'vm_cluster' class VmBackupLocation2Cluster(BaseModel): backup_location = ForeignKeyField( column_name='backup_location', field='id', model=VmBackupLocation, null=True ) cluster = ForeignKeyField( column_name='cluster', field='id', model=VmCluster, null=True ) class Meta: table_name = 'vm_backup_location2cluster' indexes = ( (('backup_location', 'cluster'), True), ) class VmIpFabricSettings(BaseModel): bgp_as = IntegerField(null=True) bgp_as_v6 = IntegerField(null=True) bgp_community = CharField(null=True) bgp_community_v6 = CharField(null=True) bgp_routing_type = CharField(constraints=[SQL("DEFAULT 'bird'")]) cluster = ForeignKeyField(column_name='cluster', field='id', model=VmCluster, unique=True) gateway = CharField(constraints=[SQL("DEFAULT '10.0.0.1'")]) mac = CharField(constraints=[SQL("DEFAULT '02:00:00:00:00:01'")]) class Meta: table_name = 'vm_ip_fabric_settings' class VmBgpSession(BaseModel): bgp_as = IntegerField() comment = CharField(null=True) ip = CharField() ip_fabric_settings = ForeignKeyField( column_name='ip_fabric_settings', field='id', model=VmIpFabricSettings) type = CharField() class Meta: table_name = 'vm_bgp_session' class VmBillOptions(BaseModel): name = CharField(null=True, unique=True) value = UnknownField(null=True) # json class Meta: table_name = 'vm_bill_options' class VmStorage(BaseModel): available_mib = IntegerField(null=True) comment = CharField(constraints=[SQL("DEFAULT ''")]) imported_from = CharField(null=True) is_network = IntegerField(constraints=[SQL("DEFAULT 0")]) mount_point = CharField(null=True) name = CharField() params = UnknownField(null=True) # json path = CharField(null=True) pool_name = CharField(null=True) reserved_mib = IntegerField(constraints=[SQL("DEFAULT 0")]) size_mib = IntegerField(null=True) state = CharField() storage_params = UnknownField(null=True) # json type = CharField() vm5_data = UnknownField(null=True) # json class Meta: table_name = 'vm_storage' class VmCephMonitor(BaseModel): ip_addr = CharField(unique=True) port = IntegerField(constraints=[SQL("DEFAULT 6789")]) storage = ForeignKeyField( column_name='storage', field='id', model=VmStorage, null=True ) class Meta: table_name = 'vm_ceph_monitor' class VmDcNetwork2Cluster(BaseModel): cluster = ForeignKeyField( column_name='cluster', field='id', model=VmCluster, null=True ) dc_network = IntegerField(null=True) name = CharField(null=True) class Meta: table_name = 'vm_dc_network2cluster' indexes = ( (('dc_network', 'cluster'), True), ) class VmOsGroup(BaseModel): group_key = CharField(null=True) name = CharField(null=True, unique=True) class Meta: table_name = 'vm_os_group' class VmRepository(BaseModel): hidden = IntegerField(constraints=[SQL("DEFAULT 0")]) immortal = IntegerField(constraints=[SQL("DEFAULT 0")]) name = CharField(unique=True) type = CharField() url = CharField(unique=True) class Meta: table_name = 'vm_repository' class VmOs(BaseModel): adminonly = IntegerField(constraints=[SQL("DEFAULT 0")]) archive_size_mib = IntegerField(null=True) checksum = CharField(null=True) efi_boot = IntegerField(constraints=[SQL("DEFAULT 0")]) expand_part = CharField(null=True) file_name = CharField(null=True) image_name = CharField(null=True, unique=True) image_size_mib = IntegerField(null=True) install_script_checksum = CharField(constraints=[SQL("DEFAULT ''")]) install_script_name = CharField(constraints=[SQL("DEFAULT ''")]) install_script_updated_at = DateTimeField(null=True) ip_automation = CharField(constraints=[SQL("DEFAULT 'none'")]) is_dummy = IntegerField(constraints=[SQL("DEFAULT 0")]) is_lxd_image = IntegerField(constraints=[SQL("DEFAULT 0")]) kms_supported = IntegerField(constraints=[SQL("DEFAULT 0")]) min_size_mib = IntegerField(null=True) name = CharField(null=True) network_device = CharField(null=True) os_group = ForeignKeyField( column_name='os_group', field='id', model=VmOsGroup, null=True) repository = ForeignKeyField( column_name='repository', field='id', model=VmRepository, null=True) state = CharField(constraints=[SQL("DEFAULT 'active'")]) tags = UnknownField(null=True) # json updated_at = DateTimeField(null=True) vm5_data = UnknownField(null=True) # json class Meta: table_name = 'vm_os' indexes = ( (('repository', 'name'), True), ) class VmNode(BaseModel): additional_data = TextField(null=True) bird_error = UnknownField(null=True) # json cluster = ForeignKeyField( column_name='cluster', field='id', model=VmCluster ) comment = CharField(null=True) connection_error = CharField(null=True) cpu_number = IntegerField(constraints=[SQL("DEFAULT 0")]) disk_params = UnknownField(null=True) # json frr_error = UnknownField(null=True) # json gray_ips = UnknownField(null=True) # json ha_disable_failed = IntegerField(constraints=[SQL("DEFAULT 0")]) ha_error = CharField(constraints=[SQL("DEFAULT 'no_error'")]) ha_state = CharField(constraints=[SQL("DEFAULT 'unknown'")]) hdd_overselling = FloatField(constraints=[SQL("DEFAULT 1")]) host_creation_blocked = IntegerField(constraints=[SQL("DEFAULT 0")]) host_filter = UnknownField(null=True) # json host_limit = IntegerField(constraints=[SQL("DEFAULT -1")]) host_max_num = IntegerField(null=True) hostname = CharField(null=True) ip_addr = CharField(null=True) ip_addr_v6 = CharField(null=True) kernel_version = CharField(null=True) libvirt_error = CharField(null=True) libvirt_version = CharField(null=True) lxd_error = CharField(null=True) lxd_version = CharField(null=True) max_vcpu_number = IntegerField(null=True) metrics_timestamp = IntegerField(null=True) mon_install_date = DateTimeField(null=True) mon_installed = IntegerField(constraints=[SQL("DEFAULT 1")]) name = CharField(null=True, unique=True) network_error = CharField(constraints=[SQL("DEFAULT 'no_error'")]) network_settings_lock = IntegerField(constraints=[SQL("DEFAULT 0")]) os_version = CharField(null=True) overselling = FloatField(constraints=[SQL("DEFAULT 1")]) problems = UnknownField(null=True) # json property = UnknownField(null=True) # json qemu_version = CharField(null=True) ram_mib = IntegerField(constraints=[SQL("DEFAULT 0")]) selinux_enforcing = IntegerField(constraints=[SQL("DEFAULT 0")]) socket_number = IntegerField(constraints=[SQL("DEFAULT 1")]) ssh_port = IntegerField(null=True) state = CharField(null=True) update_dc_networks_failed = IntegerField(constraints=[SQL("DEFAULT 0")]) uptime = IntegerField(constraints=[SQL("DEFAULT 0")]) vcpu_limit = IntegerField(constraints=[SQL("DEFAULT -1")]) vm5_data = UnknownField(null=True) # json vnc_addr = CharField(null=True) class Meta: table_name = 'vm_node' class VmPreset(BaseModel): anti_spoofing = IntegerField(constraints=[SQL("DEFAULT 1")]) comment = TextField(null=True) cpu_custom_model = CharField(null=True) cpu_mode = CharField(constraints=[SQL("DEFAULT 'default'")]) cpu_number = IntegerField(constraints=[SQL("DEFAULT 0")]) cpu_weight = IntegerField(constraints=[SQL("DEFAULT 1024")]) firewall_rules = UnknownField(null=True) # json hdd_mib = IntegerField(null=True) io_read_iops = IntegerField(constraints=[SQL("DEFAULT 0")]) io_read_mbitps = IntegerField(constraints=[SQL("DEFAULT 0")]) io_weight = IntegerField(constraints=[SQL("DEFAULT 500")]) io_write_iops = IntegerField(constraints=[SQL("DEFAULT 0")]) io_write_mbitps = IntegerField(constraints=[SQL("DEFAULT 0")]) name = CharField(unique=True) nesting = IntegerField(constraints=[SQL("DEFAULT 0")]) net_in_mbitps = IntegerField(constraints=[SQL("DEFAULT 0")]) net_out_mbitps = IntegerField(constraints=[SQL("DEFAULT 0")]) net_weight = IntegerField(constraints=[SQL("DEFAULT 5")]) process_number = IntegerField(constraints=[SQL("DEFAULT -1")]) ram_mib = IntegerField(constraints=[SQL("DEFAULT 0")]) tcp_connections_in = IntegerField(constraints=[SQL("DEFAULT 0")]) tcp_connections_out = IntegerField(constraints=[SQL("DEFAULT 0")]) virtualization_type = CharField(constraints=[SQL("DEFAULT 'kvm'")]) class Meta: table_name = 'vm_preset' class VmHost(BaseModel): account = ForeignKeyField( column_name='account', field='id', model=VmAccount, null=True ) anti_spoofing = IntegerField(constraints=[SQL("DEFAULT 1")]) autostart_enabled = IntegerField(constraints=[SQL("DEFAULT 1")]) bandwidth_inbound_kibps = IntegerField(null=True) bandwidth_outbound_kibps = IntegerField(null=True) comment = TextField(null=True) cpu_command = CharField(null=True) cpu_custom_model = CharField(null=True) cpu_mode = CharField(constraints=[SQL("DEFAULT 'default'")]) cpu_model = CharField(null=True) cpu_number = IntegerField(constraints=[SQL("DEFAULT 0")]) cpu_number_new = IntegerField(null=True) cpu_weight = IntegerField(constraints=[SQL("DEFAULT 1024")]) disabled = IntegerField(constraints=[SQL("DEFAULT 0")]) domain = CharField(null=True) expand_part = CharField(null=True) firewall_rules = UnknownField(null=True) # json guest_agent = IntegerField(constraints=[SQL("DEFAULT 0")]) ha_maintenance = IntegerField(constraints=[SQL("DEFAULT 0")]) ha_restore_on_fail = IntegerField(constraints=[SQL("DEFAULT 0")]) ha_restore_priority = IntegerField(constraints=[SQL("DEFAULT 100")]) ha_sync_error = IntegerField(constraints=[SQL("DEFAULT 0")]) internal_name = CharField(null=True) io_read_iops = IntegerField(constraints=[SQL("DEFAULT 0")]) io_read_mbitps = IntegerField(constraints=[SQL("DEFAULT 0")]) io_weight = IntegerField(constraints=[SQL("DEFAULT 500")]) io_write_iops = IntegerField(constraints=[SQL("DEFAULT 0")]) io_write_mbitps = IntegerField(constraints=[SQL("DEFAULT 0")]) iops = IntegerField(null=True) ip_automation = CharField(constraints=[SQL("DEFAULT 'none'")]) iso = ForeignKeyField(column_name='iso', field='id', model=VmOs, null=True) mac_address = CharField(null=True) mon_install_date = DateTimeField( constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")] ) mon_installed = IntegerField(constraints=[SQL("DEFAULT 0")]) name = CharField(null=True) nesting = IntegerField(constraints=[SQL("DEFAULT 0")]) net_bandwidth_mbitps = IntegerField(null=True) net_bandwidth_mbitps_changed = IntegerField(constraints=[SQL("DEFAULT 0")]) net_bandwidth_mbitps_new = IntegerField(null=True) net_in_mbitps = IntegerField(constraints=[SQL("DEFAULT 0")]) net_is_synced = IntegerField(constraints=[SQL("DEFAULT 1")]) net_out_mbitps = IntegerField(constraints=[SQL("DEFAULT 0")]) net_weight = IntegerField(constraints=[SQL("DEFAULT 5")]) network_device = CharField(null=True) node = ForeignKeyField(column_name='node', field='id', model=VmNode) os = ForeignKeyField( backref='vm_os_os_set', column_name='os', field='id', model=VmOs ) preset = ForeignKeyField( column_name='preset', field='id', model=VmPreset, null=True ) process_number = IntegerField(constraints=[SQL("DEFAULT -1")]) property = UnknownField(null=True) # json proxy_port = IntegerField(constraints=[SQL("DEFAULT 0")]) ram_mib = IntegerField(constraints=[SQL("DEFAULT 0")]) ram_mib_new = IntegerField(null=True) rescue_mode = IntegerField(constraints=[SQL("DEFAULT 0")]) reserved_node = ForeignKeyField( backref='vm_node_reserved_node_set', column_name='reserved_node', field='id', model=VmNode, null=True ) snapshot_num = IntegerField(null=True) start_date = IntegerField(constraints=[SQL("DEFAULT 0")]) state = CharField() state_update_date = CharField( constraints=[SQL("DEFAULT '1970-01-01 00:00:00.000000'")] ) tcp_connections_in = IntegerField(constraints=[SQL("DEFAULT 0")]) tcp_connections_out = IntegerField(constraints=[SQL("DEFAULT 0")]) transfer_limit = IntegerField(null=True) used_time = CharField() vm5_data = UnknownField(null=True) # json vmmgr_id = IntegerField(null=True) vnc_password = TextField(null=True) vnc_port = IntegerField(constraints=[SQL("DEFAULT 0")]) xml_version = IntegerField(constraints=[SQL("DEFAULT 0")]) class Meta: table_name = 'vm_host' class VmStorage2Node(BaseModel): available_mib = IntegerField(null=True) hdd_overselling = FloatField(constraints=[SQL("DEFAULT 1")]) node = ForeignKeyField( column_name='node', field='id', model=VmNode, null=True ) size_mib = IntegerField(null=True) state = CharField() storage = ForeignKeyField( column_name='storage', field='id', model=VmStorage, null=True ) class Meta: table_name = 'vm_storage2node' indexes = ( (('storage', 'node'), True), ) class VmDisk(BaseModel): account = ForeignKeyField(column_name='account', field='id', model=VmAccount, null=True) boot_order = IntegerField(null=True) bus = CharField(null=True) expand_part = CharField(null=True) host = ForeignKeyField(column_name='host', field='id', model=VmHost, null=True) internal_name = CharField(null=True, unique=True) is_main = IntegerField(null=True) iso = ForeignKeyField(column_name='iso', field='id', model=VmOs, null=True) name = CharField(null=True) size_mib = IntegerField(null=True) size_mib_new = IntegerField(null=True) state = CharField(constraints=[SQL("DEFAULT 'creating'")]) storage2node = ForeignKeyField( column_name='storage2node', field='id', model=VmStorage2Node, null=True ) tags = UnknownField(null=True) # json target_dev = CharField(null=True) type = CharField(constraints=[SQL("DEFAULT 'hard_drive'")]) virt_pool = IntegerField(null=True) vm5_data = UnknownField(null=True) # json class Meta: table_name = 'vm_disk' indexes = ( (('host', 'boot_order'), True), (('host', 'is_main'), True), (('host', 'target_dev'), True), ) class VmSchedule(BaseModel): backup_mode = CharField(constraints=[SQL("DEFAULT 'host_main'")]) comment = CharField(null=True) day = IntegerField(null=True) hour = IntegerField() limit_count = IntegerField(null=True) limit_size_mib = IntegerField(null=True) minute = IntegerField() name = CharField(null=True) type = CharField() week_day = IntegerField(null=True) class Meta: table_name = 'vm_schedule' class VmDiskBackup(BaseModel): actual_size_mib = IntegerField(null=True) available_until = DateTimeField(null=True) backup_location = ForeignKeyField( column_name='backup_location', field='id', model=VmBackupLocation, null=True ) comment = CharField(null=True) date_create = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) destination_backup_location = ForeignKeyField( backref='vm_backup_location_destination_backup_location_set', column_name='destination_backup_location', field='id', model=VmBackupLocation, null=True ) estimated_size_mib = IntegerField() expand_part = CharField(null=True) internal_name = CharField(unique=True) ip_automation = CharField(constraints=[SQL("DEFAULT 'none'")]) name = CharField(null=True, unique=True) node = ForeignKeyField(column_name='node', field='id', model=VmNode, null=True) os = ForeignKeyField(column_name='os', field='id', model=VmOs, null=True) parent_disk = ForeignKeyField( column_name='parent_disk', field='id', model=VmDisk) schedule = ForeignKeyField( column_name='schedule', field='id', model=VmSchedule, null=True) state = CharField() class Meta: table_name = 'vm_disk_backup' indexes = ( (('internal_name', 'node'), True), ) class VmDiskBackupHistory(BaseModel): create_time = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) event_info = UnknownField(null=True) # json event_type = CharField(null=True) prev_time = DateTimeField(null=True) ref = ForeignKeyField(column_name='ref', field='id', model=VmDiskBackup, null=True) request_id = CharField(null=True) request_ip = CharField(null=True) request_owner = CharField(null=True) request_user = CharField(null=True) class Meta: table_name = 'vm_disk_backup_history' class VmDiskHistory(BaseModel): create_time = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) event_info = UnknownField(null=True) # json event_type = CharField(null=True) prev_time = DateTimeField(null=True) ref = ForeignKeyField(column_name='ref', field='id', model=VmDisk, null=True) request_id = CharField(null=True) request_ip = CharField(null=True) request_owner = CharField(null=True) request_user = CharField(null=True) class Meta: table_name = 'vm_disk_history' class VmFix(BaseModel): name = CharField(null=True) class Meta: table_name = 'vm_fix' class VmHetznerSubnet(BaseModel): family = IntegerField(constraints=[SQL("DEFAULT 2")]) gateway = CharField(null=True) node = ForeignKeyField(column_name='node', field='id', model=VmNode, null=True) subnet = CharField() class Meta: table_name = 'vm_hetzner_subnet' indexes = ( (('subnet', 'node'), True), ) class VmNodeBridge(BaseModel): date_create = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) gateway_v4 = CharField(null=True) gateway_v6 = CharField(null=True) ipv4 = CharField(null=True) ipv6 = CharField(null=True) is_default = IntegerField(constraints=[SQL("DEFAULT 0")]) is_main_network = IntegerField(constraints=[SQL("DEFAULT 1")]) name = CharField() node = ForeignKeyField( column_name='node', field='id', model=VmNode, null=True ) old_values = UnknownField(null=True) # json state = CharField(constraints=[SQL("DEFAULT 'unknown'")]) take_slave_ip = IntegerField(constraints=[SQL("DEFAULT 0")]) vlan = IntegerField(null=True) class Meta: table_name = 'vm_node_bridge' indexes = ( (('is_default', 'is_main_network', 'node'), False), (('name', 'node'), True), (('vlan', 'node'), True), ) class VmVxlan(BaseModel): account = IntegerField() comment = CharField(null=True) ippool = IntegerField(unique=True) name = CharField() tag = IntegerField(unique=True) class Meta: table_name = 'vm_vxlan' indexes = ( (('name', 'account'), True), ) class VmHostInterfaces(BaseModel): host = ForeignKeyField( column_name='host', field='id', model=VmHost, null=True ) mac_address = CharField(null=True, unique=True) model = CharField(constraints=[SQL("DEFAULT 'virtio'")]) name = CharField(null=True) node_bridge = ForeignKeyField( column_name='node_bridge', field='id', model=VmNodeBridge, null=True) node_interface = IntegerField(null=True) vxlan = ForeignKeyField( column_name='vxlan', field='id', model=VmVxlan, null=True ) class Meta: table_name = 'vm_host_interfaces' indexes = ( (('name', 'host'), True), (('node_bridge', 'host'), True), ) class VmIp(BaseModel): account = ForeignKeyField( column_name='account', field='id', model=VmAccount, null=True ) bin = DecimalField(null=True) comment = CharField(null=True) domain = CharField(null=True) family = IntegerField() first_addr = CharField(null=True) gateway = CharField(null=True) host = ForeignKeyField( column_name='host', field='id', model=VmHost, null=True ) host_interface = ForeignKeyField( column_name='host_interface', field='id', model=VmHostInterfaces, null=True ) internal = IntegerField(constraints=[SQL("DEFAULT 0")]) ip_addr = CharField() ippool = IntegerField(null=True) net_prefix = IntegerField() netmask = CharField(null=True) network = IntegerField(null=True) property = UnknownField(null=True) # json remote_id = IntegerField(null=True) state = CharField() class Meta: table_name = 'vm_ip' indexes = ( (('ip_addr', 'network'), True), ) class VmHetznerIp(BaseModel): bin = DecimalField(null=True) family = IntegerField() ip = ForeignKeyField(column_name='ip', field='id', model=VmIp, null=True) ip_addr = CharField() net_prefix = IntegerField() netmask = CharField(null=True) node = ForeignKeyField( column_name='node', field='id', model=VmNode, null=True ) state = CharField(constraints=[SQL("DEFAULT 'free'")]) subnet = ForeignKeyField( column_name='subnet', field='id', model=VmHetznerSubnet, null=True ) class Meta: table_name = 'vm_hetzner_ip' indexes = ( (('ip_addr', 'node'), True), ) class VmHostBillOptions(BaseModel): host = ForeignKeyField( column_name='host', field='id', model=VmHost, null=True, unique=True ) image_gib = IntegerField(null=True) class Meta: table_name = 'vm_host_bill_options' class VmHostHistory(BaseModel): create_time = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) event_info = UnknownField(null=True) # json event_type = CharField(null=True) prev_time = DateTimeField(null=True) ref = ForeignKeyField( column_name='ref', field='id', model=VmHost, null=True ) request_id = CharField(null=True) request_ip = CharField(null=True) request_owner = CharField(null=True) request_user = CharField(null=True) class Meta: table_name = 'vm_host_history' class VmTaskLog(BaseModel): consul_id = IntegerField() date_create = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) date_end = DateTimeField(null=True) date_start = DateTimeField(null=True) defer_reason = CharField(null=True) ha_id = IntegerField(null=True) main_table = CharField(null=True) main_table_id = IntegerField(null=True) message_params = UnknownField(null=True) # json name = CharField() node = ForeignKeyField( column_name='node', field='id', model=VmNode, null=True ) output = TextField(null=True) param = UnknownField(null=True) # json password_hidden = IntegerField(constraints=[SQL("DEFAULT 0")]) request_info = UnknownField(null=True) # json status = CharField() class Meta: table_name = 'vm_task_log' indexes = ( (('consul_id', 'name'), True), ) class VmHostLog(BaseModel): date_create = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) host = ForeignKeyField( column_name='host', field='id', model=VmHost, null=True ) name = CharField(null=True) params = UnknownField(null=True) # json request_ip = CharField(null=True) request_owner = IntegerField(null=True) request_trustee = IntegerField(null=True) rights = UnknownField(null=True) # json state = CharField(null=True) task = ForeignKeyField( column_name='task', field='id', model=VmTaskLog, null=True) class Meta: table_name = 'vm_host_log' class VmNodeInterfaces(BaseModel): date_create = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) gateway_v4 = CharField(null=True) gateway_v6 = CharField(null=True) ipv4 = CharField(null=True) ipv6 = CharField(null=True) is_default = IntegerField(constraints=[SQL("DEFAULT 0")]) name = CharField() network_switch = CharField(constraints=[SQL("DEFAULT 'vmbr0'")]) node = ForeignKeyField( column_name='node', field='id', model=VmNode, null=True ) old_values = UnknownField(null=True) # json state = CharField(constraints=[SQL("DEFAULT 'unknown'")]) class Meta: table_name = 'vm_node_interfaces' indexes = ( (('name', 'node'), True), ) class VmNodeBond(BaseModel): date_create = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) gateway_v4 = CharField(null=True) gateway_v6 = CharField(null=True) ipv4 = CharField(null=True) ipv6 = CharField(null=True) mode = CharField(constraints=[SQL("DEFAULT 'active-backup'")]) name = CharField() node = ForeignKeyField( column_name='node', field='id', model=VmNode, null=True ) old_values = UnknownField(null=True) # json slave_ip = CharField(null=True) state = CharField(constraints=[SQL("DEFAULT 'unknown'")]) take_slave_ip = IntegerField(constraints=[SQL("DEFAULT 0")]) class Meta: table_name = 'vm_node_bond' indexes = ( (('name', 'node'), True), ) class VmIface2Bond2Bridge(BaseModel): bond = ForeignKeyField( column_name='bond', field='id', model=VmNodeBond, null=True ) bridge = ForeignKeyField( column_name='bridge', field='id', model=VmNodeBridge, null=True ) iface = ForeignKeyField( column_name='iface', field='id', model=VmNodeInterfaces, null=True ) class Meta: table_name = 'vm_iface2bond2bridge' indexes = ( (('bond', 'bridge'), False), (('iface', 'bond'), False), (('iface', 'bridge'), False), ) class VmImage(BaseModel): account = ForeignKeyField( column_name='account', field='id', model=VmAccount, null=True ) available_until = DateTimeField(null=True) backup_location = IntegerField(null=True) comment = TextField(null=True) cpu_number = IntegerField(constraints=[SQL("DEFAULT 0")]) date_create = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) destination_backup_location = IntegerField(null=True) expand_part = CharField(null=True) file_size_mib = IntegerField(null=True) for_all = IntegerField(constraints=[SQL("DEFAULT 0")]) image_name = CharField(null=True, unique=True) ip_automation = CharField(constraints=[SQL("DEFAULT 'none'")]) ipv4_number = IntegerField(constraints=[SQL("DEFAULT 1")]) ipv6_number = IntegerField(constraints=[SQL("DEFAULT 0")]) name = CharField(null=True, unique=True) network_device = CharField(null=True) os = ForeignKeyField(column_name='os', field='id', model=VmOs) parent_host = ForeignKeyField( column_name='parent_host', field='id', model=VmHost, null=True ) ram_mib = IntegerField(constraints=[SQL("DEFAULT 0")]) schedule = IntegerField(null=True) size_mib = IntegerField(null=True) state = CharField() type = CharField() virt_type = CharField() virtualization_type = CharField() class Meta: table_name = 'vm_image' class VmImage2Node(BaseModel): image = ForeignKeyField( column_name='image', field='id', model=VmImage, null=True ) node = ForeignKeyField( column_name='node', field='id', model=VmNode, null=True ) class Meta: table_name = 'vm_image2node' indexes = ( (('image', 'node'), True), ) class VmImageHistory(BaseModel): create_time = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) event_info = UnknownField(null=True) # json event_type = CharField(null=True) prev_time = DateTimeField(null=True) ref = ForeignKeyField( column_name='ref', field='id', model=VmImage, null=True ) request_id = CharField(null=True) request_ip = CharField(null=True) request_owner = CharField(null=True) request_user = CharField(null=True) class Meta: table_name = 'vm_image_history' class VmPlatformBackupSchedule(BaseModel): comment = CharField(null=True) cron_expression = CharField() enabled = IntegerField(constraints=[SQL("DEFAULT 1")]) local_backups_to_keep = IntegerField(constraints=[SQL("DEFAULT 5")]) name = CharField(null=True) schedule_type = CharField(null=True) class Meta: table_name = 'vm_platform_backup_schedule' class VmPlatformBackup(BaseModel): date = DateTimeField() location = CharField() name = CharField() platform_backup_schedule = ForeignKeyField( column_name='platform_backup_schedule', field='id', model=VmPlatformBackupSchedule, null=True ) size_mib = FloatField() state = CharField(constraints=[SQL("DEFAULT 'active'")]) class Meta: table_name = 'vm_platform_backup' class VmImportHistory(BaseModel): account = ForeignKeyField( column_name='account', field='id', model=VmAccount, null=True ) cluster = ForeignKeyField( column_name='cluster', field='id', model=VmCluster, null=True ) data = UnknownField(null=True) # json date_create = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) date_end = DateTimeField(null=True) date_start = DateTimeField(null=True) initiator_ip = CharField(null=True) platform_backup = ForeignKeyField( column_name='platform_backup', field='id', model=VmPlatformBackup, null=True ) state = CharField(constraints=[SQL("DEFAULT 'created'")]) task_id = IntegerField(null=True) type = CharField() url = CharField(null=True) class Meta: table_name = 'vm_import_history' class VmIpmgr5MigrationHistory(BaseModel): date_create = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) host = CharField(null=True) status = CharField(constraints=[SQL("DEFAULT 'created'")]) class Meta: table_name = 'vm_ipmgr5_migration_history' class VmIppool2Cluster(BaseModel): cluster = ForeignKeyField( column_name='cluster', field='id', model=VmCluster, null=True ) interface = IntegerField(constraints=[SQL("DEFAULT 0")]) ippool = IntegerField(null=True) class Meta: table_name = 'vm_ippool2cluster' indexes = ( (('ippool', 'cluster'), True), ) class VmMac(BaseModel): ip = CharField(null=True) name = CharField(null=True) class Meta: table_name = 'vm_mac' class VmNetworkStorage(BaseModel): available_mib = IntegerField(null=True) checked_time = DateTimeField(null=True) ip_addr = CharField(null=True) login = CharField(null=True) name = CharField(null=True, unique=True) password = CharField(null=True) port = IntegerField(null=True) size_mib = IntegerField(null=True) state = CharField(null=True) class Meta: table_name = 'vm_network_storage' class VmNodeFiles(BaseModel): directory = CharField(null=True) entity = UnknownField(null=True) # json entity_id = IntegerField(null=True) entity_name = CharField(null=True) internal_name = CharField(null=True) node = ForeignKeyField( column_name='node', field='id', model=VmNode, null=True ) path = CharField(null=True) size_mib = IntegerField(null=True) storage = ForeignKeyField( column_name='storage', field='id', model=VmStorage, null=True ) type = CharField(constraints=[SQL("DEFAULT 'unknown'")]) class Meta: table_name = 'vm_node_files' indexes = ( (('path', 'node'), True), ) class VmNodeHistory(BaseModel): create_time = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) event_info = UnknownField(null=True) # json event_type = CharField(null=True) prev_time = DateTimeField(null=True) ref = ForeignKeyField( column_name='ref', field='id', model=VmNode, null=True ) request_id = CharField(null=True) request_ip = CharField(null=True) request_owner = CharField(null=True) request_user = CharField(null=True) class Meta: table_name = 'vm_node_history' class VmNodeLog(BaseModel): date_create = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) destination_node = IntegerField(null=True) host = ForeignKeyField( column_name='host', field='id', model=VmHost, null=True ) name = CharField(null=True) node = ForeignKeyField( column_name='node', field='id', model=VmNode, null=True ) params = UnknownField(null=True) # json request_owner = IntegerField(null=True) request_trustee = IntegerField(null=True) state = CharField(null=True) task = ForeignKeyField( column_name='task', field='id', model=VmTaskLog, null=True ) class Meta: table_name = 'vm_node_log' class VmNodeScript(BaseModel): account = ForeignKeyField( column_name='account', field='id', model=VmAccount, null=True ) description = CharField(null=True) immortal = IntegerField(constraints=[SQL("DEFAULT 0")]) name = CharField(null=True) priority = IntegerField(constraints=[SQL("DEFAULT 0")]) script = TextField(null=True) type = CharField(constraints=[SQL("DEFAULT 'shell'")]) updated_at = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) updated_by = ForeignKeyField( backref='vm_account_updated_by_set', column_name='updated_by', field='id', model=VmAccount, null=True ) class Meta: table_name = 'vm_node_script' class VmNodeScript2Cluster(BaseModel): cluster = ForeignKeyField( column_name='cluster', field='id', model=VmCluster, null=True ) script = ForeignKeyField( column_name='script', field='id', model=VmNodeScript, null=True ) class Meta: table_name = 'vm_node_script2cluster' indexes = ( (('script', 'cluster'), True), ) class VmOs2Cluster(BaseModel): cluster = ForeignKeyField( column_name='cluster', field='id', model=VmCluster, null=True ) os = ForeignKeyField(column_name='os', field='id', model=VmOs, null=True) class Meta: table_name = 'vm_os2cluster' indexes = ( (('os', 'cluster'), True), ) class VmOs2Node(BaseModel): install_script_updated_at = DateTimeField(null=True) node = ForeignKeyField(column_name='node', field='id', model=VmNode) os = ForeignKeyField(column_name='os', field='id', model=VmOs) state = CharField(null=True) class Meta: table_name = 'vm_os2node' indexes = ( (('os', 'node'), True), ) class VmOsHistory(BaseModel): create_time = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) event_info = UnknownField(null=True) # json event_type = CharField(null=True) prev_time = DateTimeField(null=True) ref = ForeignKeyField(column_name='ref', field='id', model=VmOs, null=True) request_id = CharField(null=True) request_ip = CharField(null=True) request_owner = CharField(null=True) request_user = CharField(null=True) class Meta: table_name = 'vm_os_history' class VmOsOptions(BaseModel): name = CharField() os = ForeignKeyField(column_name='os', field='id', model=VmOs) value = CharField(null=True) class Meta: table_name = 'vm_os_options' indexes = ( (('name', 'os'), True), ) class VmPlatformBackupStorage(BaseModel): connection_params = UnknownField(null=True) # json storage_type = CharField(null=True) class Meta: table_name = 'vm_platform_backup_storage' class VmPlatformBackupStorage2Schedule(BaseModel): platform_backup_schedule = ForeignKeyField( column_name='platform_backup_schedule', field='id', model=VmPlatformBackupSchedule, null=True ) platform_backup_storage = ForeignKeyField( column_name='platform_backup_storage', field='id', model=VmPlatformBackupStorage, null=True ) class Meta: table_name = 'vm_platform_backup_storage2schedule' indexes = ( (('platform_backup_schedule', 'platform_backup_storage'), True), ) class VmPresetDisk(BaseModel): boot_order = IntegerField() preset = ForeignKeyField( column_name='preset', field='id', model=VmPreset, null=True ) size_mib = IntegerField() class Meta: table_name = 'vm_preset_disk' indexes = ( (('preset', 'boot_order'), True), ) class VmTag(BaseModel): immortal = IntegerField(constraints=[SQL("DEFAULT 0")]) name = CharField(unique=True) note = CharField(null=True) class Meta: table_name = 'vm_tag' class VmPresetDisk2Tag(BaseModel): preset_disk = ForeignKeyField( column_name='preset_disk', field='id', model=VmPresetDisk, null=True ) tag = ForeignKeyField( column_name='tag', field='id', model=VmTag, null=True ) class Meta: table_name = 'vm_preset_disk2tag' indexes = ( (('preset_disk', 'tag'), True), ) class VmRecipe(BaseModel): account = ForeignKeyField( column_name='account', field='id', model=VmAccount, null=True ) description = CharField(null=True) file_name = CharField(null=True) for_all = IntegerField(constraints=[SQL("DEFAULT 0")]) name = CharField(null=True) repository = ForeignKeyField( column_name='repository', field='id', model=VmRepository, null=True ) script = TextField(null=True) script_filter = UnknownField(null=True) # json state = CharField(null=True) tags = UnknownField(null=True) # json type = CharField(constraints=[SQL("DEFAULT 'shell'")]) updated_at = DateTimeField(constraints=[SQL("DEFAULT CURRENT_TIMESTAMP")]) user_visible = IntegerField(constraints=[SQL("DEFAULT 1")]) class Meta: table_name = 'vm_recipe' indexes = ( (('repository', 'name'), True), ) class VmRecipeEmail(BaseModel): content = TextField(null=True) lang = CharField(null=True) recipe = ForeignKeyField( column_name='recipe', field='id', model=VmRecipe, null=True ) subject = CharField(null=True) class Meta: table_name = 'vm_recipe_email' indexes = ( (('recipe', 'lang'), True), ) class VmRecipeParam(BaseModel): description = CharField(null=True) name = CharField(null=True) recipe = ForeignKeyField(column_name='recipe', field='id', model=VmRecipe) required = IntegerField(constraints=[SQL("DEFAULT 0")]) select_values = UnknownField(null=True) # json type = CharField(constraints=[SQL("DEFAULT 'input'")]) class Meta: table_name = 'vm_recipe_param' indexes = ( (('recipe', 'name'), True), ) class VmSchedule2BackupLocation(BaseModel): backup_location = ForeignKeyField( column_name='backup_location', field='id', model=VmBackupLocation, null=True ) schedule = ForeignKeyField( column_name='schedule', field='id', model=VmSchedule, null=True ) class Meta: table_name = 'vm_schedule2backup_location' indexes = ( (('schedule', 'backup_location'), True), ) class VmSchedule2Cluster(BaseModel): cluster = ForeignKeyField( column_name='cluster', field='id', model=VmCluster, null=True ) schedule = ForeignKeyField( column_name='schedule', field='id', model=VmSchedule, null=True ) class Meta: table_name = 'vm_schedule2cluster' indexes = ( (('schedule', 'cluster'), True), ) class VmSchedule2Disk(BaseModel): disk = ForeignKeyField( column_name='disk', field='id', model=VmDisk, null=True ) schedule = ForeignKeyField( column_name='schedule', field='id', model=VmSchedule, null=True) class Meta: table_name = 'vm_schedule2disk' indexes = ( (('schedule', 'disk'), True), ) class VmSchedule2Host(BaseModel): host = ForeignKeyField( column_name='host', field='id', model=VmHost, null=True ) schedule = ForeignKeyField( column_name='schedule', field='id', model=VmSchedule, null=True) class Meta: table_name = 'vm_schedule2host' indexes = ( (('schedule', 'host'), True), ) class VmSchedule2Node(BaseModel): node = ForeignKeyField( column_name='node', field='id', model=VmNode, null=True ) schedule = ForeignKeyField( column_name='schedule', field='id', model=VmSchedule, null=True) class Meta: table_name = 'vm_schedule2node' indexes = ( (('schedule', 'node'), True), ) class VmSchedule2Preset(BaseModel): preset = ForeignKeyField( column_name='preset', field='id', model=VmPreset, null=True ) schedule = ForeignKeyField( column_name='schedule', field='id', model=VmSchedule, null=True ) class Meta: table_name = 'vm_schedule2preset' indexes = ( (('schedule', 'preset'), True), ) class VmScriptVariable(BaseModel): account = ForeignKeyField( column_name='account', field='id', model=VmAccount, null=True ) builtin = IntegerField(constraints=[SQL("DEFAULT 0")]) comment = TextField(null=True) enabled = IntegerField(constraints=[SQL("DEFAULT 1")]) hidden = IntegerField(constraints=[SQL("DEFAULT 0")]) name = CharField(null=True) scope = CharField(constraints=[SQL("DEFAULT 'global'")]) value = TextField(null=True) class Meta: table_name = 'vm_script_variable' indexes = ( (('account', 'name'), True), ) class VmSettings(BaseModel): name = CharField(null=True, unique=True) value = TextField(null=True) class Meta: table_name = 'vm_settings' class VmSnapshot(BaseModel): host = ForeignKeyField(column_name='host', field='id', model=VmHost) name = CharField() type = CharField() vm5_data = UnknownField(null=True) # json class Meta: table_name = 'vm_snapshot' class VmSshKey(BaseModel): name = CharField(null=True) ssh_key = TextField(null=True) class Meta: table_name = 'vm_ssh_key' class VmSshKey2Cluster(BaseModel): cluster = ForeignKeyField( column_name='cluster', field='id', model=VmCluster, null=True ) ssh_key = ForeignKeyField( column_name='ssh_key', field='id', model=VmSshKey, null=True ) class Meta: table_name = 'vm_ssh_key2cluster' indexes = ( (('ssh_key', 'cluster'), True), ) class VmStatInstance(BaseModel): name = CharField(primary_key=True) value = TextField(null=True) class Meta: table_name = 'vm_stat_instance' class VmStatPolicy(BaseModel): name = CharField(primary_key=True) value = TextField(null=True) class Meta: table_name = 'vm_stat_policy' class VmStatSettings(BaseModel): name = CharField(primary_key=True) value = TextField(null=True) class Meta: table_name = 'vm_stat_settings' class VmStorage2Cluster(BaseModel): cluster = ForeignKeyField( column_name='cluster', field='id', model=VmCluster, null=True ) enabled = IntegerField(constraints=[SQL("DEFAULT 1")]) ha_params = UnknownField(null=True) # json hdd_overselling = FloatField(constraints=[SQL("DEFAULT 1")]) is_main = IntegerField(constraints=[SQL("DEFAULT 0")]) params = UnknownField(null=True) # json pool_name = CharField(null=True) storage = ForeignKeyField( column_name='storage', field='id', model=VmStorage, null=True ) class Meta: table_name = 'vm_storage2cluster' indexes = ( (('storage', 'cluster'), True), ) class VmStorage2Tag(BaseModel): storage = ForeignKeyField( column_name='storage', field='id', model=VmStorage, null=True ) tag = ForeignKeyField( column_name='tag', field='id', model=VmTag, null=True ) class Meta: table_name = 'vm_storage2tag' indexes = ( (('storage', 'tag'), True), ) class VmStorageTag(BaseModel): comment = CharField(null=True) name = CharField(null=True, unique=True) class Meta: table_name = 'vm_storage_tag' class VmTag2NetworkStorage(BaseModel): storage = ForeignKeyField( column_name='storage', field='id', model=VmNetworkStorage, null=True ) tag = IntegerField(index=True, null=True) class Meta: table_name = 'vm_tag2network_storage' class VmTag2Storage(BaseModel): storage = ForeignKeyField( column_name='storage', field='id', model=VmStorage, null=True ) tag = ForeignKeyField( column_name='tag', field='id', model=VmStorageTag, null=True ) class Meta: table_name = 'vm_tag2storage' class VmUserLimitsAccount(BaseModel): account = ForeignKeyField( column_name='account', field='id', model=VmAccount, null=True, unique=True ) cpu_number = IntegerField(null=True) cpu_number_total = IntegerField(null=True) hdd_mib = IntegerField(null=True) hdd_mib_total = IntegerField(null=True) host_count = IntegerField(null=True) image_count = IntegerField(null=True) image_count_total = IntegerField(null=True) ipv4_number = IntegerField(null=True) ipv4_number_total = IntegerField(null=True) ram_mib = IntegerField(null=True) ram_mib_total = IntegerField(null=True) vxlan_count_total = IntegerField(null=True) class Meta: table_name = 'vm_user_limits_account' class VmUserLimitsRole(BaseModel): cpu_number = IntegerField(null=True) cpu_number_total = IntegerField(null=True) hdd_mib = IntegerField(null=True) hdd_mib_total = IntegerField(null=True) host_count = IntegerField(null=True) image_count = IntegerField(null=True) image_count_total = IntegerField(null=True) ipv4_number = IntegerField(null=True) ipv4_number_total = IntegerField(null=True) ram_mib = IntegerField(null=True) ram_mib_total = IntegerField(null=True) role = CharField(null=True, unique=True) vxlan_count_total = IntegerField(null=True) class Meta: table_name = 'vm_user_limits_role' class VmVirtPool(BaseModel): cluster = ForeignKeyField( column_name='cluster', field='id', model=VmCluster, null=True ) name = CharField() params = UnknownField(null=True) # json storage = ForeignKeyField( column_name='storage', field='id', model=VmStorage, null=True ) class Meta: table_name = 'vm_virt_pool' class VmVirtPool2Node(BaseModel): node = ForeignKeyField( column_name='node', field='id', model=VmNode, null=True ) virt_pool = ForeignKeyField( column_name='virt_pool', field='id', model=VmVirtPool, null=True ) class Meta: table_name = 'vm_virt_pool2node' indexes = ( (('virt_pool', 'node'), True), ) class VmVxlan2Cluster(BaseModel): cluster = ForeignKeyField( column_name='cluster', field='id', model=VmCluster ) vxlan = ForeignKeyField(column_name='vxlan', field='id', model=VmVxlan) class Meta: table_name = 'vm_vxlan2cluster' indexes = ( (('vxlan', 'cluster'), True), )