From 92db269f61cbfc05753cdb85c311a75019f7c3e1 Mon Sep 17 00:00:00 2001 From: Kirill Date: Thu, 25 Jul 2024 16:05:52 +0000 Subject: [PATCH] feat: updated database instance type --- fixlib/fixlib/baseresources.py | 11 +---------- plugins/azure/fix_plugin_azure/resource/mysql.py | 3 ++- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/fixlib/fixlib/baseresources.py b/fixlib/fixlib/baseresources.py index 59af50c2f2..a1900ffb36 100644 --- a/fixlib/fixlib/baseresources.py +++ b/fixlib/fixlib/baseresources.py @@ -1095,20 +1095,11 @@ class DatabaseInstanceStatus(Enum): @define(eq=False, slots=False) -class BaseDatabaseInstanceType(BaseType): +class BaseDatabaseInstanceType(BaseInstanceType): kind: ClassVar[str] = "database_instance_type" kind_display: ClassVar[str] = "Database Instance Type" kind_description: ClassVar[str] = "A database instance type." metadata: ClassVar[Dict[str, Any]] = {"icon": "database", "group": "database"} - instance_type: Optional[str] = None - instance_cores: float = 0.0 - ondemand_cost: Optional[float] = None - reservations: Optional[int] = None - - def __attrs_post_init__(self) -> None: - super().__attrs_post_init__() - if self.instance_type is None: - self.instance_type = self.id @define(eq=False, slots=False) diff --git a/plugins/azure/fix_plugin_azure/resource/mysql.py b/plugins/azure/fix_plugin_azure/resource/mysql.py index 504379d445..17fe171d42 100644 --- a/plugins/azure/fix_plugin_azure/resource/mysql.py +++ b/plugins/azure/fix_plugin_azure/resource/mysql.py @@ -19,7 +19,7 @@ ModelReference, ) from fixlib.graph import BySearchCriteria -from fixlib.json_bender import K, AsBool, Bender, S, ForallBend, Bend, MapEnum, MapValue +from fixlib.json_bender import F, K, AsBool, Bender, S, ForallBend, Bend, MapEnum, MapValue from fixlib.types import Json service_name = "azure_mysql" @@ -369,6 +369,7 @@ class AzureMysqlServerType(MicrosoftResource, BaseDatabaseInstanceType): "capability_sku": S("sku") >> Bend(AzureSkuCapability.mapping), "display_location": S("location"), "instance_cores": S("sku", "vCores"), + "instance_memory": S("sku", "supportedMemoryPerVCoreMB") >> F(lambda mb: mb / 1024), } capability_zone: Optional[str] = field(default=None) supported_ha_mode: Optional[List[str]] = field(default=None)