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

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

    return response
示例#2
0
文件: volumes.py 项目: vogxn/ec2stack
def _delete_volume_request():
    args = {"id": helpers.get("VolumeId"), "command": "deleteVolume"}

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

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

    response = requester.make_request(args)

    response = response['getvmpasswordresponse']

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

    response = requester.make_request(args)

    response = response['createsshkeypairresponse']

    return response
示例#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
示例#6
0
def _create_keypair_request():
    args = {'command': 'createSSHKeyPair', 'name': helpers.get('KeyName')}

    response = requester.make_request(args)

    response = response['createsshkeypairresponse']

    return response
示例#7
0
def describe_tags():
    """
    Describe all tags.

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

    return _describe_tags_response(response)
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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