File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -435,11 +435,38 @@ def change_type(
435435 :param storage_box: Storage Box to update.
436436 :param storage_box_type: Type of Storage Box to change to.
437437 """
438- data : dict [str , Any ] = {"storage_box_type" : storage_box_type .id_or_name }
438+ data : dict [str , Any ] = {
439+ "storage_box_type" : storage_box_type .id_or_name ,
440+ }
439441
440442 response = self ._client .request (
441443 method = "POST" ,
442444 url = f"{ self ._base_url } /{ storage_box .id } /actions/change_type" ,
443445 json = data ,
444446 )
445447 return BoundAction (self ._parent .actions , response ["action" ])
448+
449+ def reset_password (
450+ self ,
451+ storage_box : StorageBox | BoundStorageBox ,
452+ * ,
453+ password : str ,
454+ ) -> BoundAction :
455+ """
456+ Reset the password of a Storage Box.
457+
458+ See https://docs.hetzner.cloud/reference/cloud#TODO
459+
460+ :param storage_box: Storage Box to update.
461+ :param password: Password for the Storage Box.
462+ """
463+ data : dict [str , Any ] = {
464+ "password" : password ,
465+ }
466+
467+ response = self ._client .request (
468+ method = "POST" ,
469+ url = f"{ self ._base_url } /{ storage_box .id } /actions/reset_password" ,
470+ json = data ,
471+ )
472+ return BoundAction (self ._parent .actions , response ["action" ])
Original file line number Diff line number Diff line change @@ -348,3 +348,24 @@ def test_change_type(
348348 )
349349
350350 assert_bound_action1 (action , resource_client ._parent .actions )
351+
352+ def test_reset_password (
353+ self ,
354+ request_mock : mock .MagicMock ,
355+ resource_client : StorageBoxesClient ,
356+ action_response ,
357+ ):
358+ request_mock .return_value = action_response
359+
360+ action = resource_client .reset_password (
361+ StorageBox (id = 42 ),
362+ password = "password" ,
363+ )
364+
365+ request_mock .assert_called_with (
366+ method = "POST" ,
367+ url = "/storage_boxes/42/actions/reset_password" ,
368+ json = {"password" : "password" },
369+ )
370+
371+ assert_bound_action1 (action , resource_client ._parent .actions )
You can’t perform that action at this time.
0 commit comments