Skip to content

Commit

Permalink
Update FivetranConnectorScheduleType to subclass str
Browse files Browse the repository at this point in the history
  • Loading branch information
maximearmstrong committed Nov 20, 2024
1 parent d341d4b commit 8e607df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,10 @@ def update_schedule_type_for_connector(
Returns:
Dict[str, Any]: Parsed json data representing the API response.
"""
if not FivetranConnectorScheduleType.has_value(schedule_type):
schedule_types = {s for s in FivetranConnectorScheduleType}
if schedule_type not in schedule_types:
check.failed(
f"The schedule_type for a connector must be in {FivetranConnectorScheduleType.values()}: "
f"The schedule_type for a connector must be in {schedule_types}: "
f"got '{schedule_type}'"
)
return self._make_connector_request(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,12 @@ class FivetranConnectorTableProps(NamedTuple):
service: Optional[str]


class FivetranConnectorScheduleType(Enum):
class FivetranConnectorScheduleType(str, Enum):
"""Enum representing each schedule type for a connector in Fivetran's ontology."""

AUTO = "auto"
MANUAL = "manual"

@classmethod
def has_value(cls, value) -> bool:
return value in cls._value2member_map_

@classmethod
def values(cls) -> Sequence[str]:
return list(cls._value2member_map_.keys())


class FivetranConnectorSetupStateType(Enum):
"""Enum representing each setup state for a connector in Fivetran's ontology."""
Expand Down

0 comments on commit 8e607df

Please sign in to comment.