Skip to content

Commit

Permalink
feat: updated database instance type
Browse files Browse the repository at this point in the history
  • Loading branch information
1101-1 committed Jul 25, 2024
1 parent c93ec46 commit 92db269
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
11 changes: 1 addition & 10 deletions fixlib/fixlib/baseresources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion plugins/azure/fix_plugin_azure/resource/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 92db269

Please sign in to comment.