Decentralize cloudformation naming responsibilities (#3201)
* #3127 - Decentralize CF naming responsibilities * Decentralize CloudFormation naming responsibilities * Update URLs in cloudformation_resource_type functions * Fix flake8 errors * Black formatting * Add a bunch of imports to populate CloudFormationModel.__subclasses__ * Add noqa to s3 models import statement in cloudformation/parsing.py * Black formatting * Remove debugging print statement Co-authored-by: Bert Blommers <info@bertblommers.nl>
This commit is contained in:
parent
88a1134657
commit
9a9a1d8413
26 changed files with 717 additions and 208 deletions
|
|
@ -4,14 +4,14 @@ import json
|
|||
from boto3 import Session
|
||||
|
||||
from moto.core.exceptions import JsonRESTError
|
||||
from moto.core import BaseBackend, BaseModel
|
||||
from moto.core import BaseBackend, CloudFormationModel
|
||||
from moto.sts.models import ACCOUNT_ID
|
||||
from moto.utilities.tagging_service import TaggingService
|
||||
|
||||
from uuid import uuid4
|
||||
|
||||
|
||||
class Rule(BaseModel):
|
||||
class Rule(CloudFormationModel):
|
||||
def _generate_arn(self, name):
|
||||
return "arn:aws:events:{region_name}:111111111111:rule/{name}".format(
|
||||
region_name=self.region_name, name=name
|
||||
|
|
@ -73,6 +73,15 @@ class Rule(BaseModel):
|
|||
|
||||
raise UnformattedGetAttTemplateException()
|
||||
|
||||
@staticmethod
|
||||
def cloudformation_name_type():
|
||||
return "Name"
|
||||
|
||||
@staticmethod
|
||||
def cloudformation_type():
|
||||
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html
|
||||
return "AWS::Events::Rule"
|
||||
|
||||
@classmethod
|
||||
def create_from_cloudformation_json(
|
||||
cls, resource_name, cloudformation_json, region_name
|
||||
|
|
@ -101,7 +110,7 @@ class Rule(BaseModel):
|
|||
event_backend.delete_rule(name=event_name)
|
||||
|
||||
|
||||
class EventBus(BaseModel):
|
||||
class EventBus(CloudFormationModel):
|
||||
def __init__(self, region_name, name):
|
||||
self.region = region_name
|
||||
self.name = name
|
||||
|
|
@ -152,6 +161,15 @@ class EventBus(BaseModel):
|
|||
|
||||
raise UnformattedGetAttTemplateException()
|
||||
|
||||
@staticmethod
|
||||
def cloudformation_name_type():
|
||||
return "Name"
|
||||
|
||||
@staticmethod
|
||||
def cloudformation_type():
|
||||
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbus.html
|
||||
return "AWS::Events::EventBus"
|
||||
|
||||
@classmethod
|
||||
def create_from_cloudformation_json(
|
||||
cls, resource_name, cloudformation_json, region_name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue