diff --git a/src/main/java/io/floci/aws/core/common/RequestShapeModel.java b/src/main/java/io/floci/aws/core/common/RequestShapeModel.java index c6db758766..23f65aeb42 100644 --- a/src/main/java/io/floci/aws/core/common/RequestShapeModel.java +++ b/src/main/java/io/floci/aws/core/common/RequestShapeModel.java @@ -23,9 +23,14 @@ public record RequestShapeModel(Map operations, Map members, String element, List required) { + public record Shape(String type, Map members, String element, List required, + Integer minLength, Integer maxLength, String pattern) { + + public Shape(String type, Map members, String element, List required) { + this(type, members, element, required, null, null, null); + } } /** The vendored resource {@code name}; {@code description} names it in a failure. */ @@ -45,7 +50,10 @@ public record RequestShapeModel(Map operations, Map required = new ArrayList<>(); node.path("required").forEach(name -> required.add(name.asText())); shapes.put(entry.getKey(), new Shape(node.path("type").asText(), Collections.unmodifiableMap(members), - element, List.copyOf(required))); + element, List.copyOf(required), + node.hasNonNull("minLength") ? node.get("minLength").asInt() : null, + node.hasNonNull("maxLength") ? node.get("maxLength").asInt() : null, + node.hasNonNull("pattern") ? node.get("pattern").asText() : null)); } return new RequestShapeModel(Map.copyOf(operations), Map.copyOf(shapes)); } diff --git a/src/main/java/io/floci/aws/services/cloudformation/provisioners/CfnPropertyTypes.java b/src/main/java/io/floci/aws/services/cloudformation/provisioners/CfnPropertyTypes.java index 3fc1a88316..273821d799 100644 --- a/src/main/java/io/floci/aws/services/cloudformation/provisioners/CfnPropertyTypes.java +++ b/src/main/java/io/floci/aws/services/cloudformation/provisioners/CfnPropertyTypes.java @@ -161,6 +161,9 @@ final class CfnPropertyTypes { abstract JsonNode readBoolean(String path, String property, JsonNode value); + void checkString(String path, Shape shape, String value) { + } + /** Checks the members {@code shape} requires of the object {@code value} at {@code path}; none by default. */ void checkRequired(String path, JsonNode value, Shape shape) { } @@ -191,7 +194,7 @@ final class CfnPropertyTypes { case "structure" -> readObject(path, property, value, shape); case "map" -> readMap(path, property, value, shape.element()); case "list" -> readList(path, property, value, shape.element()); - case "string" -> readString(path, property, value); + case "string" -> readString(path, property, value, shape); case "integer" -> readInteger(path, property, value); case "boolean" -> readBoolean(path, property, value); default -> value == raw ? engine.resolveNode(raw) : value; @@ -283,12 +286,14 @@ final class CfnPropertyTypes { return out; } - private JsonNode readString(String path, String property, JsonNode value) { + private JsonNode readString(String path, String property, JsonNode value, Shape shape) { if (value.isContainerNode()) { mismatch(path, property, "String", containerName(value)); return null; } - return value.isTextual() ? value : TextNode.valueOf(value.asText()); + JsonNode text = value.isTextual() ? value : TextNode.valueOf(value.asText()); + checkString(path, shape, text.textValue()); + return text; } static String child(String path, String name) { @@ -471,6 +476,24 @@ final class CfnPropertyTypes { return flag == null ? value : BooleanNode.valueOf(flag); } + @Override + void checkString(String path, Shape shape, String value) { + if (shape.minLength() == null && shape.maxLength() == null && shape.pattern() == null) { + return; + } + int length = value.codePointCount(0, value.length()); + if (shape.minLength() != null && length < shape.minLength()) { + record(new Violation(path, "expected minLength: " + shape.minLength() + ", actual: " + length, + false), false); + } else if (shape.maxLength() != null && length > shape.maxLength()) { + record(new Violation(path, "expected maxLength: " + shape.maxLength() + ", actual: " + length, + false), false); + } else if (shape.pattern() != null && !Pattern.compile(shape.pattern()).matcher(value).matches()) { + record(new Violation(path, "failed validation constraint for keyword [pattern]", false), + false); + } + } + @Override void checkRequired(String path, JsonNode value, Shape shape) { for (String member : shape.required()) { @@ -478,10 +501,14 @@ final class CfnPropertyTypes { boolean absent = raw == null; if (!absent && !preserveEcsHandlerSemantics) { absent = raw.isNull() || raw.isMissingNode(); - if (!absent && "string".equals(model.shapes().get(shape.members().get(member)).type())) { + Shape memberShape = model.shapes().get(shape.members().get(member)); + if (!absent && "string".equals(memberShape.type())) { JsonNode resolved = engine.resolveNode(raw); - absent = resolved == null || resolved.isNull() || resolved.isMissingNode() - || resolved.isTextual() && resolved.textValue().isBlank(); + absent = resolved == null || resolved.isNull() || resolved.isMissingNode(); + if (!absent && memberShape.minLength() == null && memberShape.maxLength() == null + && memberShape.pattern() == null) { + absent = resolved.isTextual() && resolved.textValue().isBlank(); + } } } if (absent) { diff --git a/src/main/resources/aws/cfn-property-types.json b/src/main/resources/aws/cfn-property-types.json index dd71bbb087..074e470f73 100644 --- a/src/main/resources/aws/cfn-property-types.json +++ b/src/main/resources/aws/cfn-property-types.json @@ -2,7 +2,7 @@ "_source": { "generator": "tools/aws/regen_cfn_property_types.py", "schemas": "https://schema.cloudformation.us-east-1.amazonaws.com/CloudformationSchema.zip", - "retrieved": "2026-11-17", + "retrieved": "2026-11-18", "note": "make cfn-property-types-verify checks the file against AWS." }, "operations": { @@ -23,10 +23,10 @@ "members": { "PlacementTenancy": "String", "SecurityGroups": "AWS::AutoScaling::LaunchConfiguration.SecurityGroups", - "LaunchConfigurationName": "String", + "LaunchConfigurationName": "AWS::AutoScaling::LaunchConfiguration.LaunchConfigurationName", "MetadataOptions": "AWS::AutoScaling::LaunchConfiguration/MetadataOptions", "InstanceId": "String", - "UserData": "String", + "UserData": "AWS::AutoScaling::LaunchConfiguration.UserData", "ClassicLinkVPCSecurityGroups": "AWS::AutoScaling::LaunchConfiguration.ClassicLinkVPCSecurityGroups", "BlockDeviceMappings": "AWS::AutoScaling::LaunchConfiguration.BlockDeviceMappings", "IamInstanceProfile": "String", @@ -54,10 +54,19 @@ "type": "list", "member": "String" }, + "AWS::AutoScaling::LaunchConfiguration.LaunchConfigurationName": { + "type": "string", + "minLength": 1, + "maxLength": 255 + }, "AWS::AutoScaling::LaunchConfiguration.SecurityGroups": { "type": "list", "member": "String" }, + "AWS::AutoScaling::LaunchConfiguration.UserData": { + "type": "string", + "maxLength": 21847 + }, "AWS::AutoScaling::LaunchConfiguration/BlockDevice": { "type": "structure", "members": { @@ -149,14 +158,24 @@ "AWS::DSQL::Cluster/Tag": { "type": "structure", "members": { - "Key": "String", - "Value": "String" + "Key": "AWS::DSQL::Cluster/Tag.Key", + "Value": "AWS::DSQL::Cluster/Tag.Value" }, "required": [ "Key", "Value" ] }, + "AWS::DSQL::Cluster/Tag.Key": { + "type": "string", + "minLength": 1, + "maxLength": 128 + }, + "AWS::DSQL::Cluster/Tag.Value": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, "AWS::EC2::Instance": { "type": "structure", "members": { @@ -1553,7 +1572,7 @@ "EncryptionConfig": "AWS::EKS::Cluster.EncryptionConfig", "KubernetesNetworkConfig": "AWS::EKS::Cluster/KubernetesNetworkConfig", "Logging": "AWS::EKS::Cluster/Logging", - "Name": "String", + "Name": "AWS::EKS::Cluster.Name", "Id": "String", "ResourcesVpcConfig": "AWS::EKS::Cluster/ResourcesVpcConfig", "OutpostConfig": "AWS::EKS::Cluster/OutpostConfig", @@ -1563,7 +1582,7 @@ "ComputeConfig": "AWS::EKS::Cluster/ComputeConfig", "StorageConfig": "AWS::EKS::Cluster/StorageConfig", "RoleArn": "String", - "Version": "String", + "Version": "AWS::EKS::Cluster.Version", "Force": "Boolean", "RollbackConfig": "AWS::EKS::Cluster/RollbackConfig", "Tags": "AWS::EKS::Cluster.Tags", @@ -1592,10 +1611,20 @@ "type": "list", "member": "AWS::EKS::Cluster/EncryptionConfig" }, + "AWS::EKS::Cluster.Name": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "pattern": "^[0-9A-Za-z][A-Za-z0-9\\-_]*" + }, "AWS::EKS::Cluster.Tags": { "type": "list", "member": "AWS::EKS::Cluster/Tag" }, + "AWS::EKS::Cluster.Version": { + "type": "string", + "pattern": "1\\.\\d\\d" + }, "AWS::EKS::Cluster/AccessConfig": { "type": "structure", "members": { @@ -1890,14 +1919,24 @@ "AWS::EKS::Cluster/Tag": { "type": "structure", "members": { - "Key": "String", - "Value": "String" + "Key": "AWS::EKS::Cluster/Tag.Key", + "Value": "AWS::EKS::Cluster/Tag.Value" }, "required": [ "Key", "Value" ] }, + "AWS::EKS::Cluster/Tag.Key": { + "type": "string", + "minLength": 1, + "maxLength": 128 + }, + "AWS::EKS::Cluster/Tag.Value": { + "type": "string", + "minLength": 0, + "maxLength": 256 + }, "AWS::EKS::Cluster/UpgradePolicy": { "type": "structure", "members": { @@ -2226,7 +2265,7 @@ "type": "structure", "members": { "FunctionScalingConfig": "AWS::Lambda::Function/FunctionScalingConfig", - "Description": "String", + "Description": "AWS::Lambda::Function.Description", "TracingConfig": "AWS::Lambda::Function/TracingConfig", "VpcConfig": "AWS::Lambda::Function/VpcConfig", "RuntimeManagementConfig": "AWS::Lambda::Function/RuntimeManagementConfig", @@ -2234,13 +2273,13 @@ "ReservedConcurrentExecutions": "Integer", "SnapStart": "AWS::Lambda::Function/SnapStart", "FileSystemConfigs": "AWS::Lambda::Function.FileSystemConfigs", - "FunctionName": "String", + "FunctionName": "AWS::Lambda::Function.FunctionName", "AcceleratorConfig": "AWS::Lambda::Function/AcceleratorConfig", "Runtime": "String", - "KmsKeyArn": "String", + "KmsKeyArn": "AWS::Lambda::Function.KmsKeyArn", "PublishToLatestPublished": "Boolean", "PackageType": "String", - "CodeSigningConfigArn": "String", + "CodeSigningConfigArn": "AWS::Lambda::Function.CodeSigningConfigArn", "Layers": "AWS::Lambda::Function.Layers", "TenancyConfig": "AWS::Lambda::Function/TenancyConfig", "Tags": "AWS::Lambda::Function.Tags", @@ -2249,10 +2288,10 @@ "DeadLetterConfig": "AWS::Lambda::Function/DeadLetterConfig", "Timeout": "Integer", "CapacityProviderConfig": "AWS::Lambda::Function/CapacityProviderConfig", - "Handler": "String", + "Handler": "AWS::Lambda::Function.Handler", "SnapStartResponse": "AWS::Lambda::Function/SnapStartResponse", "Code": "AWS::Lambda::Function/Code", - "Role": "String", + "Role": "AWS::Lambda::Function.Role", "LoggingConfig": "AWS::Lambda::Function/LoggingConfig", "RecursiveLoop": "AWS::Lambda::Function/RecursiveLoop", "Environment": "AWS::Lambda::Function/Environment", @@ -2270,14 +2309,39 @@ "type": "list", "member": "String" }, + "AWS::Lambda::Function.CodeSigningConfigArn": { + "type": "string", + "pattern": "arn:(aws[a-zA-Z-]*)?:lambda:(eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\\d{1}:\\d{12}:code-signing-config:csc-[a-z0-9]{17}" + }, + "AWS::Lambda::Function.Description": { + "type": "string", + "maxLength": 256 + }, "AWS::Lambda::Function.FileSystemConfigs": { "type": "list", "member": "AWS::Lambda::Function/FileSystemConfig" }, + "AWS::Lambda::Function.FunctionName": { + "type": "string", + "minLength": 1 + }, + "AWS::Lambda::Function.Handler": { + "type": "string", + "maxLength": 128, + "pattern": "^[^\\s]+$" + }, + "AWS::Lambda::Function.KmsKeyArn": { + "type": "string", + "pattern": "^(arn:(aws[a-zA-Z-]*)?:[a-z0-9-.]+:.*)|()$" + }, "AWS::Lambda::Function.Layers": { "type": "list", "member": "String" }, + "AWS::Lambda::Function.Role": { + "type": "string", + "pattern": "^arn:(aws[a-zA-Z-]*)?:iam::\\d{12}:role/?[a-zA-Z_0-9+=,.@\\-_/]+$" + }, "AWS::Lambda::Function.Tags": { "type": "list", "member": "AWS::Lambda::Function/Tag" @@ -2303,25 +2367,49 @@ "AWS::Lambda::Function/Code": { "type": "structure", "members": { - "SourceKMSKeyArn": "String", - "S3ObjectVersion": "String", - "S3Bucket": "String", + "SourceKMSKeyArn": "AWS::Lambda::Function/Code.SourceKMSKeyArn", + "S3ObjectVersion": "AWS::Lambda::Function/Code.S3ObjectVersion", + "S3Bucket": "AWS::Lambda::Function/Code.S3Bucket", "ZipFile": "String", - "S3Key": "String", + "S3Key": "AWS::Lambda::Function/Code.S3Key", "S3ObjectStorageMode": "String", "ImageUri": "String" } }, + "AWS::Lambda::Function/Code.S3Bucket": { + "type": "string", + "minLength": 3, + "maxLength": 63, + "pattern": "^[0-9A-Za-z\\.\\-_]*(? invalidSesArnValues() { + String snsPrefix = "arn:aws:sns:us-east-1:000000000000:"; + return Stream.of( + Arguments.of("SNS ARN has wrong service", "SnsDestination", "TopicARN", + "arn:aws:sqs:us-east-1:000000000000:topic-name", + "failed validation constraint for keyword [pattern]"), + Arguments.of("SNS ARN is below schema minimum", "SnsDestination", "TopicARN", + "arn:aws:sns:a:000000000000:x", "expected minLength: 36, actual: 28"), + Arguments.of("SNS ARN is blank", "SnsDestination", "TopicARN", "", + "expected minLength: 36, actual: 0"), + Arguments.of("SNS ARN exceeds schema maximum", "SnsDestination", "TopicARN", + snsPrefix + "x".repeat(1100 - snsPrefix.length()), + "expected maxLength: 1024, actual: 1100"), + Arguments.of("EventBridge ARN has wrong service", "EventBridgeDestination", "EventBusArn", + "arn:aws:sns:us-east-1:000000000000:event-bus/topic-name", + "failed validation constraint for keyword [pattern]")); + } + + @ParameterizedTest(name = "{0}") + @MethodSource("invalidSesDestinationStrings") + void handlerReaderChecksEveryConstrainedSesString(String caseName, String properties, + String expectedMessage) { + assertHandlerReaderFailure("AWS::SES::ConfigurationSetEventDestination", properties, + "Model validation failed (" + expectedMessage + ")"); + } + + static Stream invalidSesDestinationStrings() { + String dimensions = """ + {"ConfigurationSetName":"set","EventDestination":{"MatchingEventTypes":["SEND"], + "CloudWatchDestination":{"DimensionConfigurations":[{"DimensionValueSource":"emailHeader", + "DimensionName":"%s","DefaultDimensionValue":"%s"}]}}} + """; + return Stream.of( + Arguments.of("event destination name pattern", """ + {"ConfigurationSetName":"set","EventDestination":{ + "MatchingEventTypes":["SEND"],"Name":"bad name"}} + """, "#/EventDestination/Name: failed validation constraint for keyword [pattern]"), + Arguments.of("dimension name minimum", dimensions.formatted("", "value"), + "#/EventDestination/CloudWatchDestination/DimensionConfigurations/0/DimensionName: " + + "expected minLength: 1, actual: 0"), + Arguments.of("default dimension value maximum", dimensions.formatted("name", "x".repeat(257)), + "#/EventDestination/CloudWatchDestination/DimensionConfigurations/0/DefaultDimensionValue: " + + "expected maxLength: 256, actual: 257")); + } + + @Test + void handlerReaderAcceptsValidSesArnsAndUnconstrainedRequiredStrings() { + JsonNode properties = json(""" + {"ConfigurationSetName":"x","EventDestination":{ + "Name":"","MatchingEventTypes":["SEND"], + "SnsDestination":{"TopicARN":"arn:aws:sns:us-east-1:000000000000:topic-name"}, + "EventBridgeDestination":{"EventBusArn":"arn:aws:events:us-east-1:000000000000:event-bus/topic-name"}, + "KinesisFirehoseDestination":{"IAMRoleARN":"role","DeliveryStreamARN":"stream"}}} + """); + + assertEquals(properties, new CfnPropertyTypes.HandlerReader(engine()) + .read("AWS::SES::ConfigurationSetEventDestination", properties)); + } + + @Test + void handlerReaderAcceptsSesArnAtSchemaMaximumLength() { + String prefix = "arn:aws:sns:us-east-1:000000000000:"; + String arn = prefix + "x".repeat(1024 - prefix.length()); + JsonNode properties = json(""" + {"ConfigurationSetName":"set","EventDestination":{ + "MatchingEventTypes":["SEND"],"SnsDestination":{"TopicARN":"%s"}}} + """.formatted(arn)); + + assertEquals(properties, new CfnPropertyTypes.HandlerReader(engine()) + .read("AWS::SES::ConfigurationSetEventDestination", properties)); + } + @ParameterizedTest(name = "{0}") @MethodSource("unknownSesMembers") void handlerReaderRejectsExtraneousMembers(String caseName, String properties, String violation) { @@ -289,7 +372,7 @@ class CfnPropertyTypesTest { "{\"ConfigurationSetName\":\"set\",\"EventDestination\":{\"MatchingEventTypes\":[\"SEND\"]},\"Extra\":true}", "#: extraneous key [Extra] is not permitted"), Arguments.of("nested member", - "{\"ConfigurationSetName\":\"set\",\"EventDestination\":{\"MatchingEventTypes\":[\"SEND\"],\"SnsDestination\":{\"TopicARN\":\"arn\",\"Extra\":true}}}", + "{\"ConfigurationSetName\":\"set\",\"EventDestination\":{\"MatchingEventTypes\":[\"SEND\"],\"SnsDestination\":{\"TopicARN\":\"arn:aws:sns:us-east-1:000000000000:topic-name\",\"Extra\":true}}}", "#/EventDestination/SnsDestination: extraneous key [Extra] is not permitted")); } @@ -357,15 +440,11 @@ class CfnPropertyTypesTest { @Test void handlerReaderReportsKnownMembersBeforeExtraneousMembers() { - AwsException failure = assertThrows(AwsException.class, - () -> new CfnPropertyTypes.HandlerReader(engine()) - .read("AWS::SES::ConfigurationSetEventDestination", json(""" - {"ConfigurationSetName":"set","EventDestination":{ - "Extra":true,"MatchingEventTypes":["SEND"],"Enabled":"bogus"}} - """))); - - assertEquals("Model validation failed (#/EventDestination/Enabled: expected type: Boolean, found: String\n" - + "#/EventDestination: extraneous key [Extra] is not permitted)", failure.getMessage()); + assertHandlerReaderFailure("AWS::SES::ConfigurationSetEventDestination", """ + {"ConfigurationSetName":"set","EventDestination":{ + "Extra":true,"MatchingEventTypes":["SEND"],"Enabled":"bogus"}} + """, "Model validation failed (#/EventDestination/Enabled: expected type: Boolean, found: String\n" + + "#/EventDestination: extraneous key [Extra] is not permitted)"); } @Test diff --git a/tools/aws/regen_cfn_property_types.py b/tools/aws/regen_cfn_property_types.py index 67dbb09dfc..fe1ece80b3 100644 --- a/tools/aws/regen_cfn_property_types.py +++ b/tools/aws/regen_cfn_property_types.py @@ -55,7 +55,7 @@ RESOURCE_TYPES = ["AWS::AutoScaling::LaunchConfiguration", "AWS::DSQL::Cluster", "AWS::Lambda::Function", "AWS::Lambda::LayerVersion", "AWS::SES::ConfigurationSetEventDestination"] -# The shared shape each scalar body is written as, inline; a definition keeps its own name. +# The shared shape each unconstrained scalar body is written as, inline; a definition keeps its own name. SCALAR_SHAPES = {"string": "String", "integer": "Integer", "boolean": "Boolean", "double": "Double", "json": "Json"} SCHEMA_SCALARS = {"string": "string", "integer": "integer", "boolean": "boolean", "number": "double"} SHAPE_TYPES = {"structure", "list", "map", *SCALAR_SHAPES} @@ -146,7 +146,7 @@ def shape_for(schema: dict, resource_type: str, name: str, node: dict, shapes: d shapes[target] = body_of(schema, resource_type, target, schema["definitions"][definition], shapes) return target body = body_of(schema, resource_type, name, node, shapes) - if body["type"] in SCALAR_SHAPES: + if body["type"] in SCALAR_SHAPES and len(body) == 1: return SCALAR_SHAPES[body["type"]] shapes[name] = body return name @@ -178,7 +178,12 @@ def body_of(schema: dict, resource_type: str, name: str, node: dict, shapes: dic items = node.get("items") member = shape_for(schema, resource_type, f"{name}[]", items, shapes) if isinstance(items, dict) else "Json" return {"type": "list", "member": member} - return {"type": SCHEMA_SCALARS.get(kind, "json")} + body = {"type": SCHEMA_SCALARS.get(kind, "json")} + if kind == "string": + for constraint in ("minLength", "maxLength", "pattern"): + if constraint in node: + body[constraint] = node[constraint] + return body def render(document: dict) -> str: diff --git a/tools/aws/test_regen_cfn_property_types.py b/tools/aws/test_regen_cfn_property_types.py index 599eaa317d..26d1188e73 100644 --- a/tools/aws/test_regen_cfn_property_types.py +++ b/tools/aws/test_regen_cfn_property_types.py @@ -23,7 +23,7 @@ SCHEMA = { "Attempts": {"type": "integer"}, "Enabled": {"type": "boolean"}, "Ratio": {"type": "number"}}}, }, "properties": { - "Name": {"type": "string"}, + "Name": {"type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[a-z]+$"}, "Targets": {"type": "array", "items": {"$ref": "#/definitions/Target"}}, "Pattern": {"type": "object"}, "Tags": {"type": "array", "items": {"type": "object", "properties": {"Key": {"type": "string"}}}}, @@ -46,8 +46,10 @@ def test_each_schema_type_becomes_a_shape(monkeypatch): assert doc["operations"] == {"AWS::Test::Thing": "AWS::Test::Thing"} shapes = doc["shapes"] assert shapes["AWS::Test::Thing"] == {"type": "structure", "members": { - "Name": "String", "Targets": "AWS::Test::Thing.Targets", "Pattern": "Json", "Tags": "AWS::Test::Thing.Tags"}, + "Name": "AWS::Test::Thing.Name", "Targets": "AWS::Test::Thing.Targets", "Pattern": "Json", "Tags": "AWS::Test::Thing.Tags"}, "required": ["Name"]} + assert shapes["AWS::Test::Thing.Name"] == { + "type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[a-z]+$"} assert shapes["AWS::Test::Thing.Targets"] == {"type": "list", "member": "AWS::Test::Thing/Target"} assert shapes["AWS::Test::Thing/Target"] == {"type": "structure", "members": { "Id": "String", "Retry": "AWS::Test::Thing/Retry", "Labels": "AWS::Test::Thing/Target.Labels", @@ -77,7 +79,11 @@ def test_ses_event_destination_shape_preserves_nested_schema_constraints(): assert shapes[type_name]["required"] == ["ConfigurationSetName", "EventDestination"] destination = shapes[f"{type_name}/EventDestination"] assert destination["required"] == ["MatchingEventTypes"] - assert destination["members"]["Name"] == "String" + assert destination["members"]["Name"] == f"{type_name}/EventDestination.Name" + assert shapes[f"{type_name}/EventDestination.Name"]["pattern"] == "^[a-zA-Z0-9_-]{0,64}$" + dimension = shapes[f"{type_name}/DimensionConfiguration"] + assert shapes[dimension["members"]["DimensionName"]]["minLength"] == 1 + assert shapes[dimension["members"]["DefaultDimensionValue"]]["maxLength"] == 256 assert destination["members"]["MatchingEventTypes"] == f"{type_name}/EventDestination.MatchingEventTypes" assert shapes[f"{type_name}/SnsDestination"]["required"] == ["TopicARN"] assert shapes[f"{type_name}/KinesisFirehoseDestination"]["required"] == ["IAMRoleARN", "DeliveryStreamARN"]