예제 #1
0
    def get_or_delete_hostzone_response(self, request, full_url, headers):
        self.setup_class(request, full_url, headers)
        parsed_url = urlparse(full_url)
        zoneid = parsed_url.path.rstrip("/").rsplit("/", 1)[1]

        if request.method == "GET":
            the_zone = route53_backend.get_hosted_zone(zoneid)
            template = Template(GET_HOSTED_ZONE_RESPONSE)
            return 200, headers, template.render(zone=the_zone)
        elif request.method == "DELETE":
            route53_backend.delete_hosted_zone(zoneid)
            return 200, headers, DELETE_HOSTED_ZONE_RESPONSE
예제 #2
0
    def get_or_delete_hostzone_response(self, request, full_url, headers):
        self.setup_class(request, full_url, headers)
        parsed_url = urlparse(full_url)
        zoneid = parsed_url.path.rstrip("/").rsplit("/", 1)[1]

        if request.method == "GET":
            the_zone = route53_backend.get_hosted_zone(zoneid)
            template = Template(GET_HOSTED_ZONE_RESPONSE)
            return 200, headers, template.render(zone=the_zone)
        elif request.method == "DELETE":
            route53_backend.delete_hosted_zone(zoneid)
            return 200, headers, DELETE_HOSTED_ZONE_RESPONSE
        elif request.method == "POST":
            elements = xmltodict.parse(self.body)
            comment = elements.get("UpdateHostedZoneCommentRequest",
                                   {}).get("Comment", None)
            zone = route53_backend.update_hosted_zone_comment(zoneid, comment)
            template = Template(UPDATE_HOSTED_ZONE_COMMENT_RESPONSE)
            return 200, headers, template.render(zone=zone)