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:
Adam Richie-Halford 2020-08-01 07:23:36 -07:00 committed by GitHub
commit 9a9a1d8413
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 717 additions and 208 deletions

View file

@ -12,7 +12,7 @@ from hashlib import md5
from boto3 import Session
from moto.compat import OrderedDict
from moto.core import BaseBackend, BaseModel
from moto.core import BaseBackend, BaseModel, CloudFormationModel
from moto.core.utils import unix_time
from moto.core import ACCOUNT_ID
from .exceptions import (
@ -129,7 +129,7 @@ class Shard(BaseModel):
}
class Stream(BaseModel):
class Stream(CloudFormationModel):
def __init__(self, stream_name, shard_count, region):
self.stream_name = stream_name
self.shard_count = shard_count
@ -216,6 +216,15 @@ class Stream(BaseModel):
}
}
@staticmethod
def cloudformation_name_type():
return "Name"
@staticmethod
def cloudformation_type():
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesis-stream.html
return "AWS::Kinesis::Stream"
@classmethod
def create_from_cloudformation_json(
cls, resource_name, cloudformation_json, region_name