def _delete_network(authorization, projectid, network): args = {'command': 'listSecurityGroups'} network_response = controllers.get_item_with_name(authorization, network, args, 'securitygroup') if not network_response: return None securitygroup_id = network_response['id'] args = { 'id': securitygroup_id } return requester.make_request( 'deleteSecurityGroup', args, authorization.client_id, authorization.client_secret )
def deleteinstance(projectid, authorization, zone, instance): args = {'command': 'listVirtualMachines'} virtual_machine = controllers.get_item_with_name(authorization, instance, args, 'virtualmachine') virtual_machine_id = virtual_machine['id'] args = {'id': virtual_machine_id} deletion_result = requester.make_request('destroyVirtualMachine', args, authorization.client_id, authorization.client_secret) return helpers.create_response( operations.create_async_response( projectid=projectid, operationid=deletion_result['destroyvirtualmachineresponse'] ['jobid'], authorization=authorization))
def deleteinstance(projectid, authorization, zone, instance): args = {'command': 'listVirtualMachines'} virtual_machine = controllers.get_item_with_name(authorization, instance, args, 'virtualmachine') virtual_machine_id = virtual_machine['id'] args = {'id': virtual_machine_id} deletion_result = requester.make_request( 'destroyVirtualMachine', args, authorization.client_id, authorization.client_secret ) return helpers.create_response(operations.create_async_response( projectid=projectid, operationid=deletion_result['destroyvirtualmachineresponse']['jobid'], authorization=authorization ))
def get_zone_by_name(authorization, zone): args = {'command': 'listZones'} return controllers.get_item_with_name(authorization, zone, args, 'zone')
def get_network_by_name(authorization, network): args = {'command': 'listSecurityGroups'} return controllers.get_item_with_name(authorization, network, args, 'securitygroup')
def _get_account_by_name(authorization, projectid): args = {'command': 'listAccounts'} return controllers.get_item_with_name(authorization, projectid, args, 'account')
def get_machinetype_by_name(authorization, machinetype): args = {'command': 'listServiceOfferings'} return controllers.get_item_with_name(authorization, machinetype, args, 'serviceoffering')
def get_template_by_name(authorization, image): args = {'templatefilter': 'executable', 'command': 'listTemplates'} return controllers.get_item_with_name(authorization, image, args, 'template')