#NEWLINE# def destroy( name , call = None ) : #NEWLINE# #INDENT# ' Destroy a node. Will check termination protection and warn if enabled.\n\n    CLI Example:\n    .. code-block:: bash\n\n        salt-cloud --destroy mymachine\n    ' #NEWLINE# if ( call == 'function' ) : #NEWLINE# #INDENT# raise SaltCloudSystemExit ( 'The destroy action must be called with -d, --destroy, -a or --action.' ) #NEWLINE# #UNINDENT# salt . utils . cloud . fire_event ( 'event' , 'destroying instance' , 'salt/cloud/{0}/destroying' . format ( name ) , { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# #UNINDENT# } , transport = __opts__ [ 'transport' ] ) #NEWLINE# data = show_instance ( data , call = 'action' ) #NEWLINE# node = query ( method = 'servers' , server_id = data [ 'id' ] , command = 'action' , args = { #NEWLINE# #INDENT# 'action' : 'terminate' , #NEWLINE# #UNINDENT# } , http_method = 'post' ) #NEWLINE# salt . utils . cloud . fire_event ( 'event' , 'destroyed instance' , 'salt/cloud/{0}/destroyed' . format ( name ) , { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# #UNINDENT# } , transport = __opts__ [ 'transport' ] ) #NEWLINE# if ( __opts__ . get ( 'update_cachedir' , False ) is True ) : #NEWLINE# #INDENT# salt . utils . cloud . delete_minion_cachedir ( name , __active_provider_name__ . split ( ':' ) [ 0 ] , __opts__ ) #NEWLINE# #UNINDENT# return node