from __future__ import unicode_literals
from jinja2 import Template
from moto.core.responses import BaseResponse
class AvailabilityZonesAndRegions(BaseResponse):
def describe_availability_zones(self):
zones = self.ec2_backend.describe_availability_zones()
template = Template(DESCRIBE_ZONES_RESPONSE)
return template.render(zones=zones)
def describe_regions(self):
regions = self.ec2_backend.describe_regions()
template = Template(DESCRIBE_REGIONS_RESPONSE)
return template.render(regions=regions)
DESCRIBE_REGIONS_RESPONSE = """
59dbff89-35bd-4eac-99ed-be587EXAMPLE
{% for region in regions %}
-
{{ region.name }}
{{ region.endpoint }}
{% endfor %}
"""
DESCRIBE_ZONES_RESPONSE = """
59dbff89-35bd-4eac-99ed-be587EXAMPLE
{% for zone in zones %}
-
{{ zone.name }}
available
{{ zone.region_name }}
{% endfor %}
"""