@@ -256,9 +256,10 @@ def _populate(self, json):
256256 """
257257 Allows changing the name "class" in JSON to "type_class" in python
258258 """
259+
259260 super ()._populate (json )
260261
261- if "class" in json :
262+ if json is not None and "class" in json :
262263 setattr (self , "type_class" , json ["class" ])
263264 else :
264265 setattr (self , "type_class" , None )
@@ -612,6 +613,11 @@ def _interface_create(self, body: Dict[str, Any]) -> NetworkInterface:
612613 return i
613614
614615
616+ class MigrationType :
617+ COLD = "cold"
618+ WARM = "warm"
619+
620+
615621class Instance (Base ):
616622 """
617623 A Linode Instance.
@@ -948,7 +954,13 @@ def reboot(self):
948954 return False
949955 return True
950956
951- def resize (self , new_type , allow_auto_disk_resize = True , ** kwargs ):
957+ def resize (
958+ self ,
959+ new_type ,
960+ allow_auto_disk_resize = True ,
961+ migration_type : MigrationType = MigrationType .COLD ,
962+ ** kwargs ,
963+ ):
952964 """
953965 Resizes a Linode you have the read_write permission to a different Type. If any
954966 actions are currently running or queued, those actions must be completed first
@@ -970,6 +982,10 @@ def resize(self, new_type, allow_auto_disk_resize=True, **kwargs):
970982 data must fit within the smaller disk size. Defaults to true.
971983 :type: allow_auto_disk_resize: bool
972984
985+ :param migration_type: Type of migration to be used when resizing a Linode.
986+ Customers can choose between warm and cold, the default type is cold.
987+ :type: migration_type: str
988+
973989 :returns: True if the operation was successful.
974990 :rtype: bool
975991 """
@@ -979,6 +995,7 @@ def resize(self, new_type, allow_auto_disk_resize=True, **kwargs):
979995 params = {
980996 "type" : new_type ,
981997 "allow_auto_disk_resize" : allow_auto_disk_resize ,
998+ "migration_type" : migration_type ,
982999 }
9831000 params .update (kwargs )
9841001
@@ -1438,7 +1455,12 @@ def mutate(self, allow_auto_disk_resize=True):
14381455
14391456 return True
14401457
1441- def initiate_migration (self , region = None , upgrade = None ):
1458+ def initiate_migration (
1459+ self ,
1460+ region = None ,
1461+ upgrade = None ,
1462+ migration_type : MigrationType = MigrationType .COLD ,
1463+ ):
14421464 """
14431465 Initiates a pending migration that is already scheduled for this Linode
14441466 Instance
@@ -1459,10 +1481,16 @@ def initiate_migration(self, region=None, upgrade=None):
14591481 region field does not allow upgrades, then the endpoint will return a 400 error
14601482 code and the migration will not be performed.
14611483 :type: upgrade: bool
1484+
1485+ :param migration_type: The type of migration that will be used for this Linode migration.
1486+ Customers can only use this param when activating a support-created migration.
1487+ Customers can choose between a cold and warm migration, cold is the default type.
1488+ :type: mirgation_type: str
14621489 """
14631490 params = {
14641491 "region" : region .id if issubclass (type (region ), Base ) else region ,
14651492 "upgrade" : upgrade ,
1493+ "type" : migration_type ,
14661494 }
14671495
14681496 util .drop_null_keys (params )
0 commit comments