Refactor NatGateways methods to use _get_param()
This commit is contained in:
parent
c689816337
commit
6222f335f3
@ -6,14 +6,14 @@ from moto.ec2.utils import filters_from_querystring
|
|||||||
class NatGateways(BaseResponse):
|
class NatGateways(BaseResponse):
|
||||||
|
|
||||||
def create_nat_gateway(self):
|
def create_nat_gateway(self):
|
||||||
subnet_id = self.querystring.get('SubnetId')[0]
|
subnet_id = self._get_param('SubnetId')
|
||||||
allocation_id = self.querystring.get('AllocationId')[0]
|
allocation_id = self._get_param('AllocationId')
|
||||||
nat_gateway = self.ec2_backend.create_nat_gateway(subnet_id=subnet_id, allocation_id=allocation_id)
|
nat_gateway = self.ec2_backend.create_nat_gateway(subnet_id=subnet_id, allocation_id=allocation_id)
|
||||||
template = self.response_template(CREATE_NAT_GATEWAY)
|
template = self.response_template(CREATE_NAT_GATEWAY)
|
||||||
return template.render(nat_gateway=nat_gateway)
|
return template.render(nat_gateway=nat_gateway)
|
||||||
|
|
||||||
def delete_nat_gateway(self):
|
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)
|
nat_gateway = self.ec2_backend.delete_nat_gateway(nat_gateway_id)
|
||||||
template = self.response_template(DELETE_NAT_GATEWAY_RESPONSE)
|
template = self.response_template(DELETE_NAT_GATEWAY_RESPONSE)
|
||||||
return template.render(nat_gateway=nat_gateway)
|
return template.render(nat_gateway=nat_gateway)
|
||||||
|
Loading…
Reference in New Issue
Block a user