Esempio n. 1
0
def _delete_volume_request():
    args = {'id': helpers.get('VolumeId'), 'command': 'deleteVolume'}

    response = requester.make_request(args)
    response = response['deletevolumeresponse']

    return response
Esempio n. 2
0
def _delete_volume_request():
    args = {"id": helpers.get("VolumeId"), "command": "deleteVolume"}

    response = requester.make_request(args)
    response = response["deletevolumeresponse"]

    return response
Esempio n. 3
0
def _get_password_data_request():
    args = {'command': 'getVMPassword', 'id': helpers.get('InstanceId')}

    response = requester.make_request(args)

    response = response['getvmpasswordresponse']

    return response
Esempio n. 4
0
def _create_keypair_request():
    args = {'command': 'createSSHKeyPair', 'name': helpers.get('KeyName')}

    response = requester.make_request(args)

    response = response['createsshkeypairresponse']

    return response
Esempio n. 5
0
def _import_keypair_request():
    args = {'command': 'registerSSHKeyPair', 'name': helpers.get('KeyName'),
            'publickey': b64decode(helpers.get('PublicKeyMaterial'))}

    response = requester.make_request(args)
    response = response['registersshkeypairresponse']

    return response
Esempio n. 6
0
def _create_keypair_request():
    args = {'command': 'createSSHKeyPair', 'name': helpers.get('KeyName')}

    response = requester.make_request(args)

    response = response['createsshkeypairresponse']

    return response
Esempio n. 7
0
def describe_tags():
    """
    Describe all tags.

    @return: Response.
    """
    args = {'command': 'listTags'}
    response = requester.make_request(args)

    return _describe_tags_response(response)
Esempio n. 8
0
def _delete_keypair_request():
    """
    Request to delete a keypair.

    @return: Response.
    """
    args = {"command": "deleteSSHKeyPair", "name": helpers.get("KeyName")}

    response = requester.make_request(args)

    return response
Esempio n. 9
0
def describe_items_request(args, not_found):
    args['listAll'] = 'true'
    response = requester.make_request(args)
    response = response[response.keys()[0]]

    if 'count' in response:
        return response
    elif callable(not_found):
        return not_found()
    else:
        return not_found
Esempio n. 10
0
def _delete_keypair_request():
    """
    Request to delete a keypair.

    @return: Response.
    """
    args = {'command': 'deleteSSHKeyPair', 'name': helpers.get('KeyName')}

    response = requester.make_request(args)

    return response
Esempio n. 11
0
def _import_keypair_request():
    args = {
        'command': 'registerSSHKeyPair',
        'name': helpers.get('KeyName'),
        'publickey': b64decode(helpers.get('PublicKeyMaterial'))
    }

    response = requester.make_request(args)
    response = response['registersshkeypairresponse']

    return response
Esempio n. 12
0
def _create_security_group_request():
    args = {
        "command": "createSecurityGroup",
        "name": helpers.get("GroupName"),
        "description": helpers.get("GroupDescription"),
    }

    response = requester.make_request(args)

    response = response["createsecuritygroupresponse"]

    return response
Esempio n. 13
0
def _delete_volume_request():
    """
    Request to delete a volume.

    @return: Response.
    """
    args = {'id': helpers.get('VolumeId'), 'command': 'deleteVolume'}

    response = requester.make_request(args)
    response = response['deletevolumeresponse']

    return response
Esempio n. 14
0
def _create_security_group_request():
    args = {
        'command': 'createSecurityGroup',
        'name': helpers.get('GroupName'),
        'description': helpers.get('GroupDescription')
    }

    response = requester.make_request(args)

    response = response['createsecuritygroupresponse']

    return response
Esempio n. 15
0
def describe_tags():
    """
    Describe all tags.

    @return: Response.
    """
    args = {'command': 'listTags'}
    response = requester.make_request(args)

    return _describe_tags_response(
        response
    )
def _get_password_data_request():
    """
    Request to get password.

    @return: Response.
    """
    args = {"command": "getVMPassword", "id": helpers.get("InstanceId")}

    response = requester.make_request(args)

    response = response["getvmpasswordresponse"]

    return response
Esempio n. 17
0
def _create_keypair_request():
    """
    Request to create a keypair.

    @return: Response.
    """
    args = {"command": "createSSHKeyPair", "name": helpers.get("KeyName")}

    response = requester.make_request(args)

    response = response["createsshkeypairresponse"]

    return response
Esempio n. 18
0
def _create_security_group_request():
    """
    Request to create a security group.

    @return: response.
    """
    args = {'command': 'createSecurityGroup', 'name': helpers.get('GroupName'),
            'description': helpers.get('GroupDescription')}

    response = requester.make_request(args)

    response = response['createsecuritygroupresponse']

    return response
Esempio n. 19
0
def _delete_security_group_request():
    args = {}

    helpers.require_atleast_one_parameter(['GroupName', 'GroupId'])

    if helpers.contains_parameter('GroupName'):
        args['name'] = helpers.get('GroupName')

    elif helpers.contains_parameter('GroupId'):
        args['id'] = helpers.get('GroupId')

    args['command'] = 'deleteSecurityGroup'

    response = requester.make_request(args)

    return response
Esempio n. 20
0
def _import_keypair_request():
    """
    Request to import a keypair.

    @return: Response.
    """
    args = {
        "command": "registerSSHKeyPair",
        "name": helpers.get("KeyName"),
        "publickey": b64decode(helpers.get("PublicKeyMaterial")),
    }

    response = requester.make_request(args)
    response = response["registersshkeypairresponse"]

    return response
Esempio n. 21
0
def _delete_security_group_request():
    args = {}

    helpers.require_atleast_one_parameter(["GroupName", "GroupId"])

    if helpers.contains_parameter("GroupName"):
        args["name"] = helpers.get("GroupName")

    elif helpers.contains_parameter("GroupId"):
        args["id"] = helpers.get("GroupId")

    args["command"] = "deleteSecurityGroup"

    response = requester.make_request(args)

    return response
Esempio n. 22
0
def describe_items_request(args, not_found):
    """
    Executes the request.

    @param args: Request payload.
    @param not_found: Function to call on empty response from Cloudstack.
    @return: Response.
    """
    args['listAll'] = 'true'
    response = requester.make_request(args)
    response = response[response.keys()[0]]

    if 'count' in response:
        return response
    elif callable(not_found):
        return not_found()
    else:
        return not_found
Esempio n. 23
0
def describe_items_request(args, not_found):
    """
    Executes the request.

    @param args: Request payload.
    @param not_found: Function to call on empty response from Cloudstack.
    @return: Response.
    """
    args['listAll'] = 'true'
    response = requester.make_request(args)
    response = response[response.keys()[0]]

    if 'count' in response:
        return response
    elif callable(not_found):
        return not_found()
    else:
        return not_found
Esempio n. 24
0
def _delete_security_group_request():
    """
    Request to delete a security group.

    @return: Response.
    """
    args = {}

    helpers.require_atleast_one_parameter(['GroupName', 'GroupId'])

    if helpers.contains_parameter('GroupName'):
        args['name'] = helpers.get('GroupName')

    elif helpers.contains_parameter('GroupId'):
        args['id'] = helpers.get('GroupId')

    args['command'] = 'deleteSecurityGroup'

    response = requester.make_request(args)

    return response