11from os import PathLike
2- from typing import BinaryIO , Optional , Union
2+ from typing import BinaryIO
33
44from upcloud_api .api import API
55from upcloud_api .storage import BackupDeletionPolicy , Storage
@@ -47,7 +47,7 @@ def create_storage(
4747 title : str = 'Storage disk' ,
4848 encrypted : bool = False ,
4949 * ,
50- backup_rule : Optional [ dict ] = None ,
50+ backup_rule : dict | None = None ,
5151 ) -> Storage :
5252 """
5353 Create a Storage object. Returns an object based on the API's response.
@@ -70,7 +70,7 @@ def create_storage(
7070 res = self .api .post_request ('/storage' , body )
7171 return Storage (cloud_manager = self , ** res ['storage' ])
7272
73- def _modify_storage (self , storage , size , title , backup_rule : Optional [ dict ] = None ):
73+ def _modify_storage (self , storage , size , title , backup_rule : dict | None = None ):
7474 body = {'storage' : {}}
7575 if size :
7676 body ['storage' ]['size' ] = size
@@ -81,7 +81,7 @@ def _modify_storage(self, storage, size, title, backup_rule: Optional[dict] = No
8181 return self .api .put_request ('/storage/' + str (storage ), body )
8282
8383 def modify_storage (
84- self , storage : str , size : int , title : str , backup_rule : Optional [ dict ] = None
84+ self , storage : str , size : int , title : str , backup_rule : dict | None = None
8585 ) -> Storage :
8686 """
8787 Modify a Storage object. Returns an object based on the API's response.
@@ -95,9 +95,7 @@ def delete_storage(self, uuid: str, backups: BackupDeletionPolicy = BackupDeleti
9595 """
9696 return self .api .delete_request (f'/storage/{ uuid } ?backups={ backups .value } ' )
9797
98- def clone_storage (
99- self , storage : Union [Storage , str ], title : str , zone : str , tier = None
100- ) -> Storage :
98+ def clone_storage (self , storage : Storage | str , title : str , zone : str , tier = None ) -> Storage :
10199 """
102100 Clones a Storage object. Returns an object based on the API's response.
103101 """
@@ -203,7 +201,7 @@ def create_storage_import(
203201 def upload_file_for_storage_import (
204202 self ,
205203 storage_import : StorageImport ,
206- file : Union [ str , PathLike , BinaryIO ] ,
204+ file : str | PathLike | BinaryIO ,
207205 timeout : int = 30 ,
208206 content_type : str = 'application/octet-stream' ,
209207 ):
0 commit comments