moto/scripts/template/lib/models.py.j2
kbalk 180a48751d
Minor updates to scaffold.py (#4213)
Co-authored-by: Karri Balk <kbalk@users.noreply.github.com>
2021-08-24 16:49:45 +01:00

34 lines
1.1 KiB
Django/Jinja

"""{{ service_class }}Backend class with methods for supported APIs."""
from boto3 import Session
from moto.core import BaseBackend, BaseModel
class {{ service_class }}Backend(BaseBackend):
"""Implementation of {{ service_class }} APIs."""
def __init__(self, region_name=None):
self.region_name = region_name
def reset(self):
"""Re-initialize all attributes for this instance."""
region_name = self.region_name
self.__dict__ = {}
self.__init__(region_name)
# add methods from here
{{ escaped_service }}_backends = {}
for available_region in Session().get_available_regions("{{ service }}"):
{{ escaped_service }}_backends[available_region] = {{ service_class }}Backend()
for available_region in Session().get_available_regions(
"{{ service }}", partition_name="aws-us-gov"
):
{{ escaped_service }}_backends[available_region] = {{ service_class }}Backend()
for available_region in Session().get_available_regions(
"{{ service }}", partition_name="aws-cn"
):
{{ escaped_service }}_backends[available_region] = {{ service_class }}Backend()