Skip to content

feat(baremetal): add gpu in offer #712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scaleway-async/scaleway_async/baremetal/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from .types import OSOSField
from .types import CPU
from .types import Disk
from .types import GPU
from .types import Memory
from .types import OfferOptionOffer
from .types import PersistentMemory
Expand Down Expand Up @@ -135,6 +136,7 @@
"OSOSField",
"CPU",
"Disk",
"GPU",
"Memory",
"OfferOptionOffer",
"PersistentMemory",
Expand Down
44 changes: 34 additions & 10 deletions scaleway-async/scaleway_async/baremetal/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
RemoteAccessOption,
CPU,
Disk,
GPU,
Memory,
OfferOptionOffer,
PersistentMemory,
Expand Down Expand Up @@ -495,6 +496,25 @@ def unmarshal_Disk(data: Any) -> Disk:
return Disk(**args)


def unmarshal_GPU(data: Any) -> GPU:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'GPU' 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("vram", None)
if field is not None:
args["vram"] = field

return GPU(**args)


def unmarshal_Memory(data: Any) -> Memory:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -679,6 +699,16 @@ def unmarshal_Offer(data: Any) -> Offer:
if field is not None:
args["enable"] = field

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

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

field = data.get("price_per_hour", None)
if field is not None:
args["price_per_hour"] = unmarshal_Money(field)
Expand All @@ -691,16 +721,6 @@ def unmarshal_Offer(data: Any) -> Offer:
else:
args["price_per_month"] = None

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

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

field = data.get("quota_name", None)
if field is not None:
args["quota_name"] = field
Expand Down Expand Up @@ -751,6 +771,10 @@ def unmarshal_Offer(data: Any) -> Offer:
if field is not None:
args["tags"] = field

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

field = data.get("fee", None)
if field is not None:
args["fee"] = unmarshal_Money(field)
Expand Down
34 changes: 26 additions & 8 deletions scaleway-async/scaleway_async/baremetal/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,19 @@ class Disk:
"""


@dataclass
class GPU:
name: str
"""
Name of the GPU.
"""

vram: int
"""
Capacity of the vram in bytes.
"""


@dataclass
class Memory:
capacity: int
Expand Down Expand Up @@ -731,24 +744,24 @@ class Offer:
Defines whether the offer is currently available.
"""

price_per_hour: Optional[Money]
cpus: List[CPU]
"""
Price of the offer for the next 60 minutes (a server order at 11h32 will be payed until 12h32).
CPU specifications of the offer.
"""

price_per_month: Optional[Money]
memories: List[Memory]
"""
Monthly price of the offer, if subscribing on a monthly basis.
Memory specifications of the offer.
"""

cpus: List[CPU]
price_per_hour: Optional[Money]
"""
CPU specifications of the offer.
Price of the offer for the next 60 minutes (a server order at 11h32 will be payed until 12h32).
"""

memories: List[Memory]
price_per_month: Optional[Money]
"""
Memory specifications of the offer.
Monthly price of the offer, if subscribing on a monthly basis.
"""

quota_name: str
Expand Down Expand Up @@ -801,6 +814,11 @@ class Offer:
Array of tags attached to the offer.
"""

gpus: List[GPU]
"""
GPU specifications of the offer.
"""

fee: Optional[Money]
"""
One time fee invoiced by Scaleway for the setup and activation of the server.
Expand Down
2 changes: 2 additions & 0 deletions scaleway/scaleway/baremetal/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from .types import OSOSField
from .types import CPU
from .types import Disk
from .types import GPU
from .types import Memory
from .types import OfferOptionOffer
from .types import PersistentMemory
Expand Down Expand Up @@ -135,6 +136,7 @@
"OSOSField",
"CPU",
"Disk",
"GPU",
"Memory",
"OfferOptionOffer",
"PersistentMemory",
Expand Down
44 changes: 34 additions & 10 deletions scaleway/scaleway/baremetal/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
RemoteAccessOption,
CPU,
Disk,
GPU,
Memory,
OfferOptionOffer,
PersistentMemory,
Expand Down Expand Up @@ -495,6 +496,25 @@ def unmarshal_Disk(data: Any) -> Disk:
return Disk(**args)


def unmarshal_GPU(data: Any) -> GPU:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'GPU' 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("vram", None)
if field is not None:
args["vram"] = field

return GPU(**args)


def unmarshal_Memory(data: Any) -> Memory:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -679,6 +699,16 @@ def unmarshal_Offer(data: Any) -> Offer:
if field is not None:
args["enable"] = field

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

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

field = data.get("price_per_hour", None)
if field is not None:
args["price_per_hour"] = unmarshal_Money(field)
Expand All @@ -691,16 +721,6 @@ def unmarshal_Offer(data: Any) -> Offer:
else:
args["price_per_month"] = None

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

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

field = data.get("quota_name", None)
if field is not None:
args["quota_name"] = field
Expand Down Expand Up @@ -751,6 +771,10 @@ def unmarshal_Offer(data: Any) -> Offer:
if field is not None:
args["tags"] = field

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

field = data.get("fee", None)
if field is not None:
args["fee"] = unmarshal_Money(field)
Expand Down
34 changes: 26 additions & 8 deletions scaleway/scaleway/baremetal/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,19 @@ class Disk:
"""


@dataclass
class GPU:
name: str
"""
Name of the GPU.
"""

vram: int
"""
Capacity of the vram in bytes.
"""


@dataclass
class Memory:
capacity: int
Expand Down Expand Up @@ -731,24 +744,24 @@ class Offer:
Defines whether the offer is currently available.
"""

price_per_hour: Optional[Money]
cpus: List[CPU]
"""
Price of the offer for the next 60 minutes (a server order at 11h32 will be payed until 12h32).
CPU specifications of the offer.
"""

price_per_month: Optional[Money]
memories: List[Memory]
"""
Monthly price of the offer, if subscribing on a monthly basis.
Memory specifications of the offer.
"""

cpus: List[CPU]
price_per_hour: Optional[Money]
"""
CPU specifications of the offer.
Price of the offer for the next 60 minutes (a server order at 11h32 will be payed until 12h32).
"""

memories: List[Memory]
price_per_month: Optional[Money]
"""
Memory specifications of the offer.
Monthly price of the offer, if subscribing on a monthly basis.
"""

quota_name: str
Expand Down Expand Up @@ -801,6 +814,11 @@ class Offer:
Array of tags attached to the offer.
"""

gpus: List[GPU]
"""
GPU specifications of the offer.
"""

fee: Optional[Money]
"""
One time fee invoiced by Scaleway for the setup and activation of the server.
Expand Down