Skip to content

Commit

Permalink
feat(baremetal): add GetDefaultPartitioningRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
Laure-di committed Oct 10, 2024
1 parent e6ad3dc commit 05707fc
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 400 deletions.
8 changes: 0 additions & 8 deletions scaleway-async/scaleway_async/baremetal/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from .types import OfferStock
from .types import OfferSubscriptionPeriod
from .types import SchemaFilesystemFormat
from .types import SchemaLogicalVolumeType
from .types import SchemaPartitionLabel
from .types import SchemaPoolType
from .types import SchemaRAIDLevel
Expand All @@ -23,13 +22,10 @@
from .types import ServerStatus
from .content import SERVER_TRANSIENT_STATUSES
from .types import SettingType
from .types import SchemaLogicalVolume
from .types import SchemaPartition
from .types import SchemaVolumeGroup
from .types import SchemaPool
from .types import SchemaDisk
from .types import SchemaFilesystem
from .types import SchemaLVM
from .types import SchemaRAID
from .types import SchemaZFS
from .types import CertificationOption
Expand Down Expand Up @@ -111,7 +107,6 @@
"OfferStock",
"OfferSubscriptionPeriod",
"SchemaFilesystemFormat",
"SchemaLogicalVolumeType",
"SchemaPartitionLabel",
"SchemaPoolType",
"SchemaRAIDLevel",
Expand All @@ -125,13 +120,10 @@
"ServerStatus",
"SERVER_TRANSIENT_STATUSES",
"SettingType",
"SchemaLogicalVolume",
"SchemaPartition",
"SchemaVolumeGroup",
"SchemaPool",
"SchemaDisk",
"SchemaFilesystem",
"SchemaLVM",
"SchemaRAID",
"SchemaZFS",
"CertificationOption",
Expand Down
148 changes: 0 additions & 148 deletions scaleway-async/scaleway_async/baremetal/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@
resolve_one_of,
)
from .types import (
SchemaLogicalVolume,
SchemaPartition,
SchemaVolumeGroup,
SchemaPool,
SchemaDisk,
SchemaFilesystem,
SchemaLVM,
SchemaRAID,
SchemaZFS,
Schema,
Expand Down Expand Up @@ -73,37 +70,6 @@
)


def unmarshal_SchemaLogicalVolume(data: Any) -> SchemaLogicalVolume:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'SchemaLogicalVolume' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

field = data.get("name", None)
if field is not None:
args["name"] = field

field = data.get("type", None)
if field is not None:
args["type_"] = field

field = data.get("size", None)
if field is not None:
args["size"] = field

field = data.get("striped_number", None)
if field is not None:
args["striped_number"] = field

field = data.get("mirror_number", None)
if field is not None:
args["mirror_number"] = field

return SchemaLogicalVolume(**args)


def unmarshal_SchemaPartition(data: Any) -> SchemaPartition:
if not isinstance(data, dict):
raise TypeError(
Expand All @@ -127,33 +93,6 @@ def unmarshal_SchemaPartition(data: Any) -> SchemaPartition:
return SchemaPartition(**args)


def unmarshal_SchemaVolumeGroup(data: Any) -> SchemaVolumeGroup:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'SchemaVolumeGroup' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

field = data.get("volume_group_name", None)
if field is not None:
args["volume_group_name"] = field

field = data.get("physical_volumes", None)
if field is not None:
args["physical_volumes"] = field

field = data.get("logical_volumes", None)
if field is not None:
args["logical_volumes"] = (
[unmarshal_SchemaLogicalVolume(v) for v in field]
if field is not None
else None
)

return SchemaVolumeGroup(**args)


def unmarshal_SchemaPool(data: Any) -> SchemaPool:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -229,25 +168,6 @@ def unmarshal_SchemaFilesystem(data: Any) -> SchemaFilesystem:
return SchemaFilesystem(**args)


def unmarshal_SchemaLVM(data: Any) -> SchemaLVM:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'SchemaLVM' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

field = data.get("volume_groups", None)
if field is not None:
args["volume_groups"] = (
[unmarshal_SchemaVolumeGroup(v) for v in field]
if field is not None
else None
)

return SchemaLVM(**args)


def unmarshal_SchemaRAID(data: Any) -> SchemaRAID:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -316,12 +236,6 @@ def unmarshal_Schema(data: Any) -> Schema:
else None
)

field = data.get("lvm", None)
if field is not None:
args["lvm"] = unmarshal_SchemaLVM(field)
else:
args["lvm"] = None

