Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
MrArnoldPalmer authored Jun 29, 2020
2 parents 7d26214 + 05aaf42 commit 26c971d
Show file tree
Hide file tree
Showing 260 changed files with 7,722 additions and 3,025 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: "\U0001F41B Bug Report"
about: Report a bug
title: "(module): "
title: "[module] "
labels: bug, needs-triage
---

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/doc.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: "📕 Documentation Issue"
about: Issue in the reference documentation or developer guide
title: "(module): "
title: "[module] "
labels: feature-request, documentation, needs-triage
---

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: "\U0001F680 Feature Request"
about: Request a new feature
title: "(module): "
title: "[module] "
labels: feature-request, needs-triage
---

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/general-issues.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: "\U00002753 General Issue"
about: Create a new issue
title: "(module): "
title: "[module] "
labels: needs-triage
---

Expand Down
307 changes: 152 additions & 155 deletions .github/workflows/issue-label-assign.yml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ cdk.out/

# Yarn error log
yarn-error.log

# Parcel default cache directory
.parcel-cache
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

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.47.0](https://github.com/aws/aws-cdk/compare/v1.46.0...v1.47.0) (2020-06-24)


### ⚠ BREAKING CHANGES

* **stepfunctions-tasks:** `Dynamo*` tasks no longer implement`IStepFunctionsTask` and have been replaced by constructs that can be instantiated directly. See README for examples

### Features

* **cfn-include:** add support for retrieving parameter objects ([#8658](https://github.com/aws/aws-cdk/issues/8658)) ([52dc123](https://github.com/aws/aws-cdk/commit/52dc123ba8696abcfad99d8093e98cd39b5b104f)), closes [#8657](https://github.com/aws/aws-cdk/issues/8657)
* **cfn-include:** support logical id overrides ([#8529](https://github.com/aws/aws-cdk/issues/8529)) ([d9c4f5e](https://github.com/aws/aws-cdk/commit/d9c4f5e67c54e1a2a436978fbc28fffd92b24cd6)), closes [#7375](https://github.com/aws/aws-cdk/issues/7375)
* **cloudwatch:** CompositeAlarm ([#8498](https://github.com/aws/aws-cdk/issues/8498)) ([1e6d293](https://github.com/aws/aws-cdk/commit/1e6d293f4c445318b11bd6fe998325688a675807))
* **efs:** access point ([#8631](https://github.com/aws/aws-cdk/issues/8631)) ([dde0ef5](https://github.com/aws/aws-cdk/commit/dde0ef52cc0cdbc40fd212f518f3cee4f30450b9))
* **stepfunctions:** grant APIs for state machine construct ([#8486](https://github.com/aws/aws-cdk/issues/8486)) ([fe71364](https://github.com/aws/aws-cdk/commit/fe71364b6cd8274e937cc2dc9185249dcbbb9388)), closes [#5933](https://github.com/aws/aws-cdk/issues/5933)
* **stepfunctions-tasks:** task constructs to call DynamoDB APIs ([#8466](https://github.com/aws/aws-cdk/issues/8466)) ([a7cb3b7](https://github.com/aws/aws-cdk/commit/a7cb3b7633c433ecb0619c030914bfa497ee39bc)), closes [#8108](https://github.com/aws/aws-cdk/issues/8108)


### Bug Fixes

* **appsync:** Not to throw an Error even if 'additionalAuthorizationModes' is undefined ([#8673](https://github.com/aws/aws-cdk/issues/8673)) ([6b5d77b](https://github.com/aws/aws-cdk/commit/6b5d77b452bccb35564d6acee118112156149eb0)), closes [#8666](https://github.com/aws/aws-cdk/issues/8666) [#8668](https://github.com/aws/aws-cdk/issues/8668)
* **cli:** cannot change policies or trust after initial bootstrap ([#8677](https://github.com/aws/aws-cdk/issues/8677)) ([6e6b23e](https://github.com/aws/aws-cdk/commit/6e6b23e329d8a1b6455210768371a5ab9de478ef)), closes [#6581](https://github.com/aws/aws-cdk/issues/6581)
* **cli:** crash on tiny reported terminal width ([#8675](https://github.com/aws/aws-cdk/issues/8675)) ([a186c24](https://github.com/aws/aws-cdk/commit/a186c24918fddc697270b794b6603add5a47e947)), closes [#8667](https://github.com/aws/aws-cdk/issues/8667)
* **toolkit:** CLI tool fails on CloudFormation Throttling ([#8711](https://github.com/aws/aws-cdk/issues/8711)) ([e512a40](https://github.com/aws/aws-cdk/commit/e512a4057b21d32432d4dc7ac14ae7caa812265d)), closes [#5637](https://github.com/aws/aws-cdk/issues/5637)

## [1.46.0](https://github.com/aws/aws-cdk/compare/v1.45.0...v1.46.0) (2020-06-19)


Expand Down
12 changes: 12 additions & 0 deletions allowed-breaking-changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,15 @@ removed:@aws-cdk/core.BootstraplessSynthesizer.DEFAULT_ASSET_PUBLISHING_ROLE_ARN
removed:@aws-cdk/core.DefaultStackSynthesizer.DEFAULT_ASSET_PUBLISHING_ROLE_ARN
removed:@aws-cdk/core.DefaultStackSynthesizerProps.assetPublishingExternalId
removed:@aws-cdk/core.DefaultStackSynthesizerProps.assetPublishingRoleArn

# merge asset manifest schema into cloud assembly schema
removed:@aws-cdk/cdk-assets-schema.AssetManifestSchema
removed:@aws-cdk/cdk-assets-schema.AwsDestination
removed:@aws-cdk/cdk-assets-schema.DockerImageAsset
removed:@aws-cdk/cdk-assets-schema.DockerImageDestination
removed:@aws-cdk/cdk-assets-schema.DockerImageSource
removed:@aws-cdk/cdk-assets-schema.FileAsset
removed:@aws-cdk/cdk-assets-schema.FileDestination
removed:@aws-cdk/cdk-assets-schema.FileSource
removed:@aws-cdk/cdk-assets-schema.ManifestFile
removed:@aws-cdk/cdk-assets-schema.FileAssetPackaging
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.46.0"
"version": "1.47.0"
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
"@aws-cdk/aws-codepipeline-actions/case/**",
"@aws-cdk/aws-ecr-assets/minimatch",
"@aws-cdk/aws-ecr-assets/minimatch/**",
"@aws-cdk/aws-eks/yaml",
"@aws-cdk/aws-eks/yaml/**",
"@aws-cdk/aws-lambda-nodejs/parcel-bundler",
"@aws-cdk/aws-lambda-nodejs/parcel-bundler/**",
"@aws-cdk/cdk-assets-schema/semver",
"@aws-cdk/cdk-assets-schema/semver/**",
"@aws-cdk/cloud-assembly-schema/jsonschema",
"@aws-cdk/cloud-assembly-schema/jsonschema/**",
"@aws-cdk/cloud-assembly-schema/semver",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^26.0.0",
"@types/jest": "^26.0.3",
"cdk-build-tools": "0.0.0",
"jest": "^25.5.4",
"pkglint": "0.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class LambdaIntegration extends AwsIntegration {
super.bind(method);
const principal = new iam.ServicePrincipal('apigateway.amazonaws.com');

const desc = `${method.restApi.node.uniqueId}.${method.httpMethod}.${method.resource.path.replace(/\//g, '.')}`;
const desc = `${method.api.node.uniqueId}.${method.httpMethod}.${method.resource.path.replace(/\//g, '.')}`;

this.handler.addPermission(`ApiPermission.${desc}`, {
principal,
Expand Down
15 changes: 5 additions & 10 deletions packages/@aws-cdk/aws-apigateway/lib/method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,27 +237,22 @@ export class Method extends Resource {
* arn:aws:execute-api:{region}:{account}:{restApiId}/{stage}/{method}/{path}
*
* NOTE: {stage} will refer to the `restApi.deploymentStage`, which will
* automatically set if auto-deploy is enabled.
* automatically set if auto-deploy is enabled, or can be explicitly assigned.
* When not configured, {stage} will be set to '*', as a shorthand for 'all stages'.
*
* @attribute
*/
public get methodArn(): string {
if (!this.restApi.deploymentStage) {
throw new Error(
`Unable to determine ARN for method "${this.node.id}" since there is no stage associated with this API.\n` +
'Either use the `deploy` prop or explicitly assign `deploymentStage` on the RestApi');
}

const stage = this.restApi.deploymentStage.stageName.toString();
return this.restApi.arnForExecuteApi(this.httpMethod, pathForArn(this.resource.path), stage);
const stage = this.api.deploymentStage?.stageName;
return this.api.arnForExecuteApi(this.httpMethod, pathForArn(this.resource.path), stage);
}

/**
* Returns an execute-api ARN for this method's "test-invoke-stage" stage.
* This stage is used by the AWS Console UI when testing the method.
*/
public get testMethodArn(): string {
return this.restApi.arnForExecuteApi(this.httpMethod, pathForArn(this.resource.path), 'test-invoke-stage');
return this.api.arnForExecuteApi(this.httpMethod, pathForArn(this.resource.path), 'test-invoke-stage');
}

private renderIntegration(integration?: Integration): CfnMethod.IntegrationProperty {
Expand Down
27 changes: 17 additions & 10 deletions packages/@aws-cdk/aws-apigateway/lib/restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export interface IRestApi extends IResourceBase {
*/
readonly latestDeployment?: Deployment;

/**
* API Gateway stage that points to the latest deployment (if defined).
*/
deploymentStage: Stage;

/**
* Represents the root resource ("/") of this API. Use it to define the API model:
*
Expand All @@ -46,6 +51,17 @@ export interface IRestApi extends IResourceBase {
*
*/
readonly root: IResource;

/**
* Gets the "execute-api" ARN
* @returns The "execute-api" ARN.
* @default "*" returns the execute API ARN for all methods/resources in
* this API.
* @param method The method (default `*`)
* @param path The resource path. Must start with '/' (default `*`)
* @param stage The stage (default `*`)
*/
arnForExecuteApi(method?: string, path?: string, stage?: string): string;
}

/**
Expand Down Expand Up @@ -324,15 +340,6 @@ export abstract class RestApiBase extends Resource implements IRestApi {
return new UsagePlan(this, id, props);
}

/**
* Gets the "execute-api" ARN
* @returns The "execute-api" ARN.
* @default "*" returns the execute API ARN for all methods/resources in
* this API.
* @param method The method (default `*`)
* @param path The resource path. Must start with '/' (default `*`)
* @param stage The stage (default `*`)
*/
public arnForExecuteApi(method: string = '*', path: string = '/*', stage: string = '*') {
if (!path.startsWith('/')) {
throw new Error(`"path" must begin with a "/": '${path}'`);
Expand Down Expand Up @@ -496,7 +503,7 @@ export class RestApi extends RestApiBase {
* Import an existing RestApi.
*/
public static fromRestApiId(scope: Construct, id: string, restApiId: string): IRestApi {
class Import extends Resource implements IRestApi {
class Import extends RestApiBase {
public readonly restApiId = restApiId;

public get root(): IResource {
Expand Down
24 changes: 24 additions & 0 deletions packages/@aws-cdk/aws-apigateway/test/test.lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,28 @@ export = {

test.done();
},

'works for imported RestApi'(test: Test) {
const stack = new cdk.Stack();
const api = apigateway.RestApi.fromRestApiAttributes(stack, 'RestApi', {
restApiId: 'imported-rest-api-id',
rootResourceId: 'imported-root-resource-id',
});

const handler = new lambda.Function(stack, 'MyFunc', {
runtime: lambda.Runtime.NODEJS_10_X,
handler: 'index.handler',
code: lambda.Code.fromInline('loo'),
});

api.root.addMethod('ANY', new apigateway.LambdaIntegration(handler));

expect(stack).to(haveResource('AWS::ApiGateway::Method', {
RestApiId: 'imported-rest-api-id',
ResourceId: 'imported-root-resource-id',
HttpMethod: 'ANY',
}));

test.done();
},
};
24 changes: 20 additions & 4 deletions packages/@aws-cdk/aws-apigateway/test/test.method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,31 @@ export = {
test.done();
},

'"methodArn" fails if the API does not have a deployment stage'(test: Test) {
'"methodArn" returns an arn with "*" as its stage when deploymentStage is not set'(test: Test) {
// GIVEN
const stack = new cdk.Stack();
const api = new apigw.RestApi(stack, 'test-api', { deploy: false });

// WHEN
const method = new apigw.Method(stack, 'my-method', { httpMethod: 'POST', resource: api.root });

// WHEN + THEN
test.throws(() => method.methodArn,
/Unable to determine ARN for method "my-method" since there is no stage associated with this API./);
// THEN
test.deepEqual(stack.resolve(method.methodArn), {
'Fn::Join': [
'',
[
'arn:',
{ Ref: 'AWS::Partition' },
':execute-api:',
{ Ref: 'AWS::Region' },
':',
{ Ref: 'AWS::AccountId' },
':',
{ Ref: 'testapiD6451F70' },
'/*/POST/',
],
],
});

test.done();
},
Expand Down
12 changes: 6 additions & 6 deletions packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,7 @@ export class GraphQLApi extends Construct {
props.authorizationConfig.defaultAuthorization.userPoolConfig!,
)
: undefined,
additionalAuthenticationProviders: props.authorizationConfig
?.additionalAuthorizationModes!.length
? this.formatAdditionalAuthorizationModes(
props.authorizationConfig!.additionalAuthorizationModes!,
)
: undefined,
additionalAuthenticationProviders: this.formatAdditionalAuthenticationProviders(props),
});

this.apiId = this.api.attrApiId;
Expand Down Expand Up @@ -569,6 +564,11 @@ export class GraphQLApi extends Construct {
[],
);
}

private formatAdditionalAuthenticationProviders(props: GraphQLApiProps): CfnGraphQLApi.AdditionalAuthenticationProviderProperty[] | undefined {
const authModes = props.authorizationConfig?.additionalAuthorizationModes;
return authModes ? this.formatAdditionalAuthorizationModes(authModes) : undefined;
}
}

/**
Expand Down
21 changes: 18 additions & 3 deletions packages/@aws-cdk/aws-appsync/test/appsync.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
import '@aws-cdk/assert/jest';
import {} from '../lib';
import * as cdk from '@aws-cdk/core';
import * as path from 'path';
import * as appsync from '../lib';

test('No tests are specified for this package', () => {
expect(true).toBe(true);
test('should not throw an Error', () => {
// Given
const stack = new cdk.Stack();

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

// Then
expect(when).not.toThrow();
});
4 changes: 4 additions & 0 deletions packages/@aws-cdk/aws-backup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

> All classes with the `Cfn` prefix in this module ([CFN Resources](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) are always stable and safe to use.
![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)

> The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.
---
<!--END STABILITY BANNER-->

Expand Down
8 changes: 5 additions & 3 deletions packages/@aws-cdk/aws-backup/lib/vault.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as iam from '@aws-cdk/aws-iam';
import * as kms from '@aws-cdk/aws-kms';
import * as sns from '@aws-cdk/aws-sns';
import { Aws, Construct, IResource, RemovalPolicy, Resource } from '@aws-cdk/core';
import { Construct, IResource, RemovalPolicy, Resource } from '@aws-cdk/core';
import { CfnBackupVault } from './backup.generated';

/**
Expand All @@ -21,7 +21,9 @@ export interface IBackupVault extends IResource {
*/
export interface BackupVaultProps {
/**
* The name of a logical container where backups are stored.
* The name of a logical container where backups are stored. Backup vaults
* are identified by names that are unique to the account used to create
* them and the AWS Region where they are created.
*
* @default - A CDK generated name
*/
Expand Down Expand Up @@ -158,7 +160,7 @@ export class BackupVault extends Resource implements IBackupVault {

private uniqueVaultName() {
// Max length of 50 chars, get the last 50 chars
const id = `${this.node.uniqueId}${Aws.STACK_NAME}`;
const id = this.node.uniqueId;
return id.substring(Math.max(id.length - 50, 0), id.length);
}
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-backup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"node": ">= 10.13.0 <13 || >=13.7.0"
},
"stability": "experimental",
"maturity": "cfn-only",
"maturity": "experimental",
"awscdkio": {
"announce": false
}
Expand Down
12 changes: 1 addition & 11 deletions packages/@aws-cdk/aws-backup/test/integ.backup.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,7 @@
"Vault23237E5B": {
"Type": "AWS::Backup::BackupVault",
"Properties": {
"BackupVaultName": {
"Fn::Join": [
"",
[
"cdkbackupVaultC2A6D3CB",
{
"Ref": "AWS::StackName"
}
]
]
}
"BackupVaultName": "cdkbackupVaultC2A6D3CB"
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
Expand Down
Loading

0 comments on commit 26c971d

Please sign in to comment.