Skip to content
Permalink
Browse files
Add broken implementation
  • Loading branch information
brogand93 committed Feb 28, 2014
1 parent 507f7c7 commit 4953565edcb5d260d5103154b0cd510e8a0559c7
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
@@ -25,6 +25,7 @@ def index():

def _get_action(action):
actions = {
'AttachVolume': volumes.attach_volume,
'AuthorizeSecurityGroupEgress':
security_groups.authenticate_security_group_egress,
'AuthorizeSecurityGroupIngress':
@@ -43,6 +44,7 @@ def _get_action(action):
'DescribeKeyPairs': keypairs.describe_keypairs,
'DescribeSecurityGroups': security_groups.describe_security_groups,
'DescribeVolumes': volumes.describe_volumes,
'DetachVolume': volumes.detach_volume,
'GetPasswordData': passwords.get_password_data,
'ImportKeyPair': keypairs.import_keypair,
'RegisterSecretKey': register_secret_key,
@@ -76,6 +76,79 @@ def _create_volume_response(response):
'response': response
}

@helpers.authentication_required
def attach_volume():
helpers.require_parameters(['VolumeId', 'InstanceId', 'Device'])
response = _attach_volume_request()
return _attach_volume_response(response)


def _attach_volume_request():
args = {}

volume_id = helpers.get('VolumeId')
instance_id = helpers.get('InstanceId')


args['id'] = volume_id
args['command'] = 'attachVolume'
args['virtualmachineid'] = instance_id

response = requester.make_request_async(args)

return response


def _attach_volume_response(response):
if 'errortext' in response:
helpers.error_to_aws(response, volume_error_to_aws)

response = response['volume']
return {
'template_name_or_list': 'volume_attachment.xml',
'response_type': 'AttachVolumeResponse',
'response': response
}


@helpers.authentication_required
def detach_volume():
helpers.require_parameters(['VolumeId'])
response = _detach_volume_request()
return _detach_volume_response(response)


def _detach_volume_request():
args = {}

volume_id = helpers.get('VolumeId')

if helpers.contains_parameter('InstanceId'):
print('hello world instance')
args['virtualmachineid'] = helpers.get('InstanceId')
if helpers.contains_parameter('Device'):
print('hello world device')
args['deviceid'] = helpers.get('Device')

args['id'] = volume_id
args['command'] = 'detachVolume'

response = requester.make_request_async(args)

return response


def _detach_volume_response(response):
if 'errortext' in response:
helpers.error_to_aws(response, volume_error_to_aws)

response = response['volume']
return {
'template_name_or_list': 'volume_attachment.xml',
'response_type': 'DetachVolumeResponse',
'response': response
}


@helpers.authentication_required
def delete_volume():
@@ -0,0 +1,11 @@
{% extends "response.xml" %}
{% block response_content %}
<volumeId>
{{ response.id }}
</volumeId>
<instanceId>
{{ response.virtualmachineid }}
</instanceId>
<status>{{ response.status }}</status>
<attachTime>{{ response.attached }}</attachTime>
{% endblock %}

0 comments on commit 4953565

Please sign in to comment.