field = data.get("zfs", None)
if field is not None:
args["zfs"] = unmarshal_SchemaZFS(field)
Expand Down Expand Up @@ -1653,30 +1567,6 @@ def marshal_UpdateSettingRequest(
return output


def marshal_SchemaLogicalVolume(
request: SchemaLogicalVolume,
defaults: ProfileDefaults,
) -> Dict[str, Any]:
output: Dict[str, Any] = {}

if request.name is not None:
output["name"] = request.name

if request.type_ is not None:
output["type"] = str(request.type_)

if request.size is not None:
output["size"] = request.size

if request.striped_number is not None:
output["striped_number"] = request.striped_number

if request.mirror_number is not None:
output["mirror_number"] = request.mirror_number

return output


def marshal_SchemaPartition(
request: SchemaPartition,
defaults: ProfileDefaults,
Expand All @@ -1695,27 +1585,6 @@ def marshal_SchemaPartition(
return output


def marshal_SchemaVolumeGroup(
request: SchemaVolumeGroup,
defaults: ProfileDefaults,
) -> Dict[str, Any]:
output: Dict[str, Any] = {}

if request.volume_group_name is not None:
output["volume_group_name"] = request.volume_group_name

if request.physical_volumes is not None:
output["physical_volumes"] = request.physical_volumes

if request.logical_volumes is not None:
output["logical_volumes"] = [
marshal_SchemaLogicalVolume(item, defaults)
for item in request.logical_volumes
]

return output


def marshal_SchemaPool(
request: SchemaPool,
defaults: ProfileDefaults,
Expand Down Expand Up @@ -1775,20 +1644,6 @@ def marshal_SchemaFilesystem(
return output


def marshal_SchemaLVM(
request: SchemaLVM,
defaults: ProfileDefaults,
) -> Dict[str, Any]:
output: Dict[str, Any] = {}

if request.volume_groups is not None:
output["volume_groups"] = [
marshal_SchemaVolumeGroup(item, defaults) for item in request.volume_groups
]

return output


def marshal_SchemaRAID(
request: SchemaRAID,
defaults: ProfileDefaults,
Expand Down Expand Up @@ -1836,9 +1691,6 @@ def marshal_Schema(
marshal_SchemaFilesystem(item, defaults) for item in request.filesystems
]

if request.lvm is not None:
output["lvm"] = marshal_SchemaLVM(request.lvm, defaults)

if request.zfs is not None:
output["zfs"] = marshal_SchemaZFS(request.zfs, defaults)

Expand Down
45 changes: 1 addition & 44 deletions scaleway-async/scaleway_async/baremetal/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,7 @@ class SchemaFilesystemFormat(str, Enum, metaclass=StrEnumMeta):
EXT4 = "ext4"
SWAP = "swap"
ZFS = "zfs"

def __str__(self) -> str:
return str(self.value)


class SchemaLogicalVolumeType(str, Enum, metaclass=StrEnumMeta):
UNKNOWN_RAID_TYPE = "unknown_raid_type"
STRIPED = "striped"
MIRROR = "mirror"
RAID0 = "raid0"
RAID1 = "raid1"
RAID5 = "raid5"
RAID6 = "raid6"
RAID10 = "raid10"
XFS = "xfs"

def __str__(self) -> str:
return str(self.value)
Expand All @@ -122,7 +109,6 @@ class SchemaPartitionLabel(str, Enum, metaclass=StrEnumMeta):
DATA = "data"
HOME = "home"
RAID = "raid"
LVM = "lvm"
ZFS = "zfs"

def __str__(self) -> str:
Expand Down Expand Up @@ -230,19 +216,6 @@ def __str__(self) -> str:
return str(self.value)


@dataclass
class SchemaLogicalVolume:
name: str

type_: SchemaLogicalVolumeType

size: int

striped_number: int

mirror_number: int


@dataclass
class SchemaPartition:
label: SchemaPartitionLabel
Expand All @@ -252,15 +225,6 @@ class SchemaPartition:
size: int


@dataclass
class SchemaVolumeGroup:
volume_group_name: str

physical_volumes: List[str]

logical_volumes: List[SchemaLogicalVolume]


@dataclass
class SchemaPool:
name: str
Expand Down Expand Up @@ -290,11 +254,6 @@ class SchemaFilesystem:
mountpoint: str


@dataclass
class SchemaLVM:
volume_groups: List[SchemaVolumeGroup]


@dataclass
class SchemaRAID:
name: str
Expand Down Expand Up @@ -342,8 +301,6 @@ class Schema:

filesystems: List[SchemaFilesystem]

lvm: Optional[SchemaLVM]

zfs: Optional[SchemaZFS]


Expand Down
8 changes: 0 additions & 8 deletions scaleway/scaleway/baremetal/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from .types import OfferStock
from .types import OfferSubscriptionPeriod
from .types import SchemaFilesystemFormat
from .types import SchemaLogicalVolumeType
from .types import SchemaPartitionLabel
from .types import SchemaPoolType
from .types import SchemaRAIDLevel
Expand All @@ -23,13 +22,10 @@
from .types import ServerStatus
from .content import SERVER_TRANSIENT_STATUSES
from .types import SettingType
from .types import SchemaLogicalVolume
from .types import SchemaPartition
from .types import SchemaVolumeGroup
from .types import SchemaPool
from .types import SchemaDisk
from .types import SchemaFilesystem
from .types import SchemaLVM
from .types import SchemaRAID
from .types import SchemaZFS
from .types import CertificationOption
Expand Down Expand Up @@ -111,7 +107,6 @@
"OfferStock",
"OfferSubscriptionPeriod",
"SchemaFilesystemFormat",
"SchemaLogicalVolumeType",
"SchemaPartitionLabel",
"SchemaPoolType",
"SchemaRAIDLevel",
Expand All @@ -125,13 +120,10 @@
"ServerStatus",
"SERVER_TRANSIENT_STATUSES",
"SettingType",
"SchemaLogicalVolume",
"SchemaPartition",
"SchemaVolumeGroup",
"SchemaPool",
"SchemaDisk",
"SchemaFilesystem",
"SchemaLVM",
"SchemaRAID",
"SchemaZFS",
"CertificationOption",
Expand Down
Loading

0 comments on commit 05707fc

Please sign in to comment.