Skip to content

Commit f14cd5c

Browse files
committed
feat: disable snapshot plan
1 parent 1b4cea0 commit f14cd5c

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

hcloud/storage_boxes/client.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,3 +519,20 @@ def rollback_snapshot(
519519
json=data,
520520
)
521521
return BoundAction(self._parent.actions, response["action"])
522+
523+
def disable_snapshot_plan(
524+
self,
525+
storage_box: StorageBox | BoundStorageBox,
526+
) -> BoundAction:
527+
"""
528+
Disable the snapshot plan a Storage Box.
529+
530+
See https://docs.hetzner.cloud/reference/cloud#TODO
531+
532+
:param storage_box: Storage Box to update.
533+
"""
534+
response = self._client.request(
535+
method="POST",
536+
url=f"{self._base_url}/{storage_box.id}/actions/disable_snapshot_plan",
537+
)
538+
return BoundAction(self._parent.actions, response["action"])

tests/unit/storage_boxes/test_client.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,3 +419,22 @@ def test_rollback_snapshot(
419419
)
420420

421421
assert_bound_action1(action, resource_client._parent.actions)
422+
423+
def test_disable_snapshot_plan(
424+
self,
425+
request_mock: mock.MagicMock,
426+
resource_client: StorageBoxesClient,
427+
action_response,
428+
):
429+
request_mock.return_value = action_response
430+
431+
action = resource_client.disable_snapshot_plan(
432+
StorageBox(id=42),
433+
)
434+
435+
request_mock.assert_called_with(
436+
method="POST",
437+
url="/storage_boxes/42/actions/disable_snapshot_plan",
438+
)
439+
440+
assert_bound_action1(action, resource_client._parent.actions)

0 commit comments

Comments
 (0)