moto/scripts/template/lib/models.py.j2
2019-12-26 17:12:22 +01:00

26 lines
958 B
Django/Jinja

from __future__ import unicode_literals
from boto3 import Session
from moto.core import BaseBackend, BaseModel
class {{ service_class }}Backend(BaseBackend):
def __init__(self, region_name=None):
super({{ service_class }}Backend, self).__init__()
self.region_name = region_name
def reset(self):
region_name = self.region_name
self.__dict__ = {}
self.__init__(region_name)
# add methods from here
{{ escaped_service }}_backends = {}
for region in Session().get_available_regions("{{ service }}"):
{{ escaped_service }}_backends[region] = {{ service_class }}Backend()
for region in Session().get_available_regions("{{ service }}", partition_name="aws-us-gov"):
{{ escaped_service }}_backends[region] = {{ service_class }}Backend()
for region in Session().get_available_regions("{{ service }}", partition_name="aws-cn"):
{{ escaped_service }}_backends[region] = {{ service_class }}Backend()