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

33 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()