Example #1
0
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
    )
Example #2
0
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))
Example #3
0
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
    ))
Example #4
0
def get_zone_by_name(authorization, zone):
    args = {'command': 'listZones'}
    return controllers.get_item_with_name(authorization, zone, args, 'zone')
Example #5
0
def get_network_by_name(authorization, network):
    args = {'command': 'listSecurityGroups'}
    return controllers.get_item_with_name(authorization, network, args, 'securitygroup')
Example #6
0
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')
Example #8
0
def get_template_by_name(authorization, image):
    args = {'templatefilter': 'executable', 'command': 'listTemplates'}
    return controllers.get_item_with_name(authorization, image, args, 'template')
Example #9
0
def get_zone_by_name(authorization, zone):
    args = {'command': 'listZones'}
    return controllers.get_item_with_name(authorization, zone, args, 'zone')
Example #10
0
def get_template_by_name(authorization, image):
    args = {'templatefilter': 'executable', 'command': 'listTemplates'}
    return controllers.get_item_with_name(authorization, image, args,
                                          'template')
Example #11
0
def get_machinetype_by_name(authorization, machinetype):
    args = {'command': 'listServiceOfferings'}
    return controllers.get_item_with_name(authorization, machinetype, args,
                                          'serviceoffering')
Example #12
0
def _get_account_by_name(authorization, projectid):
    args = {'command': 'listAccounts'}
    return controllers.get_item_with_name(authorization, projectid, args, 'account')