forked from p15670423/monkey
Common: Rename MutableBaseModel -> MutableInfectionMonkeyBaseModel
This commit is contained in:
parent
8e3abe7601
commit
def1dce86b
|
@ -46,7 +46,7 @@ class InfectionMonkeyBaseModel(BaseModel):
|
||||||
return BaseModel.dict(self, **kwargs)
|
return BaseModel.dict(self, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class MutableBaseModel(InfectionMonkeyBaseModel):
|
class MutableInfectionMonkeyBaseModel(InfectionMonkeyBaseModel):
|
||||||
class Config(InfectionMonkeyModelConfig):
|
class Config(InfectionMonkeyModelConfig):
|
||||||
allow_mutation = True
|
allow_mutation = True
|
||||||
validate_assignment = True
|
validate_assignment = True
|
||||||
|
|
|
@ -4,12 +4,12 @@ from uuid import UUID
|
||||||
|
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
|
|
||||||
from common.base_models import MutableBaseModel
|
from common.base_models import MutableInfectionMonkeyBaseModel
|
||||||
|
|
||||||
from . import MachineID
|
from . import MachineID
|
||||||
|
|
||||||
|
|
||||||
class Agent(MutableBaseModel):
|
class Agent(MutableInfectionMonkeyBaseModel):
|
||||||
id: UUID = Field(..., allow_mutation=False)
|
id: UUID = Field(..., allow_mutation=False)
|
||||||
machine_id: MachineID = Field(..., allow_mutation=False)
|
machine_id: MachineID = Field(..., allow_mutation=False)
|
||||||
start_time: datetime = Field(..., allow_mutation=False)
|
start_time: datetime = Field(..., allow_mutation=False)
|
||||||
|
|
|
@ -4,14 +4,14 @@ from typing import Optional, Sequence
|
||||||
from pydantic import Field, PositiveInt, validator
|
from pydantic import Field, PositiveInt, validator
|
||||||
|
|
||||||
from common import OperatingSystem
|
from common import OperatingSystem
|
||||||
from common.base_models import MutableBaseModel
|
from common.base_models import MutableInfectionMonkeyBaseModel
|
||||||
from common.transforms import make_immutable_sequence
|
from common.transforms import make_immutable_sequence
|
||||||
from common.types import HardwareID
|
from common.types import HardwareID
|
||||||
|
|
||||||
MachineID = PositiveInt
|
MachineID = PositiveInt
|
||||||
|
|
||||||
|
|
||||||
class Machine(MutableBaseModel):
|
class Machine(MutableInfectionMonkeyBaseModel):
|
||||||
id: MachineID = Field(..., allow_mutation=False)
|
id: MachineID = Field(..., allow_mutation=False)
|
||||||
hardware_id: Optional[HardwareID]
|
hardware_id: Optional[HardwareID]
|
||||||
network_interfaces: Sequence[IPv4Interface]
|
network_interfaces: Sequence[IPv4Interface]
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Sequence, Tuple
|
||||||
|
|
||||||
from pydantic import Field, validator
|
from pydantic import Field, validator
|
||||||
|
|
||||||
from common.base_models import MutableBaseModel
|
from common.base_models import MutableInfectionMonkeyBaseModel
|
||||||
from common.transforms import make_immutable_nested_sequence
|
from common.transforms import make_immutable_nested_sequence
|
||||||
|
|
||||||
from . import CommunicationType, MachineID
|
from . import CommunicationType, MachineID
|
||||||
|
@ -10,7 +10,7 @@ from . import CommunicationType, MachineID
|
||||||
ConnectionsSequence = Sequence[Tuple[MachineID, Sequence[CommunicationType]]]
|
ConnectionsSequence = Sequence[Tuple[MachineID, Sequence[CommunicationType]]]
|
||||||
|
|
||||||
|
|
||||||
class Node(MutableBaseModel):
|
class Node(MutableInfectionMonkeyBaseModel):
|
||||||
machine_id: MachineID = Field(..., allow_mutation=False)
|
machine_id: MachineID = Field(..., allow_mutation=False)
|
||||||
connections: ConnectionsSequence
|
connections: ConnectionsSequence
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue