Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions scaleway-async/scaleway_async/cockpit/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -95,6 +97,8 @@
"Token",
"Usage",
"AlertManager",
"DisableAlertRulesResponse",
"EnableAlertRulesResponse",
"GetConfigResponse",
"GlobalApiCreateGrafanaUserRequest",
"GlobalApiDeleteGrafanaUserRequest",
Expand Down
12 changes: 10 additions & 2 deletions scaleway-async/scaleway_async/cockpit/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
ContactPoint,
ContactPointEmail,
DataSource,
DisableAlertRulesResponse,
EnableAlertRulesResponse,
GetConfigResponse,
GlobalApiCreateGrafanaUserRequest,
GlobalApiResetGrafanaUserPasswordRequest,
Expand Down Expand Up @@ -66,6 +68,8 @@
unmarshal_Plan,
unmarshal_Token,
unmarshal_AlertManager,
unmarshal_DisableAlertRulesResponse,
unmarshal_EnableAlertRulesResponse,
unmarshal_GetConfigResponse,
unmarshal_Grafana,
unmarshal_ListAlertsResponse,
Expand Down Expand Up @@ -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 <EnableAlertRulesResponse>`

Usage:
::
Expand All @@ -1590,19 +1595,21 @@ async def enable_alert_rules(
)

self._throw_on_error(res)
return unmarshal_EnableAlertRulesResponse(res.json())

async def disable_alert_rules(
self,
*,
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 <DisableAlertRulesResponse>`

Usage:
::
Expand All @@ -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,
Expand Down
32 changes: 32 additions & 0 deletions scaleway-async/scaleway_async/cockpit/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
Plan,
Token,
AlertManager,
DisableAlertRulesResponse,
EnableAlertRulesResponse,
GetConfigResponseRetention,
GetConfigResponse,
Grafana,
Expand Down Expand Up @@ -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(
Expand Down
10 changes: 10 additions & 0 deletions scaleway-async/scaleway_async/cockpit/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down
4 changes: 4 additions & 0 deletions scaleway/scaleway/cockpit/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -95,6 +97,8 @@
"Token",
"Usage",
"AlertManager",
"DisableAlertRulesResponse",
"EnableAlertRulesResponse",
"GetConfigResponse",
"GlobalApiCreateGrafanaUserRequest",
"GlobalApiDeleteGrafanaUserRequest",
Expand Down
12 changes: 10 additions & 2 deletions scaleway/scaleway/cockpit/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
ContactPoint,
ContactPointEmail,
DataSource,
DisableAlertRulesResponse,
EnableAlertRulesResponse,
GetConfigResponse,
GlobalApiCreateGrafanaUserRequest,
GlobalApiResetGrafanaUserPasswordRequest,
Expand Down Expand Up @@ -66,6 +68,8 @@
unmarshal_Plan,
unmarshal_Token,
unmarshal_AlertManager,
unmarshal_DisableAlertRulesResponse,
unmarshal_EnableAlertRulesResponse,
unmarshal_GetConfigResponse,
unmarshal_Grafana,
unmarshal_ListAlertsResponse,
Expand Down Expand Up @@ -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 <EnableAlertRulesResponse>`
Usage:
::
Expand All @@ -1590,19 +1595,21 @@ def enable_alert_rules(
)

self._throw_on_error(res)
return unmarshal_EnableAlertRulesResponse(res.json())

def disable_alert_rules(
self,
*,
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 <DisableAlertRulesResponse>`
Usage:
::
Expand All @@ -1628,6 +1635,7 @@ def disable_alert_rules(
)

self._throw_on_error(res)
return unmarshal_DisableAlertRulesResponse(res.json())

def trigger_test_alert(
self,
Expand Down
32 changes: 32 additions & 0 deletions scaleway/scaleway/cockpit/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
Plan,
Token,
AlertManager,
DisableAlertRulesResponse,
EnableAlertRulesResponse,
GetConfigResponseRetention,
GetConfigResponse,
Grafana,
Expand Down Expand Up @@ -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(
Expand Down
10 changes: 10 additions & 0 deletions scaleway/scaleway/cockpit/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down