#NEWLINE# def upgrade( self , instance_id , cpus = None , memory = None , nic_speed = None , public = True ) : #NEWLINE# #INDENT# 'Upgrades a VS instance.\n\n        Example::\n\n           # Upgrade instance 12345 to 4 CPUs and 4 GB of memory\n           import SoftLayer\n           client = SoftLayer.create_client_from_env()\n           mgr = SoftLayer.VSManager(client)\n           mgr.upgrade(12345, cpus=4, memory=4)\n\n        :param int instance_id: Instance id of the VS to be upgraded\n        :param int cpus: The number of virtual CPUs to upgrade to\n                            of a VS instance.\n        :param bool public: CPU will be in Private/Public Node.\n        :param int memory: RAM of the VS to be upgraded to.\n        :param int nic_speed: The port speed to set\n\n        :returns: bool\n        ' #NEWLINE# package_items = self . _get_package_items ( ) #NEWLINE# prices = [ ] #NEWLINE# for ( option , value ) in { #NEWLINE# #INDENT# 'cpus' : cpus , #NEWLINE# 'memory' : memory , #NEWLINE# 'nic_speed' : nic_speed , #NEWLINE# #UNINDENT# } . items ( ) : #NEWLINE# #INDENT# if ( not value ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# price_id = self . _get_price_id_for_upgrade ( package_items , option , maintenance_window , public ) #NEWLINE# if ( not price_id ) : #NEWLINE# #INDENT# raise exceptions . SoftLayerError ( ( 'Unable to find %s option with value %s' % ( option , value ) ) ) #NEWLINE# #UNINDENT# prices . append ( { #NEWLINE# #INDENT# 'id' : price_id , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# maintenance_window = datetime . datetime . now ( utils . UTC ( ) ) #NEWLINE# order = { #NEWLINE# #INDENT# 'complexType' : 'SoftLayer_Container_Product_Order_Virtual_Guest_Upgrade' , #NEWLINE# 'prices' : prices , #NEWLINE# 'properties' : [ { #NEWLINE# #INDENT# 'name' : 'MAINTENANCE_WINDOW' , #NEWLINE# 'value' : maintenance_window . strftime ( '%Y-%m-%d %H:%M:%S%z' ) , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'virtualGuests' : [ { #NEWLINE# #INDENT# 'id' : int ( instance_id ) , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } #NEWLINE# if prices : #NEWLINE# #INDENT# self . client [ 'Product_Order' ] . placeOrder ( order ) #NEWLINE# return True #NEWLINE# #UNINDENT# return False