class OfferContractRelationship(Base): __tablename__ = 'offer_contract_relationship' offer_contract_relationship_id = orm.Column( orm.String(64), primary_key=True, autoincrement=False, ) marketplace_offer_id = orm.Column( orm.String(64), orm.ForeignKey('offers.marketplace_offer_id')) marketplace_offer = orm.relationship('Offer') contract_id = orm.Column(orm.String(64), orm.ForeignKey('contracts.contract_id')) contract = orm.relationship('Contract') status = orm.Column(orm.String(15), nullable=False, default='available')
class Offer(Base): __tablename__ = "offers" marketplace_offer_id = orm.Column( orm.String(64), primary_key=True, autoincrement=False, ) provider_offer_id = orm.Column( orm.String(64), nullable=False, unique=True, ) project_id = orm.Column(orm.String(64), nullable=False) status = orm.Column(orm.String(15), nullable=False, default="available") server_id = orm.Column(orm.String(64), nullable=False, unique=True) start_time = orm.Column(orm.DateTime(timezone=True), nullable=False) end_time = orm.Column(orm.DateTime(timezone=True), nullable=True) server_config = orm.Column( sqlalchemy_jsonfield.JSONField(enforce_string=True, enforce_unicode=False), nullable=False, ) cost = orm.Column(orm.Float, nullable=False) offer_contract_relationships = orm.relationship( 'OfferContractRelationship', lazy='dynamic')
class Offer(Base): __tablename__ = "offers" offer_id = orm.Column( orm.String(64), primary_key=True, autoincrement=False, ) project_id = orm.Column(orm.String(64), nullable=False) status = orm.Column(orm.String(15), nullable=False, default=statuses.AVAILABLE) resource_id = orm.Column(orm.String(64), nullable=False) resource_type = orm.Column(orm.String(64), nullable=False, default=resource_types.IRONIC_NODE) start_time = orm.Column(orm.DateTime(timezone=True), nullable=False) end_time = orm.Column(orm.DateTime(timezone=True), nullable=True) config = orm.Column( sqlalchemy_jsonfield.JSONField(enforce_string=True, enforce_unicode=False), nullable=False, ) cost = orm.Column(orm.Float, nullable=False) offer_contract_relationships = orm.relationship( 'OfferContractRelationship', lazy='dynamic') @orm.validates('cost') def validate_cost(self, key, value): if value < 0: raise ValueError('Cost must be >= 0') return value
class Bid(Base): __tablename__ = 'bids' bid_id = orm.Column( orm.String(64), primary_key=True, autoincrement=False, ) project_id = orm.Column(orm.String(64), nullable=False) quantity = orm.Column(orm.Integer, nullable=False) start_time = orm.Column(orm.DateTime(timezone=True), nullable=False) end_time = orm.Column(orm.DateTime(timezone=True), nullable=False) duration = orm.Column(orm.Integer, nullable=False) status = orm.Column(orm.String(15), nullable=False, default=statuses.AVAILABLE) config_query = orm.Column(sqlalchemy_jsonfield.JSONField( enforce_string=True, enforce_unicode=False), nullable=False) cost = orm.Column(orm.Float, nullable=False) contracts = orm.relationship('Contract', lazy='dynamic') @orm.validates('cost') def validate_cost(self, key, value): if value < 0: raise ValueError('Cost must be >= 0') return value
class Contract(Base): __tablename__ = 'contracts' contract_id = orm.Column( orm.String(64), primary_key=True, autoincrement=False, ) status = orm.Column(orm.String(15), nullable=False, default='unretrieved') start_time = orm.Column(orm.DateTime(timezone=True), nullable=False) end_time = orm.Column(orm.DateTime(timezone=True), nullable=False) cost = orm.Column(orm.Float, nullable=False) bid_id = orm.Column(orm.String(64), orm.ForeignKey('bids.marketplace_bid_id')) bid = orm.relationship('Bid') offer_contract_relationships = orm.relationship( 'OfferContractRelationship', lazy='dynamic') project_id = orm.Column(orm.String(64), nullable=False)
class Bid(Base): __tablename__ = 'bids' marketplace_bid_id = orm.Column( orm.String(64), primary_key=True, autoincrement=False, ) project_id = orm.Column(orm.String(64), nullable=False) server_quantity = orm.Column(orm.Integer, nullable=False) start_time = orm.Column(orm.DateTime(timezone=True), nullable=False) end_time = orm.Column(orm.DateTime(timezone=True), nullable=False) duration = orm.Column(orm.Integer, nullable=False) status = orm.Column(orm.String(15), nullable=False, default='available') server_config_query = orm.Column(sqlalchemy_jsonfield.JSONField( enforce_string=True, enforce_unicode=False), nullable=False) cost = orm.Column(orm.Float, nullable=False) contracts = orm.relationship('Contract', lazy='dynamic')