Skip to content

Commit

Permalink
Merge remote-tracking branch 'jaap/log-retention-rate-exceeded-error'…
Browse files Browse the repository at this point in the history
… into log-retention-rate-exceeded-error
  • Loading branch information
jaapvanblaaderen committed Jun 8, 2020
2 parents 1f86f2f + 4f3ef1d commit 5e9a4f0
Show file tree
Hide file tree
Showing 56 changed files with 1,616 additions and 324 deletions.
6 changes: 5 additions & 1 deletion allowed-breaking-changes.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Actually adding any artifact type will break the load() type signature because I could have written
# const x: A | B = Manifest.load();
# and that won't typecheck if Manifest.load() adds a union arm and now returns A | B | C.
change-return-type:@aws-cdk/cloud-assembly-schema.Manifest.load

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

8 changes: 6 additions & 2 deletions packages/@aws-cdk/aws-apigateway/lib/method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,15 @@ export class Method extends Resource {
}

const stage = this.restApi.deploymentStage.stageName.toString();
return this.restApi.arnForExecuteApi(this.httpMethod, this.resource.path, stage);
return this.restApi.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, this.resource.path, 'test-invoke-stage');
return this.restApi.arnForExecuteApi(this.httpMethod, pathForArn(this.resource.path), 'test-invoke-stage');
}

private renderIntegration(integration?: Integration): CfnMethod.IntegrationProperty {
Expand Down Expand Up @@ -380,3 +380,7 @@ export enum AuthorizationType {
*/
COGNITO = 'COGNITO_USER_POOLS',
}

function pathForArn(path: string): string {
return path.replace(/\{[^\}]*\}/g, '*'); // replace path parameters (like '{bookId}') with asterisk
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
{
"Ref": "stage0661E4AC"
},
"/*/{proxy+}"
"/*/*"
]
]
}
Expand Down Expand Up @@ -188,7 +188,7 @@
{
"Ref": "lambdarestapiF559E4F2"
},
"/test-invoke-stage/*/{proxy+}"
"/test-invoke-stage/*/*"
]
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@
{
"Ref": "booksapiDeploymentStageprod55D8E03E"
},
"/GET/books/{book_id}"
"/GET/books/*"
]
]
}
Expand Down Expand Up @@ -687,7 +687,7 @@
{
"Ref": "booksapiE1885304"
},
"/test-invoke-stage/GET/books/{book_id}"
"/test-invoke-stage/GET/books/*"
]
]
}
Expand Down Expand Up @@ -768,7 +768,7 @@
{
"Ref": "booksapiDeploymentStageprod55D8E03E"
},
"/DELETE/books/{book_id}"
"/DELETE/books/*"
]
]
}
Expand Down Expand Up @@ -805,7 +805,7 @@
{
"Ref": "booksapiE1885304"
},
"/test-invoke-stage/DELETE/books/{book_id}"
"/test-invoke-stage/DELETE/books/*"
]
]
}
Expand Down
46 changes: 46 additions & 0 deletions packages/@aws-cdk/aws-apigateway/test/test.method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,52 @@ export = {
test.done();
},

'"methodArn" and "testMethodArn" replace path parameters with asterisks'(test: Test) {
const stack = new cdk.Stack();
const api = new apigw.RestApi(stack, 'test-api');
const petId = api.root.addResource('pets').addResource('{petId}');
const commentId = petId.addResource('comments').addResource('{commentId}');
const method = commentId.addMethod('GET');

test.deepEqual(stack.resolve(method.methodArn), {
'Fn::Join': [
'',
[
'arn:',
{ Ref: 'AWS::Partition' },
':execute-api:',
{ Ref: 'AWS::Region' },
':',
{ Ref: 'AWS::AccountId' },
':',
{ Ref: 'testapiD6451F70' },
'/',
{ Ref: 'testapiDeploymentStageprod5C9E92A4' },
'/GET/pets/*/comments/*',
],
],
});

test.deepEqual(stack.resolve(method.testMethodArn), {
'Fn::Join': [
'',
[
'arn:',
{ Ref: 'AWS::Partition' },
':execute-api:',
{ Ref: 'AWS::Region' },
':',
{ Ref: 'AWS::AccountId' },
':',
{ Ref: 'testapiD6451F70' },
'/test-invoke-stage/GET/pets/*/comments/*',
],
],
});

test.done();
},

'integration "credentialsRole" can be used to assume a role when calling backend'(test: Test) {
// GIVEN
const stack = new cdk.Stack();
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudfront/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@types/nodeunit": "^0.0.31",
"aws-sdk": "^2.689.0",
"aws-sdk": "^2.691.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudtrail/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"aws-sdk": "^2.689.0",
"aws-sdk": "^2.691.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codebuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@aws-cdk/aws-sns": "0.0.0",
"@aws-cdk/aws-sqs": "0.0.0",
"@types/nodeunit": "^0.0.31",
"aws-sdk": "^2.689.0",
"aws-sdk": "^2.691.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codecommit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@aws-cdk/assert": "0.0.0",
"@aws-cdk/aws-sns": "0.0.0",
"@types/nodeunit": "^0.0.31",
"aws-sdk": "^2.689.0",
"aws-sdk": "^2.691.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
Expand Down
16 changes: 11 additions & 5 deletions packages/@aws-cdk/aws-cognito/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,21 @@ attributes. Besides these, additional attributes can be further defined, and are
Learn more on [attributes in Cognito's
documentation](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html).

The following code sample configures a user pool with two standard attributes (name and address) as required, and adds
four optional attributes.
The following code configures a user pool with two standard attributes (name and address) as required and mutable, and adds
four custom attributes.

```ts
new UserPool(this, 'myuserpool', {
// ...
requiredAttributes: {
fullname: true,
address: true,
standardAttributes: {
fullname: {
required: true,
mutable: false,
},
address: {
required: false,
mutable: true,
},
},
customAttributes: {
'myappid': new StringAttribute({ minLen: 5, maxLen: 15, mutable: false }),
Expand Down
Loading

0 comments on commit 5e9a4f0

Please sign in to comment.