diff --git a/scaleway-async/scaleway_async/cockpit/v1/__init__.py b/scaleway-async/scaleway_async/cockpit/v1/__init__.py index 6d028da8..44d90e37 100644 --- a/scaleway-async/scaleway_async/cockpit/v1/__init__.py +++ b/scaleway-async/scaleway_async/cockpit/v1/__init__.py @@ -23,6 +23,8 @@ from .types import Token from .types import Usage from .types import AlertManager +from .types import DisableAlertRulesResponse +from .types import EnableAlertRulesResponse from .types import GetConfigResponse from .types import GlobalApiCreateGrafanaUserRequest from .types import GlobalApiDeleteGrafanaUserRequest @@ -95,6 +97,8 @@ "Token", "Usage", "AlertManager", + "DisableAlertRulesResponse", + "EnableAlertRulesResponse", "GetConfigResponse", "GlobalApiCreateGrafanaUserRequest", "GlobalApiDeleteGrafanaUserRequest", diff --git a/scaleway-async/scaleway_async/cockpit/v1/api.py b/scaleway-async/scaleway_async/cockpit/v1/api.py index 56b69bf2..52897404 100644 --- a/scaleway-async/scaleway_async/cockpit/v1/api.py +++ b/scaleway-async/scaleway_async/cockpit/v1/api.py @@ -26,6 +26,8 @@ ContactPoint, ContactPointEmail, DataSource, + DisableAlertRulesResponse, + EnableAlertRulesResponse, GetConfigResponse, GlobalApiCreateGrafanaUserRequest, GlobalApiResetGrafanaUserPasswordRequest, @@ -66,6 +68,8 @@ unmarshal_Plan, unmarshal_Token, unmarshal_AlertManager, + unmarshal_DisableAlertRulesResponse, + unmarshal_EnableAlertRulesResponse, unmarshal_GetConfigResponse, unmarshal_Grafana, unmarshal_ListAlertsResponse, @@ -1559,12 +1563,13 @@ async def enable_alert_rules( region: Optional[ScwRegion] = None, project_id: Optional[str] = None, rule_ids: Optional[List[str]] = None, - ) -> None: + ) -> EnableAlertRulesResponse: """ Enable preconfigured alert rules. Enable alert rules from the list of available preconfigured rules. :param region: Region to target. If none is passed will use default region from the config. :param project_id: :param rule_ids: + :return: :class:`EnableAlertRulesResponse ` Usage: :: @@ -1590,6 +1595,7 @@ async def enable_alert_rules( ) self._throw_on_error(res) + return unmarshal_EnableAlertRulesResponse(res.json()) async def disable_alert_rules( self, @@ -1597,12 +1603,13 @@ async def disable_alert_rules( region: Optional[ScwRegion] = None, project_id: Optional[str] = None, rule_ids: Optional[List[str]] = None, - ) -> None: + ) -> DisableAlertRulesResponse: """ Disable preconfigured alert rules. Disable alert rules from the list of available preconfigured rules. :param region: Region to target. If none is passed will use default region from the config. :param project_id: :param rule_ids: + :return: :class:`DisableAlertRulesResponse ` Usage: :: @@ -1628,6 +1635,7 @@ async def disable_alert_rules( ) self._throw_on_error(res) + return unmarshal_DisableAlertRulesResponse(res.json()) async def trigger_test_alert( self, diff --git a/scaleway-async/scaleway_async/cockpit/v1/marshalling.py b/scaleway-async/scaleway_async/cockpit/v1/marshalling.py index 0f4e111f..5e5a39c5 100644 --- a/scaleway-async/scaleway_async/cockpit/v1/marshalling.py +++ b/scaleway-async/scaleway_async/cockpit/v1/marshalling.py @@ -19,6 +19,8 @@ Plan, Token, AlertManager, + DisableAlertRulesResponse, + EnableAlertRulesResponse, GetConfigResponseRetention, GetConfigResponse, Grafana, @@ -339,6 +341,36 @@ def unmarshal_AlertManager(data: Any) -> AlertManager: return AlertManager(**args) +def unmarshal_DisableAlertRulesResponse(data: Any) -> DisableAlertRulesResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'DisableAlertRulesResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("disabled_rule_ids", None) + if field is not None: + args["disabled_rule_ids"] = field + + return DisableAlertRulesResponse(**args) + + +def unmarshal_EnableAlertRulesResponse(data: Any) -> EnableAlertRulesResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'EnableAlertRulesResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("enabled_rule_ids", None) + if field is not None: + args["enabled_rule_ids"] = field + + return EnableAlertRulesResponse(**args) + + def unmarshal_GetConfigResponseRetention(data: Any) -> GetConfigResponseRetention: if not isinstance(data, dict): raise TypeError( diff --git a/scaleway-async/scaleway_async/cockpit/v1/types.py b/scaleway-async/scaleway_async/cockpit/v1/types.py index ce0efd82..f09edbba 100644 --- a/scaleway-async/scaleway_async/cockpit/v1/types.py +++ b/scaleway-async/scaleway_async/cockpit/v1/types.py @@ -523,6 +523,16 @@ class AlertManager: """ +@dataclass +class DisableAlertRulesResponse: + disabled_rule_ids: List[str] + + +@dataclass +class EnableAlertRulesResponse: + enabled_rule_ids: List[str] + + @dataclass class GetConfigResponse: """ diff --git a/scaleway/scaleway/cockpit/v1/__init__.py b/scaleway/scaleway/cockpit/v1/__init__.py index 6d028da8..44d90e37 100644 --- a/scaleway/scaleway/cockpit/v1/__init__.py +++ b/scaleway/scaleway/cockpit/v1/__init__.py @@ -23,6 +23,8 @@ from .types import Token from .types import Usage from .types import AlertManager +from .types import DisableAlertRulesResponse +from .types import EnableAlertRulesResponse from .types import GetConfigResponse from .types import GlobalApiCreateGrafanaUserRequest from .types import GlobalApiDeleteGrafanaUserRequest @@ -95,6 +97,8 @@ "Token", "Usage", "AlertManager", + "DisableAlertRulesResponse", + "EnableAlertRulesResponse", "GetConfigResponse", "GlobalApiCreateGrafanaUserRequest", "GlobalApiDeleteGrafanaUserRequest", diff --git a/scaleway/scaleway/cockpit/v1/api.py b/scaleway/scaleway/cockpit/v1/api.py index d77c642a..a1b9cbbf 100644 --- a/scaleway/scaleway/cockpit/v1/api.py +++ b/scaleway/scaleway/cockpit/v1/api.py @@ -26,6 +26,8 @@ ContactPoint, ContactPointEmail, DataSource, + DisableAlertRulesResponse, + EnableAlertRulesResponse, GetConfigResponse, GlobalApiCreateGrafanaUserRequest, GlobalApiResetGrafanaUserPasswordRequest, @@ -66,6 +68,8 @@ unmarshal_Plan, unmarshal_Token, unmarshal_AlertManager, + unmarshal_DisableAlertRulesResponse, + unmarshal_EnableAlertRulesResponse, unmarshal_GetConfigResponse, unmarshal_Grafana, unmarshal_ListAlertsResponse, @@ -1559,12 +1563,13 @@ def enable_alert_rules( region: Optional[ScwRegion] = None, project_id: Optional[str] = None, rule_ids: Optional[List[str]] = None, - ) -> None: + ) -> EnableAlertRulesResponse: """ Enable preconfigured alert rules. Enable alert rules from the list of available preconfigured rules. :param region: Region to target. If none is passed will use default region from the config. :param project_id: :param rule_ids: + :return: :class:`EnableAlertRulesResponse ` Usage: :: @@ -1590,6 +1595,7 @@ def enable_alert_rules( ) self._throw_on_error(res) + return unmarshal_EnableAlertRulesResponse(res.json()) def disable_alert_rules( self, @@ -1597,12 +1603,13 @@ def disable_alert_rules( region: Optional[ScwRegion] = None, project_id: Optional[str] = None, rule_ids: Optional[List[str]] = None, - ) -> None: + ) -> DisableAlertRulesResponse: """ Disable preconfigured alert rules. Disable alert rules from the list of available preconfigured rules. :param region: Region to target. If none is passed will use default region from the config. :param project_id: :param rule_ids: + :return: :class:`DisableAlertRulesResponse ` Usage: :: @@ -1628,6 +1635,7 @@ def disable_alert_rules( ) self._throw_on_error(res) + return unmarshal_DisableAlertRulesResponse(res.json()) def trigger_test_alert( self, diff --git a/scaleway/scaleway/cockpit/v1/marshalling.py b/scaleway/scaleway/cockpit/v1/marshalling.py index 0f4e111f..5e5a39c5 100644 --- a/scaleway/scaleway/cockpit/v1/marshalling.py +++ b/scaleway/scaleway/cockpit/v1/marshalling.py @@ -19,6 +19,8 @@ Plan, Token, AlertManager, + DisableAlertRulesResponse, + EnableAlertRulesResponse, GetConfigResponseRetention, GetConfigResponse, Grafana, @@ -339,6 +341,36 @@ def unmarshal_AlertManager(data: Any) -> AlertManager: return AlertManager(**args) +def unmarshal_DisableAlertRulesResponse(data: Any) -> DisableAlertRulesResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'DisableAlertRulesResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("disabled_rule_ids", None) + if field is not None: + args["disabled_rule_ids"] = field + + return DisableAlertRulesResponse(**args) + + +def unmarshal_EnableAlertRulesResponse(data: Any) -> EnableAlertRulesResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'EnableAlertRulesResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("enabled_rule_ids", None) + if field is not None: + args["enabled_rule_ids"] = field + + return EnableAlertRulesResponse(**args) + + def unmarshal_GetConfigResponseRetention(data: Any) -> GetConfigResponseRetention: if not isinstance(data, dict): raise TypeError( diff --git a/scaleway/scaleway/cockpit/v1/types.py b/scaleway/scaleway/cockpit/v1/types.py index ce0efd82..f09edbba 100644 --- a/scaleway/scaleway/cockpit/v1/types.py +++ b/scaleway/scaleway/cockpit/v1/types.py @@ -523,6 +523,16 @@ class AlertManager: """ +@dataclass +class DisableAlertRulesResponse: + disabled_rule_ids: List[str] + + +@dataclass +class EnableAlertRulesResponse: + enabled_rule_ids: List[str] + + @dataclass class GetConfigResponse: """