2023-03-26 11:23:33 +02:00
|
|
|
from sqlalchemy import (
|
|
|
|
Column,
|
|
|
|
ForeignKey,
|
|
|
|
Integer,
|
|
|
|
JSON,
|
|
|
|
String,
|
|
|
|
)
|
|
|
|
|
2023-10-04 09:50:10 +02:00
|
|
|
from platypush.common.db import is_defined
|
2023-03-26 11:23:33 +02:00
|
|
|
|
|
|
|
from .devices import Device
|
|
|
|
|
|
|
|
|
2023-10-04 09:50:10 +02:00
|
|
|
if not is_defined('cloud_instance'):
|
2023-03-26 11:23:33 +02:00
|
|
|
|
|
|
|
class CloudInstance(Device):
|
|
|
|
"""
|
|
|
|
Entity that maps a cloud node - like a Linode or AWS instance.
|
|
|
|
"""
|
|
|
|
|
|
|
|
__tablename__ = 'cloud_instance'
|
|
|
|
|
|
|
|
id = Column(
|
|
|
|
Integer, ForeignKey(Device.id, ondelete='CASCADE'), primary_key=True
|
|
|
|
)
|
|
|
|
|
|
|
|
status = Column(String)
|
|
|
|
instance_type = Column(String)
|
|
|
|
ipv4_addresses = Column(JSON)
|
|
|
|
ipv6_address = Column(String)
|
|
|
|
group = Column(String)
|
|
|
|
tags = Column(JSON)
|
|
|
|
image = Column(String)
|
|
|
|
region = Column(String)
|
|
|
|
hypervisor = Column(String)
|
|
|
|
uuid = Column(String)
|
|
|
|
specs = Column(JSON)
|
|
|
|
alerts = Column(JSON)
|
|
|
|
backups = Column(JSON)
|
|
|
|
|
2023-10-04 09:50:10 +02:00
|
|
|
__table_args__ = {'extend_existing': True}
|
2023-03-26 11:23:33 +02:00
|
|
|
__mapper_args__ = {
|
|
|
|
'polymorphic_identity': __tablename__,
|
|
|
|
}
|