-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathterminate_mixin.py
More file actions
33 lines (23 loc) · 1.03 KB
/
terminate_mixin.py
File metadata and controls
33 lines (23 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from mpt_api_client.models.model import ResourceData
class TerminateMixin[Model]:
"""Terminate resource mixin."""
def terminate(self, resource_id: str, resource_data: ResourceData | None = None) -> Model:
"""Terminate resource.
Args:
resource_id: Resource ID
resource_data: Resource data
Returns:
Terminated resource.
"""
return self._resource_action(resource_id, "POST", "terminate", json=resource_data) # type: ignore[attr-defined, no-any-return]
class AsyncTerminateMixin[Model]:
"""Asynchronous terminate resource mixin."""
async def terminate(self, resource_id: str, resource_data: ResourceData | None = None) -> Model:
"""Terminate resource.
Args:
resource_id: Resource ID
resource_data: Resource data
Returns:
Terminated resource.
"""
return await self._resource_action(resource_id, "POST", "terminate", json=resource_data) # type: ignore[attr-defined, no-any-return]