diff --git a/google/cloud/sql/connector/enums.py b/google/cloud/sql/connector/enums.py index 86556ed2..a0c4b5c5 100644 --- a/google/cloud/sql/connector/enums.py +++ b/google/cloud/sql/connector/enums.py @@ -14,14 +14,14 @@ from __future__ import annotations -from enum import Enum +from enum import StrEnum from google.cloud.sql.connector.exceptions import IncompatibleDriverError -class RefreshStrategy(Enum): - LAZY: str = "LAZY" - BACKGROUND: str = "BACKGROUND" +class RefreshStrategy(StrEnum): + LAZY = "LAZY" + BACKGROUND = "BACKGROUND" @classmethod def _missing_(cls, value: object) -> None: @@ -36,10 +36,10 @@ def _from_str(cls, refresh_strategy: str) -> RefreshStrategy: return cls(refresh_strategy.upper()) -class IPTypes(Enum): - PUBLIC: str = "PRIMARY" - PRIVATE: str = "PRIVATE" - PSC: str = "PSC" +class IPTypes(StrEnum): + PUBLIC = "PRIMARY" + PRIVATE = "PRIVATE" + PSC = "PSC" @classmethod def _missing_(cls, value: object) -> None: @@ -56,7 +56,7 @@ def _from_str(cls, ip_type_str: str) -> IPTypes: return cls(ip_type_str.upper()) -class DriverMapping(Enum): +class DriverMapping(StrEnum): """Maps a given database driver to it's corresponding database engine.""" ASYNCPG = "POSTGRES"