Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cfnspec): cloudformation spec v11.3.0 #6598

Merged
merged 4 commits into from
Mar 6, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions packages/@aws-cdk/cfnspec/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,65 @@
# CloudFormation Resource Specification v11.3.0

## New Resource Types

* AWS::CloudWatch::CompositeAlarm

## Attribute Changes

* AWS::AppMesh::Mesh MeshOwner (__added__)
* AWS::AppMesh::Mesh ResourceOwner (__added__)
* AWS::AppMesh::Route MeshOwner (__added__)
* AWS::AppMesh::Route ResourceOwner (__added__)
* AWS::AppMesh::VirtualNode MeshOwner (__added__)
* AWS::AppMesh::VirtualNode ResourceOwner (__added__)
* AWS::AppMesh::VirtualRouter MeshOwner (__added__)
* AWS::AppMesh::VirtualRouter ResourceOwner (__added__)
* AWS::AppMesh::VirtualService MeshOwner (__added__)
* AWS::AppMesh::VirtualService ResourceOwner (__added__)

## Property Changes


## Property Type Changes

* AWS::AppMesh::VirtualNode.BackendDefaults (__added__)
* AWS::AppMesh::VirtualNode.ClientPolicy (__added__)
* AWS::AppMesh::VirtualNode.ClientPolicyTls (__added__)
* AWS::AppMesh::VirtualNode.ListenerTls (__added__)
* AWS::AppMesh::VirtualNode.ListenerTlsAcmCertificate (__added__)
* AWS::AppMesh::VirtualNode.ListenerTlsCertificate (__added__)
* AWS::AppMesh::VirtualNode.ListenerTlsFileCertificate (__added__)
* AWS::AppMesh::VirtualNode.TlsValidationContext (__added__)
* AWS::AppMesh::VirtualNode.TlsValidationContextAcmTrust (__added__)
* AWS::AppMesh::VirtualNode.TlsValidationContextFileTrust (__added__)
* AWS::AppMesh::VirtualNode.TlsValidationContextTrust (__added__)
* AWS::Greengrass::ResourceDefinition.ResourceDownloadOwnerSetting (__added__)
* AWS::Greengrass::ResourceDefinitionVersion.ResourceDownloadOwnerSetting (__added__)
* AWS::AppMesh::VirtualNode.Listener TLS (__added__)
* AWS::AppMesh::VirtualNode.VirtualNodeSpec BackendDefaults (__added__)
* AWS::AppMesh::VirtualNode.VirtualServiceBackend ClientPolicy (__added__)
* AWS::Greengrass::ResourceDefinition.S3MachineLearningModelResourceData OwnerSetting (__added__)
* AWS::Greengrass::ResourceDefinition.SageMakerMachineLearningModelResourceData OwnerSetting (__added__)
* AWS::Greengrass::ResourceDefinitionVersion.S3MachineLearningModelResourceData OwnerSetting (__added__)
* AWS::Greengrass::ResourceDefinitionVersion.SageMakerMachineLearningModelResourceData OwnerSetting (__added__)

# Serverless Application Model (SAM) Resource Specification v2016-10-31

## New Resource Types


## Attribute Changes


## Property Changes


## Property Type Changes

* AWS::Serverless::Function.CloudWatchLogsEvent (__added__)
* AWS::Serverless::Function.EventSource Properties.Types (__changed__)
* Added CloudWatchLogsEvent

# CloudFormation Resource Specification v11.1.0

## New Resource Types
Expand Down
26 changes: 24 additions & 2 deletions packages/@aws-cdk/cfnspec/build-tools/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ async function main() {
}
}

detectScrutinyTypes(spec);
replaceIncompleteTypes(spec);
massageSpec(spec);

spec.Fingerprint = md5(JSON.stringify(normalize(spec)));

Expand All @@ -36,6 +35,12 @@ async function main() {
await fs.writeJson(path.join(outDir, 'specification.json'), spec, { spaces: 2 });
}

export function massageSpec(spec: schema.Specification) {
detectScrutinyTypes(spec);
replaceIncompleteTypes(spec);
dropTypelessAttributes(spec);
}

function forEachSection(spec: schema.Specification, data: any, cb: (spec: any, fragment: any, path: string[]) => void) {
cb(spec.PropertyTypes, data.PropertyTypes, ['PropertyTypes']);
cb(spec.ResourceTypes, data.ResourceTypes, ['ResourceTypes']);
Expand Down Expand Up @@ -74,6 +79,23 @@ function replaceIncompleteTypes(spec: schema.Specification) {
}
}

/**
* Drop Attributes specified with the different ResourceTypes that have
* no type specified.
*/
function dropTypelessAttributes(spec: schema.Specification) {
const resourceTypes = spec.ResourceTypes;
Object.values(resourceTypes).forEach((resourceType) => {
const attributes = resourceType.Attributes ?? {};
Object.keys(attributes).forEach((attrKey) => {
const attrVal = attributes[attrKey];
if (Object.keys(attrVal).length === 0) {
delete attributes[attrKey];
}
});
});
}

function merge(spec: any, fragment: any, jsonPath: string[]) {
if (!fragment) { return; }
for (const key of Object.keys(fragment)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cfnspec/cfn.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11.1.0
11.3.0
Loading