Skip to content

Commit

Permalink
Merge branch 'master' into appsync-schema
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanPan342 authored Jul 30, 2020
2 parents ccbc5e4 + fbb0418 commit 3bf2fe4
Show file tree
Hide file tree
Showing 89 changed files with 4,092 additions and 1,251 deletions.
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
image: jsii/superchain
tasks:
- init: yarn build --skip-test --no-bail --skip-prereqs
- init: yarn build --skip-test --no-bail --skip-prereqs --skip-compat

vscode:
extensions:
Expand Down
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,40 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.55.0](https://github.com/aws/aws-cdk/compare/v1.54.0...v1.55.0) (2020-07-28)


### ⚠ BREAKING CHANGES

* **lambda:** the `bundlingDockerImage` prop of a `Runtime` now points to the AWS SAM build image (`amazon/aws-sam-cli-build-image-<runtime>`) instead of the LambCI build image (`lambci/lambda:build-<runtime>`)
* **appsync:** `pipelineConfig` is now an array of `string` instead of `CfnResolver.PipelineConfigProperty` for usability.
- **appsync**: `pipelineConfig` parameter takes in `string []`

### Features

* **appsync:** grant APIs for managing permissions ([#8993](https://github.com/aws/aws-cdk/issues/8993)) ([e6dca52](https://github.com/aws/aws-cdk/commit/e6dca529098e54c91f0706019b9ee06522ddb025)), closes [#6772](https://github.com/aws/aws-cdk/issues/6772) [#7871](https://github.com/aws/aws-cdk/issues/7871) [#7313](https://github.com/aws/aws-cdk/issues/7313)
* **aws-codepipeline:** experimental support for ServiceCatalog deploy action ([#9214](https://github.com/aws/aws-cdk/issues/9214)) ([950e51f](https://github.com/aws/aws-cdk/commit/950e51f1edab335a3fd323b6d51f7444738bb9dc))
* **cfn-include:** handle resources not in the CloudFormation schema ([#9199](https://github.com/aws/aws-cdk/issues/9199)) ([d287525](https://github.com/aws/aws-cdk/commit/d28752513175c94fb2bc4da43374d7f2e66d6550)), closes [#9197](https://github.com/aws/aws-cdk/issues/9197)
* **cfnspec:** cloudformation spec v16.1.0 ([#9074](https://github.com/aws/aws-cdk/issues/9074)) ([d1ca04f](https://github.com/aws/aws-cdk/commit/d1ca04f7a136be437a0538d7606803bdf0a73f98))
* **cfnspec:** cloudformation spec v16.1.0 ([#9216](https://github.com/aws/aws-cdk/issues/9216)) ([d4b68d3](https://github.com/aws/aws-cdk/commit/d4b68d3040a96451f2b708c512af5afa8fa33bb8))
* **cloudfront:** new aws-cloudfront-origins module, support for ALB/NLB origins ([#9209](https://github.com/aws/aws-cdk/issues/9209)) ([27ee332](https://github.com/aws/aws-cdk/commit/27ee332cba66ec9bd2ac369c657c4f94464f1f4c)), closes [#9207](https://github.com/aws/aws-cdk/issues/9207)
* **cloudfront:** support Lambda@Edge for behaviors ([#9220](https://github.com/aws/aws-cdk/issues/9220)) ([d3e5533](https://github.com/aws/aws-cdk/commit/d3e553348d93a0a8aa1617391772e4883e6c52c1)), closes [#9108](https://github.com/aws/aws-cdk/issues/9108)
* **lambda:** official lambda build docker images ([#9211](https://github.com/aws/aws-cdk/issues/9211)) ([ae0cf2a](https://github.com/aws/aws-cdk/commit/ae0cf2a3fa936771e66fa45f24af5efec52a3f21)), closes [#9205](https://github.com/aws/aws-cdk/issues/9205)
* **lambda-python:** introducing LambdaPython ([#9182](https://github.com/aws/aws-cdk/issues/9182)) ([4cc2834](https://github.com/aws/aws-cdk/commit/4cc2834e0ef2683b99c4a6258cf104f8a714479f))
* **route53-patterns:** the route53-patterns module is now stable ([#9232](https://github.com/aws/aws-cdk/issues/9232)) ([add23bf](https://github.com/aws/aws-cdk/commit/add23bf3331f73830c918953566e1d772da34cc0))


### Bug Fixes

* **appsync:** resolver unable to set pipelineConfig ([#9093](https://github.com/aws/aws-cdk/issues/9093)) ([dac9bb3](https://github.com/aws/aws-cdk/commit/dac9bb312f5b0a9c83d929c862e30b49f3b8654a)), closes [#6923](https://github.com/aws/aws-cdk/issues/6923)
* **cloudfront:** Set MinimumProtocolVersion and SslSupportMethod when specifying distribution certificate ([#9200](https://github.com/aws/aws-cdk/issues/9200)) ([f99c327](https://github.com/aws/aws-cdk/commit/f99c3271ed2b4c68f3cd2970a1b38571f5ddc911))
* **cloudtrail:** missing sns publish permissions ([#9239](https://github.com/aws/aws-cdk/issues/9239)) ([b4339a1](https://github.com/aws/aws-cdk/commit/b4339a19c3fbada5b9407871ccb59461102081fc))
* **codepipeline-actions:** CodeDeployEcsDeployAction does not properly handle unnamed Artifacts ([#9147](https://github.com/aws/aws-cdk/issues/9147)) ([ac612c6](https://github.com/aws/aws-cdk/commit/ac612c6b70c01162761f6a51bdb25445da1cbf0d)), closes [#8971](https://github.com/aws/aws-cdk/issues/8971)
* **pipelines:** Reduce template size by combining IAM roles and policies ([#9243](https://github.com/aws/aws-cdk/issues/9243)) ([1ac6863](https://github.com/aws/aws-cdk/commit/1ac686384a84afae6c3254f787f2f23542b2a948)), closes [#9066](https://github.com/aws/aws-cdk/issues/9066) [#9225](https://github.com/aws/aws-cdk/issues/9225) [#9237](https://github.com/aws/aws-cdk/issues/9237)
* **rds:** SQL Server instance engine uses incorrect major version ([#9215](https://github.com/aws/aws-cdk/issues/9215)) ([eee8689](https://github.com/aws/aws-cdk/commit/eee86899f6836ceca608fb5a1f867d0062f4e5b9)), closes [#9171](https://github.com/aws/aws-cdk/issues/9171)
* **route53-targets:** Add China Partition Support for CloudFrontTarget ([#9174](https://github.com/aws/aws-cdk/issues/9174)) ([52a966a](https://github.com/aws/aws-cdk/commit/52a966a2fa6b72fefc73859a1253b36a235cd631))
* **stepfunctions-tasks:** EvaluateExpression error when key specified multiple times ([#8858](https://github.com/aws/aws-cdk/issues/8858)) ([6506327](https://github.com/aws/aws-cdk/commit/65063275b64f647c570a06f7a28d37c5d403113b)), closes [#8856](https://github.com/aws/aws-cdk/issues/8856)

## [1.54.0](https://github.com/aws/aws-cdk/compare/v1.53.0...v1.54.0) (2020-07-22)


Expand Down
8 changes: 7 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -euo pipefail
bail="--bail"
runtarget="build+test"
check_prereqs="true"
check_compat="true"
while [[ "${1:-}" != "" ]]; do
case $1 in
-h|--help)
Expand All @@ -22,6 +23,9 @@ while [[ "${1:-}" != "" ]]; do
--skip-prereqs)
check_prereqs="false"
;;
--skip-compat)
check_compat="false"
;;
*)
echo "Unrecognized parameter: $1"
exit 1
Expand Down Expand Up @@ -70,6 +74,8 @@ echo "==========================================================================
echo "building..."
time lerna run $bail --stream $runtarget || fail

/bin/bash scripts/check-api-compatibility.sh
if [ "$check_compat" == "true" ]; then
/bin/bash scripts/check-api-compatibility.sh
fi

touch $BUILD_INDICATOR
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"tools/*"
],
"rejectCycles": "true",
"version": "1.54.0"
"version": "1.55.0"
}
13 changes: 9 additions & 4 deletions packages/@aws-cdk/aws-appsync/lib/resolver.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Construct, IResolvable } from '@aws-cdk/core';
import { Construct } from '@aws-cdk/core';
import { CfnResolver } from './appsync.generated';
import { BaseDataSource } from './data-source';
import { GraphQLApi } from './graphqlapi';
import { MappingTemplate } from './mapping-template';

/**
* Basic properties for an AppSync resolver
*/
Expand All @@ -18,9 +19,10 @@ export interface BaseResolverProps {
/**
* configuration of the pipeline resolver
*
* @default - create a UNIT resolver
* @default - no pipeline resolver configuration
* An empty array | undefined sets resolver to be of kind, unit
*/
readonly pipelineConfig?: CfnResolver.PipelineConfigProperty | IResolvable;
readonly pipelineConfig?: string[];
/**
* The request mapping template for this resolver
*
Expand Down Expand Up @@ -65,12 +67,15 @@ export class Resolver extends Construct {
constructor(scope: Construct, id: string, props: ResolverProps) {
super(scope, id);

const pipelineConfig = props.pipelineConfig && props.pipelineConfig.length ? { functions: props.pipelineConfig } : undefined;

this.resolver = new CfnResolver(this, 'Resource', {
apiId: props.api.apiId,
typeName: props.typeName,
fieldName: props.fieldName,
dataSourceName: props.dataSource ? props.dataSource.name : undefined,
kind: props.pipelineConfig ? 'PIPELINE' : 'UNIT',
kind: pipelineConfig ? 'PIPELINE' : 'UNIT',
pipelineConfig: pipelineConfig,
requestMappingTemplate: props.requestMappingTemplate ? props.requestMappingTemplate.renderTemplate() : undefined,
responseMappingTemplate: props.responseMappingTemplate ? props.responseMappingTemplate.renderTemplate() : undefined,
});
Expand Down
78 changes: 75 additions & 3 deletions packages/@aws-cdk/aws-appsync/test/appsync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import * as cdk from '@aws-cdk/core';
import * as appsync from '../lib';

test('should not throw an Error', () => {
// Given
// GIVEN
const stack = new cdk.Stack();

// When
// WHEN
const when = () => {
new appsync.GraphQLApi(stack, 'api', {
authorizationConfig: {},
Expand All @@ -17,6 +17,78 @@ test('should not throw an Error', () => {
});
};

// Then
// THEN
expect(when).not.toThrow();
});

test('appsync should configure pipeline when pipelineConfig has contents', () => {
// GIVEN
const stack = new cdk.Stack();

// WHEN
const api = new appsync.GraphQLApi(stack, 'api', {
authorizationConfig: {},
name: 'api',
schemaDefinitionFile: path.join(__dirname, 'appsync.test.graphql'),
});

new appsync.Resolver(stack, 'resolver', {
api: api,
typeName: 'test',
fieldName: 'test2',
pipelineConfig: ['test', 'test'],
});

// THEN
expect(stack).toHaveResourceLike('AWS::AppSync::Resolver', {
Kind: 'PIPELINE',
PipelineConfig: { Functions: [ 'test', 'test' ] },
});
});

test('appsync should configure resolver as unit when pipelineConfig is empty', () => {
// GIVEN
const stack = new cdk.Stack();

// WHEN
const api = new appsync.GraphQLApi(stack, 'api', {
authorizationConfig: {},
name: 'api',
schemaDefinitionFile: path.join(__dirname, 'appsync.test.graphql'),
});

new appsync.Resolver(stack, 'resolver', {
api: api,
typeName: 'test',
fieldName: 'test2',
});

// THEN
expect(stack).toHaveResourceLike('AWS::AppSync::Resolver', {
Kind: 'UNIT',
});
});

test('appsync should configure resolver as unit when pipelineConfig is empty array', () => {
// GIVEN
const stack = new cdk.Stack();

// WHEN
const api = new appsync.GraphQLApi(stack, 'api', {
authorizationConfig: {},
name: 'api',
schemaDefinitionFile: path.join(__dirname, 'appsync.test.graphql'),
});

new appsync.Resolver(stack, 'resolver', {
api: api,
typeName: 'test',
fieldName: 'test2',
pipelineConfig: [],
});

// THEN
expect(stack).toHaveResourceLike('AWS::AppSync::Resolver', {
Kind: 'UNIT',
});
});
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-certificatemanager/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ nyc.config.js
.LAST_PACKAGE
*.snk
!.eslintrc.js
!jest.config.js

junit.xml
junit.xml
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-certificatemanager/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ tsconfig.json

# exclude cdk artifacts
**/cdk.out
junit.xml
junit.xml
jest.config.js
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-certificatemanager/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const baseConfig = require('../../../tools/cdk-build-tools/config/jest.config');
module.exports = baseConfig;
13 changes: 12 additions & 1 deletion packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ function renderDomainValidation(validation: CertificateValidation, domainNames:

switch (validation.method) {
case ValidationMethod.DNS:
for (const domainName of domainNames) {
for (const domainName of getUniqueDnsDomainNames(domainNames)) {
const hostedZone = validation.props.hostedZones?.[domainName] ?? validation.props.hostedZone;
if (hostedZone) {
domainValidation.push({ domainName, hostedZoneId: hostedZone.hostedZoneId });
Expand All @@ -260,3 +260,14 @@ function renderDomainValidation(validation: CertificateValidation, domainNames:

return domainValidation.length !== 0 ? domainValidation : undefined;
}

/**
* Removes wildcard domains (*.example.com) where the base domain (example.com) is present.
* This is because the DNS validation treats them as the same thing, and the automated CloudFormation
* DNS validation errors out with the duplicate records.
*/
function getUniqueDnsDomainNames(domainNames: string[]) {
return domainNames.filter(domain => {
return Token.isUnresolved(domain) || !domain.startsWith('*.') || !domainNames.includes(domain.replace('*.', ''));
});
}
5 changes: 2 additions & 3 deletions packages/@aws-cdk/aws-certificatemanager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"compat": "cdk-compat"
},
"cdk-build": {
"cloudformation": "AWS::CertificateManager"
"cloudformation": "AWS::CertificateManager",
"jest": true
},
"keywords": [
"aws",
Expand All @@ -63,10 +64,8 @@
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@types/nodeunit": "^0.0.31",
"cdk-build-tools": "0.0.0",
"cfn2ts": "0.0.0",
"nodeunit": "^0.11.3",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
Loading

0 comments on commit 3bf2fe4

Please sign in to comment.