55from ..actions import ActionsPageResult , BoundAction , ResourceActionsClient
66from ..core import BoundModelBase , Meta , ResourceClientBase
77from ..locations import BoundLocation , Location
8+ from ..ssh_keys import BoundSSHKey , SSHKey
89from ..storage_box_types import BoundStorageBoxType , StorageBoxType
910from .domain import (
1011 CreateStorageBoxResponse ,
@@ -72,9 +73,9 @@ def get_actions_list(
7273 per_page : int | None = None ,
7374 ) -> ActionsPageResult :
7475 """
75- Returns all Actions for the Storage Box for a specific page.
76+ Returns a paginated list of Actions for a Storage Box for a specific page.
7677
77- See https://docs.hetzner.cloud/reference/hetzner#storage-box-actions-list-actions
78+ See https://docs.hetzner.cloud/reference/hetzner#storage-box-actions-list-actions-for-a-storage-box
7879
7980 :param status: Filter the actions by status. The response will only contain actions matching the specified statuses.
8081 :param sort: Sort resources by field and direction.
@@ -96,9 +97,9 @@ def get_actions(
9697 sort : list [str ] | None = None ,
9798 ) -> list [BoundAction ]:
9899 """
99- Returns all Actions for the Storage Box.
100+ Returns all Actions for a Storage Box.
100101
101- See https://docs.hetzner.cloud/reference/hetzner#storage-box-actions-list-actions
102+ See https://docs.hetzner.cloud/reference/hetzner#storage-box-actions-list-actions-for-a-storage-box
102103
103104 :param status: Filter the actions by status. The response will only contain actions matching the specified statuses.
104105 :param sort: Sort resources by field and direction.
@@ -243,7 +244,7 @@ def get_list(
243244 per_page : int | None = None ,
244245 ) -> StorageBoxesPageResult :
245246 """
246- Returns a list of Storage Boxes for a specific page.
247+ Returns a paginated list of Storage Boxes for a specific page.
247248
248249 See https://docs.hetzner.cloud/reference/hetzner#storage-boxes-list-storage-boxes
249250
@@ -298,7 +299,7 @@ def create(
298299 password : str ,
299300 location : BoundLocation | Location ,
300301 storage_box_type : BoundStorageBoxType | StorageBoxType ,
301- ssh_keys : list [str ] | None = None ,
302+ ssh_keys : list [str | SSHKey | BoundSSHKey ] | None = None ,
302303 access_settings : StorageBoxAccessSettings | None = None ,
303304 labels : dict [str , str ] | None = None ,
304305 ) -> CreateStorageBoxResponse :
@@ -322,15 +323,18 @@ def create(
322323 "storage_box_type" : storage_box_type .id_or_name ,
323324 }
324325 if ssh_keys is not None :
325- data ["ssh_keys" ] = ssh_keys
326+ data ["ssh_keys" ] = [
327+ o .public_key if isinstance (o , (SSHKey , BoundSSHKey )) else o
328+ for o in ssh_keys
329+ ]
326330 if access_settings is not None :
327331 data ["access_settings" ] = access_settings .to_payload ()
328332 if labels is not None :
329333 data ["labels" ] = labels
330334
331335 response = self ._client .request (
332336 method = "POST" ,
333- url = "/storage_boxes " ,
337+ url = f" { self . _base_url } " ,
334338 json = data ,
335339 )
336340
@@ -426,7 +430,7 @@ def get_actions_list(
426430 per_page : int | None = None ,
427431 ) -> ActionsPageResult :
428432 """
429- Returns all Actions for a Storage Box for a specific page.
433+ Returns a paginated list of Actions for a Storage Box for a specific page.
430434
431435 See https://docs.hetzner.cloud/reference/hetzner#storage-box-actions-list-actions-for-a-storage-box
432436
@@ -578,7 +582,7 @@ def update_access_settings(
578582 def rollback_snapshot (
579583 self ,
580584 storage_box : StorageBox | BoundStorageBox ,
581- snapshot : StorageBoxSnapshot , # TODO: Add BoundStorageBoxSnapshot
585+ snapshot : StorageBoxSnapshot | BoundStorageBoxSnapshot ,
582586 ) -> BoundAction :
583587 """
584588 Rollback the Storage Box to the given snapshot.
@@ -733,7 +737,7 @@ def get_snapshot_all(
733737
734738 :param storage_box: Storage Box to get the Snapshots from.
735739 :param name: Filter resources by their name. The response will only contain the resources matching exactly the specified name.
736- :param is_automatic: Filter wether the snapshot was made by a Snapshot Plan.
740+ :param is_automatic: Filter whether the snapshot was made by a Snapshot Plan.
737741 :param label_selector: Filter resources by labels. The response will only contain resources matching the label selector.
738742 :param sort: Sort resources by field and direction.
739743 """
@@ -761,7 +765,7 @@ def create_snapshot(
761765
762766 :param storage_box: Storage Box to create a Snapshot from.
763767 :param description: Description of the Snapshot.
764- :param labels: User-defined labels (key/value pairs) for the Resource .
768+ :param labels: User-defined labels (key/value pairs) for the Snapshot .
765769 """
766770 data : dict [str , Any ] = {}
767771 if description is not None :
@@ -798,7 +802,7 @@ def update_snapshot(
798802
799803 :param snapshot: Storage Box Snapshot to update.
800804 :param description: Description of the Snapshot.
801- :param labels: User-defined labels (key/value pairs) for the Resource .
805+ :param labels: User-defined labels (key/value pairs) for the Snapshot .
802806 """
803807 if snapshot .storage_box is None :
804808 raise ValueError ("snapshot storage_box property is none" )
@@ -963,9 +967,9 @@ def create_subaccount(
963967 :param storage_box: Storage Box to create a Subaccount for.
964968 :param home_directory: Home directory of the Subaccount.
965969 :param password: Password of the Subaccount.
966- :param access_settings: Access Settings of the Subaccount.
970+ :param access_settings: Access settings of the Subaccount.
967971 :param description: Description of the Subaccount.
968- :param labels: User-defined labels (key/value pairs) for the Resource .
972+ :param labels: User-defined labels (key/value pairs) for the Subaccount .
969973 """
970974 data : dict [str , Any ] = {
971975 "home_directory" : home_directory ,
@@ -1007,7 +1011,7 @@ def update_subaccount(
10071011
10081012 :param subaccount: Storage Box Subaccount to update.
10091013 :param description: Description of the Subaccount.
1010- :param labels: User-defined labels (key/value pairs) for the Resource .
1014+ :param labels: User-defined labels (key/value pairs) for the Subaccount .
10111015 """
10121016 if subaccount .storage_box is None :
10131017 raise ValueError ("subaccount storage_box property is none" )
0 commit comments