def _delete_volume_request(): args = {'id': helpers.get('VolumeId'), 'command': 'deleteVolume'} response = requester.make_request(args) response = response['deletevolumeresponse'] return response
def _delete_volume_request(): args = {"id": helpers.get("VolumeId"), "command": "deleteVolume"} response = requester.make_request(args) response = response["deletevolumeresponse"] return response
def _get_password_data_request(): args = {'command': 'getVMPassword', 'id': helpers.get('InstanceId')} response = requester.make_request(args) response = response['getvmpasswordresponse'] return response
def _create_keypair_request(): args = {'command': 'createSSHKeyPair', 'name': helpers.get('KeyName')} response = requester.make_request(args) response = response['createsshkeypairresponse'] return response
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
def describe_tags(): """ Describe all tags. @return: Response. """ args = {'command': 'listTags'} response = requester.make_request(args) return _describe_tags_response(response)
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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