22from hcloud .core .client import ClientEntityBase , BoundModelBase
33
44from hcloud .actions .client import BoundAction
5+ from hcloud .core .domain import add_meta_to_result
56from hcloud .volumes .domain import Volume , CreateVolumeResponse
67from hcloud .locations .client import BoundLocation
78
@@ -15,6 +16,10 @@ def __init__(self, client, data, complete=True):
1516 data ['location' ] = BoundLocation (client ._client .locations , location )
1617 super (BoundVolume , self ).__init__ (client , data , complete )
1718
19+ def get_actions_list (self , sort = None , page = None , per_page = None ):
20+ # type: (Optional[List[str]], Optional[int], Optional[int]) -> PageResults[List[BoundAction, Meta]]
21+ return self ._client .get_actions_list (self , sort , page , per_page )
22+
1823 def get_actions (self , sort = None ):
1924 # type: (Optional[List[str]]) -> List[BoundAction]
2025 return self ._client .get_actions (self , sort )
@@ -112,14 +117,23 @@ def create(self,
112117 )
113118 return result
114119
115- def get_actions (self , volume , sort = None ):
116- # type: (Union[ Volume, BoundVolume], Optional[List[str]]) -> List[BoundAction]
120+ def get_actions_list (self , volume , sort = None , page = None , per_page = None ):
121+ # type: (Volume, Optional[List[str]], Optional[int], Optional[int] ) -> PageResults[ List[BoundAction], Meta ]
117122 params = {}
118-
119123 if sort is not None :
120- params .update ({"sort" : sort })
124+ params ["sort" ] = sort
125+ if page is not None :
126+ params ["page" ] = page
127+ if per_page is not None :
128+ params ["per_page" ] = per_page
129+
121130 response = self ._client .request (url = "/volumes/{volume_id}/actions" .format (volume_id = volume .id ), method = "GET" , params = params )
122- return [BoundAction (self ._client .actions , action_data ) for action_data in response ['actions' ]]
131+ actions = [BoundAction (self ._client .actions , action_data ) for action_data in response ['actions' ]]
132+ return add_meta_to_result (actions , response , 'actions' )
133+
134+ def get_actions (self , volume , sort = None ):
135+ # type: (Union[Volume, BoundVolume], Optional[List[str]]) -> List[BoundAction]
136+ return super (VolumesClient , self ).get_actions (volume , sort = sort )
123137
124138 def update (self , volume , name = None , labels = None ):
125139 # type:(Union[Volume, BoundVolume], Optional[str], Optional[Dict[str, str]]) -> BoundVolume
0 commit comments