mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-09-30 07:40:12 +03:00
Merge pull request #2925 from markparonyan/mypy-schemas-compute
fix(typing): resolve mypy errors in gns3server.schemas.compute
This commit is contained in:
commit
482e3faecb
@ -126,7 +126,7 @@ class CloudBase(BaseModel):
|
||||
Common cloud node properties.
|
||||
"""
|
||||
|
||||
name: str
|
||||
name: Optional[str] = None
|
||||
node_id: Optional[UUID] = None
|
||||
usage: Optional[str] = None
|
||||
remote_console_host: Optional[str] = Field(None, description="Remote console host or IP")
|
||||
@ -144,7 +144,7 @@ class CloudCreate(CloudBase):
|
||||
Properties to create a cloud node.
|
||||
"""
|
||||
|
||||
pass
|
||||
name: str
|
||||
|
||||
|
||||
class CloudUpdate(CloudBase):
|
||||
@ -152,10 +152,11 @@ class CloudUpdate(CloudBase):
|
||||
Properties to update a cloud node.
|
||||
"""
|
||||
|
||||
name: Optional[str] = None
|
||||
pass
|
||||
|
||||
|
||||
class Cloud(CloudBase):
|
||||
name: str
|
||||
project_id: UUID
|
||||
node_id: UUID
|
||||
ports_mapping: List[Union[EthernetPort, TAPPort, UDPPort]]
|
||||
|
||||
@ -41,8 +41,8 @@ class DockerBase(BaseModel):
|
||||
# the canonical "no path" value is "/" (the creation default)
|
||||
return value or "/"
|
||||
|
||||
name: str
|
||||
image: str = Field(..., description="Docker image name")
|
||||
name: Optional[str] = None
|
||||
image: Optional[str] = Field(None, description="Docker image name")
|
||||
node_id: Optional[UUID] = None
|
||||
console: Optional[int] = Field(None, gt=0, le=65535, description="Console TCP port")
|
||||
console_type: Optional[ConsoleType] = Field(None, description="Console type")
|
||||
@ -76,6 +76,8 @@ class DockerCreate(DockerBase):
|
||||
Properties to create a Docker node.
|
||||
"""
|
||||
|
||||
name: str
|
||||
image: str = Field(..., description="Docker image name")
|
||||
application_id: Optional[int] = Field(
|
||||
None, ge=1, le=1022, description="IOL application ID for iol-runner images (allocated by the controller)"
|
||||
)
|
||||
@ -93,11 +95,12 @@ class DockerUpdate(DockerBase):
|
||||
Properties to update a Docker node.
|
||||
"""
|
||||
|
||||
name: Optional[str] = None
|
||||
image: Optional[str] = Field(None, description="Docker image name")
|
||||
pass
|
||||
|
||||
|
||||
class Docker(DockerBase):
|
||||
name: str
|
||||
image: str = Field(..., description="Docker image name")
|
||||
container_id: str = Field(
|
||||
..., min_length=12, max_length=64, pattern="^[a-f0-9]+$", description="Docker container ID (read only)"
|
||||
)
|
||||
|
||||
@ -26,8 +26,8 @@ class FrameRelaySwitchBase(BaseModel):
|
||||
Common Frame Relay switch properties.
|
||||
"""
|
||||
|
||||
name: str = None
|
||||
node_id: UUID = None
|
||||
name: Optional[str] = None
|
||||
node_id: Optional[UUID] = None
|
||||
usage: Optional[str] = None
|
||||
mappings: Optional[dict] = None
|
||||
|
||||
|
||||
@ -26,9 +26,9 @@ class IOUBase(BaseModel):
|
||||
Common IOU node properties.
|
||||
"""
|
||||
|
||||
name: str
|
||||
path: str = Field(..., description="IOU executable path")
|
||||
application_id: int = Field(..., description="Application ID for running IOU executable")
|
||||
name: Optional[str] = None
|
||||
path: Optional[str] = Field(None, description="IOU executable path")
|
||||
application_id: Optional[int] = Field(None, description="Application ID for running IOU executable")
|
||||
node_id: Optional[UUID] = None
|
||||
usage: Optional[str] = Field(None, description="How to use the node")
|
||||
console: Optional[int] = Field(None, gt=0, le=65535, description="Console TCP port")
|
||||
@ -52,7 +52,9 @@ class IOUCreate(IOUBase):
|
||||
Properties to create an IOU node.
|
||||
"""
|
||||
|
||||
pass
|
||||
name: str
|
||||
path: str = Field(..., description="IOU executable path")
|
||||
application_id: int = Field(..., description="Application ID for running IOU executable")
|
||||
|
||||
|
||||
class IOUUpdate(IOUBase):
|
||||
@ -60,12 +62,13 @@ class IOUUpdate(IOUBase):
|
||||
Properties to update an IOU node.
|
||||
"""
|
||||
|
||||
name: Optional[str] = None
|
||||
path: Optional[str] = Field(None, description="IOU executable path")
|
||||
application_id: Optional[int] = Field(None, description="Application ID for running IOU executable")
|
||||
pass
|
||||
|
||||
|
||||
class IOU(IOUBase):
|
||||
name: str
|
||||
path: str = Field(..., description="IOU executable path")
|
||||
application_id: int = Field(..., description="Application ID for running IOU executable")
|
||||
project_id: UUID = Field(..., description="Project ID")
|
||||
node_directory: str = Field(..., description="Path to the node working directory (read only)")
|
||||
command_line: str = Field(..., description="Last command line used to start IOU (read only)")
|
||||
|
||||
@ -155,7 +155,7 @@ class QemuBase(BaseModel):
|
||||
Common Qemu node properties.
|
||||
"""
|
||||
|
||||
name: str
|
||||
name: Optional[str] = None
|
||||
node_id: Optional[UUID] = None
|
||||
usage: Optional[str] = Field(None, description="How to use the node")
|
||||
linked_clone: Optional[bool] = Field(None, description="Whether the VM is a linked clone or not")
|
||||
@ -219,6 +219,7 @@ class QemuCreate(QemuBase):
|
||||
Properties to create a Qemu node.
|
||||
"""
|
||||
|
||||
name: str
|
||||
disk_images_to_reset: Optional[List[str]] = Field(
|
||||
None,
|
||||
description="Disk image properties whose stale linked-clone overlays must be recreated",
|
||||
@ -230,10 +231,11 @@ class QemuUpdate(QemuBase):
|
||||
Properties to update a Qemu node.
|
||||
"""
|
||||
|
||||
name: Optional[str] = None
|
||||
pass
|
||||
|
||||
|
||||
class Qemu(QemuBase):
|
||||
name: str
|
||||
project_id: UUID = Field(..., description="Project ID")
|
||||
node_directory: str = Field(..., description="Path to the node working directory (read only)")
|
||||
command_line: str = Field(..., description="Last command line used to start IOU (read only)")
|
||||
|
||||
@ -56,8 +56,8 @@ class VirtualBoxBase(BaseModel):
|
||||
Common VirtualBox node properties.
|
||||
"""
|
||||
|
||||
name: str
|
||||
vmname: str = Field(..., description="VirtualBox VM name (in VirtualBox itself)")
|
||||
name: Optional[str] = None
|
||||
vmname: Optional[str] = None
|
||||
node_id: Optional[UUID] = None
|
||||
linked_clone: Optional[bool] = Field(None, description="Whether the VM is a linked clone or not")
|
||||
usage: Optional[str] = Field(None, description="How to use the node")
|
||||
@ -78,7 +78,8 @@ class VirtualBoxCreate(VirtualBoxBase):
|
||||
Properties to create a VirtualBox node.
|
||||
"""
|
||||
|
||||
pass
|
||||
name: str
|
||||
vmname: str = Field(..., description="VirtualBox VM name (in VirtualBox itself)")
|
||||
|
||||
|
||||
class VirtualBoxUpdate(VirtualBoxBase):
|
||||
@ -86,11 +87,12 @@ class VirtualBoxUpdate(VirtualBoxBase):
|
||||
Properties to update a VirtualBox node.
|
||||
"""
|
||||
|
||||
name: Optional[str] = None
|
||||
vmname: Optional[str] = None
|
||||
pass
|
||||
|
||||
|
||||
class VirtualBox(VirtualBoxBase):
|
||||
name: str
|
||||
vmname: str = Field(..., description="VirtualBox VM name (in VirtualBox itself)")
|
||||
project_id: UUID = Field(..., description="Project ID")
|
||||
node_directory: Optional[str] = Field(None, description="Path to the node working directory (read only)")
|
||||
status: NodeStatus = Field(..., description="Container status (read only)")
|
||||
|
||||
@ -312,12 +312,6 @@ module = [
|
||||
"gns3server.db.repositories.templates", # 6
|
||||
"gns3server.db.repositories.users", # 12
|
||||
"gns3server.db.tasks", # 12
|
||||
"gns3server.schemas.compute.cloud_nodes", # 1
|
||||
"gns3server.schemas.compute.docker_nodes", # 2
|
||||
"gns3server.schemas.compute.frame_relay_switch_nodes", # 5
|
||||
"gns3server.schemas.compute.iou_nodes", # 3
|
||||
"gns3server.schemas.compute.qemu_nodes", # 1
|
||||
"gns3server.schemas.compute.virtualbox_nodes", # 2
|
||||
"gns3server.schemas.compute.vmware_nodes", # 3
|
||||
"gns3server.schemas.compute.vpcs_nodes", # 1
|
||||
"gns3server.schemas.controller.appliances", # 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user