From 6222f335f3b1eb5f013bb29096cdb1fe44157c07 Mon Sep 17 00:00:00 2001 From: Hugo Lopes Tavares Date: Tue, 1 Mar 2016 13:57:41 -0500 Subject: [PATCH] Refactor NatGateways methods to use _get_param() --- moto/ec2/responses/nat_gateways.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/moto/ec2/responses/nat_gateways.py b/moto/ec2/responses/nat_gateways.py index e960b990c..98d383d47 100644 --- a/moto/ec2/responses/nat_gateways.py +++ b/moto/ec2/responses/nat_gateways.py @@ -6,14 +6,14 @@ from moto.ec2.utils import filters_from_querystring class NatGateways(BaseResponse): def create_nat_gateway(self): - subnet_id = self.querystring.get('SubnetId')[0] - allocation_id = self.querystring.get('AllocationId')[0] + subnet_id = self._get_param('SubnetId') + allocation_id = self._get_param('AllocationId') nat_gateway = self.ec2_backend.create_nat_gateway(subnet_id=subnet_id, allocation_id=allocation_id) template = self.response_template(CREATE_NAT_GATEWAY) return template.render(nat_gateway=nat_gateway) def delete_nat_gateway(self): - nat_gateway_id = self.querystring.get('NatGatewayId')[0] + nat_gateway_id = self._get_param('NatGatewayId') nat_gateway = self.ec2_backend.delete_nat_gateway(nat_gateway_id) template = self.response_template(DELETE_NAT_GATEWAY_RESPONSE) return template.render(nat_gateway=nat_gateway)