def create_security_group(self): name = self.querystring.get('GroupName')[0] description = self.querystring.get('GroupDescription', [None])[0] vpc_id = self.querystring.get("VpcId", [None])[0] group = ec2_backend.create_security_group(name, description, vpc_id=vpc_id) template = Template(CREATE_SECURITY_GROUP_RESPONSE) return template.render(group=group)
def create_security_group(self): name = self.querystring.get('GroupName')[0] description = self.querystring.get('GroupDescription')[0] group = ec2_backend.create_security_group(name, description) if not group: # There was an exisitng group return "There was an existing security group with name {}".format(name), dict(status=409) template = Template(CREATE_SECURITY_GROUP_RESPONSE) return template.render(group=group)
def create_security_group(self): name = self.querystring.get('GroupName')[0] description = self.querystring.get('GroupDescription')[0] group = ec2_backend.create_security_group(name, description) if not group: # There was an exisitng group return "There was an existing security group with name {}".format( name), dict(status=409) template = Template(CREATE_SECURITY_GROUP_RESPONSE) return template.render(group=group)
def create_security_group(self): name = self.querystring.get('GroupName')[0] try: description = self.querystring.get('GroupDescription')[0] except TypeError: # No description found, return error return "The request must contain the parameter GroupDescription", dict(status=400) vpc_id = self.querystring.get("VpcId", [None])[0] group = ec2_backend.create_security_group(name, description, vpc_id=vpc_id) if not group: # There was an exisitng group return "There was an existing security group with name {0}".format(name), dict(status=409) template = Template(CREATE_SECURITY_GROUP_RESPONSE) return template.render(group=group)
def create_security_group(self): name = self.querystring.get('GroupName')[0] try: description = self.querystring.get('GroupDescription')[0] except TypeError: # No description found, return error return "The request must contain the parameter GroupDescription", dict( status=400) vpc_id = self.querystring.get("VpcId", [None])[0] group = ec2_backend.create_security_group(name, description, vpc_id=vpc_id) if not group: # There was an exisitng group return "There was an existing security group with name {0}".format( name), dict(status=409) template = Template(CREATE_SECURITY_GROUP_RESPONSE) return template.render(group=group)