moto/scripts/template/lib/models.py.j2

26 lines
958 B
Plaintext
Raw Normal View History

from __future__ import unicode_literals
2019-12-26 16:12:22 +00:00
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
2019-12-26 16:12:22 +00:00
{{ 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()