Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

fwang committed Feb 26, 2021
2 parents 4a4cae9 + c4a239c commit c776f97
Showing 198 changed files with 4,851 additions and 2,657 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
@@ -6,8 +6,10 @@ on: pull_request
jobs:
auto-approve:
if: >
contains(github.event.pull_request.labels.*.name, 'pr/auto-approve') &&
contains(['aws-cdk-automation', 'dependabot[bot]', 'dependabot-preview[bot]'], github.event.pull_request.user.login)
contains(github.event.pull_request.labels.*.name, 'pr/auto-approve') &&
(github.event.pull_request.user.login == 'aws-cdk-automation'
|| github.event.pull_request.user.login == 'dependabot[bot]'
|| github.event.pull_request.user.login == 'dependabot-preview[bot]')
runs-on: ubuntu-latest
steps:
- uses: hmarr/auto-approve-action@v2.0.0
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@ All notable changes to this project will be documented in this file. See [standa
* **aws-appsync:** add databaseName to rdsDataSource ([#12575](https://github.com/aws/aws-cdk/issues/12575)) ([f92b65e](https://github.com/aws/aws-cdk/commit/f92b65e2a158f918d8f05132ed12a4bb85228997)), closes [#12572](https://github.com/aws/aws-cdk/issues/12572)
* **cfnspec:** cloudformation spec v28.0.0 ([#13101](https://github.com/aws/aws-cdk/issues/13101)) ([13c9859](https://github.com/aws/aws-cdk/commit/13c9859cc62b3d472ba1be84b12d478f61f02ec9))
* **ecs-patterns:** Add support for assignPublicIp for QueueProcessingFargateService ([#13122](https://github.com/aws/aws-cdk/issues/13122)) ([3fb4600](https://github.com/aws/aws-cdk/commit/3fb46001a7345cbefa6df70893999bcb304ed40d)), closes [#12815](https://github.com/aws/aws-cdk/issues/12815)
* **lambda:** Code.fromDockerBuildAsset ([#12258](https://github.com/aws/aws-cdk/issues/12258)) ([09afed5](https://github.com/aws/aws-cdk/commit/09afed5ca2b39919c1c84d200370d490110cd0d1)), closes [#11914](https://github.com/aws/aws-cdk/issues/11914)
* **stepfunctions-tasks:** add EKS call to SFN-tasks ([#12779](https://github.com/aws/aws-cdk/issues/12779)) ([296a10d](https://github.com/aws/aws-cdk/commit/296a10d76a9f6fc2a374d1a6461c460bcc3eeb79))
* **synthetics:** Update CloudWatch Synthetics NodeJS runtimes ([#12907](https://github.com/aws/aws-cdk/issues/12907)) ([6aac3b6](https://github.com/aws/aws-cdk/commit/6aac3b6a9bb1586ee16e7a85ca657b544d0f8304)), closes [#12906](https://github.com/aws/aws-cdk/issues/12906)

@@ -102,7 +101,7 @@ All notable changes to this project will be documented in this file. See [standa

### ⚠ BREAKING CHANGES TO EXPERIMENTAL FEATURES

* **appmesh:** the properties virtualRouter and virtualNode of VirtualServiceProps have been replaced with the union-like class VirtualServiceProvider
* **appmesh:** the properties virtualRouter and virtualNode of VirtualServiceProps have been replaced with the union-like class VirtualServiceProvider
* **appmesh**: the method `addVirtualService` has been removed from `IMesh`
* **cloudfront:** experimental EdgeFunction stack names have changed from 'edge-lambda-stack-${region}' to 'edge-lambda-stack-${stackid}' to support multiple independent CloudFront distributions with EdgeFunctions.

Original file line number Diff line number Diff line change
@@ -3491,4 +3491,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1111,56 +1111,36 @@
]
},
"Create": {
"service": "SQS",
"action": "sendMessage",
"parameters": {
"QueueUrl": {
"Ref": "nameserviceTaskRecordManagerEventsQueueF805A6C1"
},
"DelaySeconds": 10,
"MessageBody": "{ \"prime\": true }",
"MessageAttributes": {
"HostedZoneId": {
"DataType": "String",
"StringValue": {
"Ref": "zoneEB40FF1E"
}
"Fn::Join": [
"",
[
"{\"service\":\"SQS\",\"action\":\"sendMessage\",\"parameters\":{\"QueueUrl\":\"",
{
"Ref": "nameserviceTaskRecordManagerEventsQueueF805A6C1"
},
"RecordName": {
"DataType": "String",
"StringValue": "test-record"
}
}
},
"physicalResourceId": {
"responsePath": "MessageId"
}
"\",\"DelaySeconds\":10,\"MessageBody\":\"{ \\\"prime\\\": true }\",\"MessageAttributes\":{\"HostedZoneId\":{\"DataType\":\"String\",\"StringValue\":\"",
{
"Ref": "zoneEB40FF1E"
},
"\"},\"RecordName\":{\"DataType\":\"String\",\"StringValue\":\"test-record\"}}},\"physicalResourceId\":{\"responsePath\":\"MessageId\"}}"
]
]
},
"Update": {
"service": "SQS",
"action": "sendMessage",
"parameters": {
"QueueUrl": {
"Ref": "nameserviceTaskRecordManagerEventsQueueF805A6C1"
},
"DelaySeconds": 10,
"MessageBody": "{ \"prime\": true }",
"MessageAttributes": {
"HostedZoneId": {
"DataType": "String",
"StringValue": {
"Ref": "zoneEB40FF1E"
}
"Fn::Join": [
"",
[
"{\"service\":\"SQS\",\"action\":\"sendMessage\",\"parameters\":{\"QueueUrl\":\"",
{
"Ref": "nameserviceTaskRecordManagerEventsQueueF805A6C1"
},
"RecordName": {
"DataType": "String",
"StringValue": "test-record"
}
}
},
"physicalResourceId": {
"responsePath": "MessageId"
}
"\",\"DelaySeconds\":10,\"MessageBody\":\"{ \\\"prime\\\": true }\",\"MessageAttributes\":{\"HostedZoneId\":{\"DataType\":\"String\",\"StringValue\":\"",
{
"Ref": "zoneEB40FF1E"
},
"\"},\"RecordName\":{\"DataType\":\"String\",\"StringValue\":\"test-record\"}}},\"physicalResourceId\":{\"responsePath\":\"MessageId\"}}"
]
]
},
"InstallLatestAwsSdk": true
},
@@ -1210,7 +1190,7 @@
"Properties": {
"Code": {
"S3Bucket": {
"Ref": "AssetParametersb64b129569a5ac7a9abf88a18ac0b504d1fb1208872460476ed3fd435830eb94S3Bucket38F1BB8E"
"Ref": "AssetParameters0625b1566df06e0ffd948f0f65f97a3d22d48242e66196d3f72b480f5309b343S3Bucket65227904"
},
"S3Key": {
"Fn::Join": [
@@ -1223,7 +1203,7 @@
"Fn::Split": [
"||",
{
"Ref": "AssetParametersb64b129569a5ac7a9abf88a18ac0b504d1fb1208872460476ed3fd435830eb94S3VersionKeyCCDC67C0"
"Ref": "AssetParameters0625b1566df06e0ffd948f0f65f97a3d22d48242e66196d3f72b480f5309b343S3VersionKey3AF0E7DF"
}
]
}
@@ -1236,7 +1216,7 @@
"Fn::Split": [
"||",
{
"Ref": "AssetParametersb64b129569a5ac7a9abf88a18ac0b504d1fb1208872460476ed3fd435830eb94S3VersionKeyCCDC67C0"
"Ref": "AssetParameters0625b1566df06e0ffd948f0f65f97a3d22d48242e66196d3f72b480f5309b343S3VersionKey3AF0E7DF"
}
]
}
@@ -1286,17 +1266,17 @@
"Type": "String",
"Description": "Artifact hash for asset \"daeb79e3cee39c9b902dc0d5c780223e227ed573ea60976252947adab5fb2be1\""
},
"AssetParametersb64b129569a5ac7a9abf88a18ac0b504d1fb1208872460476ed3fd435830eb94S3Bucket38F1BB8E": {
"AssetParameters0625b1566df06e0ffd948f0f65f97a3d22d48242e66196d3f72b480f5309b343S3Bucket65227904": {
"Type": "String",
"Description": "S3 bucket for asset \"b64b129569a5ac7a9abf88a18ac0b504d1fb1208872460476ed3fd435830eb94\""
"Description": "S3 bucket for asset \"0625b1566df06e0ffd948f0f65f97a3d22d48242e66196d3f72b480f5309b343\""
},
"AssetParametersb64b129569a5ac7a9abf88a18ac0b504d1fb1208872460476ed3fd435830eb94S3VersionKeyCCDC67C0": {
"AssetParameters0625b1566df06e0ffd948f0f65f97a3d22d48242e66196d3f72b480f5309b343S3VersionKey3AF0E7DF": {
"Type": "String",
"Description": "S3 key for asset version \"b64b129569a5ac7a9abf88a18ac0b504d1fb1208872460476ed3fd435830eb94\""
"Description": "S3 key for asset version \"0625b1566df06e0ffd948f0f65f97a3d22d48242e66196d3f72b480f5309b343\""
},
"AssetParametersb64b129569a5ac7a9abf88a18ac0b504d1fb1208872460476ed3fd435830eb94ArtifactHash782948FC": {
"AssetParameters0625b1566df06e0ffd948f0f65f97a3d22d48242e66196d3f72b480f5309b343ArtifactHash0C561FF5": {
"Type": "String",
"Description": "Artifact hash for asset \"b64b129569a5ac7a9abf88a18ac0b504d1fb1208872460476ed3fd435830eb94\""
"Description": "Artifact hash for asset \"0625b1566df06e0ffd948f0f65f97a3d22d48242e66196d3f72b480f5309b343\""
}
},
"Outputs": {
Original file line number Diff line number Diff line change
@@ -2235,4 +2235,4 @@
}
}
}
}
}
17 changes: 14 additions & 3 deletions packages/@aws-cdk/aws-apigateway/README.md
Original file line number Diff line number Diff line change
@@ -157,13 +157,24 @@ book.addMethod('GET', getBookIntegration, {
});
```

It is possible to also integrate with AWS services in a different region. The following code integrates with Amazon SQS in the
`eu-west-1` region.

```ts
const getMessageIntegration = new apigateway.AwsIntegration({
service: 'sqs',
path: 'queueName',
region: 'eu-west-1'
});
```

## API Keys

The following example shows how to use an API Key with a usage plan:

```ts
const hello = new lambda.Function(this, 'hello', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'hello.handler',
code: lambda.Code.fromAsset('lambda')
});
@@ -230,7 +241,7 @@ The following example shows how to use a rate limited api key :

```ts
const hello = new lambda.Function(this, 'hello', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'hello.handler',
code: lambda.Code.fromAsset('lambda')
});
@@ -260,7 +271,7 @@ have to define your models and mappings for the request, response, and integrati

```ts
const hello = new lambda.Function(this, 'hello', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'hello.handler',
code: lambda.Code.fromAsset('lambda')
});
8 changes: 8 additions & 0 deletions packages/@aws-cdk/aws-apigateway/lib/integrations/aws.ts
Original file line number Diff line number Diff line change
@@ -60,6 +60,13 @@ export interface AwsIntegrationProps {
* Integration options, such as content handling, request/response mapping, etc.
*/
readonly options?: IntegrationOptions

/**
* The region of the integrated AWS service.
*
* @default - same region as the stack
*/
readonly region?: string;
}

/**
@@ -87,6 +94,7 @@ export class AwsIntegration extends Integration {
resource: apiType,
sep: '/',
resourceName: apiValue,
region: props.region,
});
},
}),
29 changes: 29 additions & 0 deletions packages/@aws-cdk/aws-apigateway/test/method.test.ts
Original file line number Diff line number Diff line change
@@ -90,6 +90,35 @@ describe('method', () => {

});

test('integration can be set for a service in the provided region', () => {
// GIVEN
const stack = new cdk.Stack();
const api = new apigw.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false });

// WHEN
new apigw.Method(stack, 'my-method', {
httpMethod: 'POST',
resource: api.root,
integration: new apigw.AwsIntegration({ service: 'sqs', path: 'queueName', region: 'eu-west-1' }),
});

// THEN
expect(stack).toHaveResource('AWS::ApiGateway::Method', {
Integration: {
IntegrationHttpMethod: 'POST',
Type: 'AWS',
Uri: {
'Fn::Join': [
'',
[
'arn:', { Ref: 'AWS::Partition' }, ':apigateway:eu-west-1:sqs:path/queueName',
],
],
},
},
});
});

test('integration with a custom http method can be set via a property', () => {
// GIVEN
const stack = new cdk.Stack();
Original file line number Diff line number Diff line change
@@ -72,7 +72,8 @@
"Arn"
]
},
"Runtime": "nodejs12.x"
"Runtime": "nodejs12.x",
"Description": "veni vidi vici"
},
"DependsOn": [
"CustomReflectCustomResourceProviderRoleB4B29AEC"
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ class TestStack extends Stack {
const serviceToken = CustomResourceProvider.getOrCreate(this, resourceType, {
codeDirectory: `${__dirname}/core-custom-resource-provider-fixture`,
runtime: CustomResourceProviderRuntime.NODEJS_12,
description: 'veni vidi vici',
});

const cr = new CustomResource(this, 'MyResource', {
8 changes: 4 additions & 4 deletions packages/@aws-cdk/aws-cloudfront/README.md
Original file line number Diff line number Diff line change
@@ -282,7 +282,7 @@ The following shows a Lambda@Edge function added to the default behavior and tri

```ts
const myFunc = new cloudfront.experimental.EdgeFunction(this, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
});
@@ -310,7 +310,7 @@ If the stack is in `us-east-1`, a "normal" `lambda.Function` can be used instead

```ts
const myFunc = new lambda.Function(this, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
});
@@ -321,14 +321,14 @@ you can also set a specific stack ID for each Lambda@Edge.

```ts
const myFunc1 = new cloudfront.experimental.EdgeFunction(this, 'MyFunction1', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler1')),
stackId: 'edge-lambda-stack-id-1'
});

const myFunc2 = new cloudfront.experimental.EdgeFunction(this, 'MyFunction2', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler2')),
stackId: 'edge-lambda-stack-id-2'
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudtrail/README.md
Original file line number Diff line number Diff line change
@@ -175,7 +175,7 @@ configures logging of Lambda data events for a specific Function.
```ts
const trail = new cloudtrail.Trail(this, 'MyAmazingCloudTrail');
const amazingFunction = new lambda.Function(stack, 'AnAmazingFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: "hello.handler",
code: lambda.Code.fromAsset("lambda"),
});
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-cloudwatch/lib/private/rendering.ts
Original file line number Diff line number Diff line change
@@ -55,6 +55,7 @@ function metricGraphJson(metric: IMetric, yAxis?: string, id?: string) {

withExpression(expr) {
options.expression = expr.expression;
if (expr.period && expr.period !== 300) { options.period = expr.period; }
},
});

Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@
{
"Ref": "AWS::Region"
},
"\",\"metrics\":[[{\"label\":\"Total Messages\",\"expression\":\"m1+m2\"}],[\"AWS/SQS\",\"ApproximateNumberOfMessagesVisible\",\"QueueName\",\"",
"\",\"metrics\":[[{\"label\":\"Total Messages\",\"expression\":\"m1+m2\",\"period\":60}],[\"AWS/SQS\",\"ApproximateNumberOfMessagesVisible\",\"QueueName\",\"",
{
"Fn::GetAtt": [
"queue",
@@ -120,7 +120,7 @@
{
"Ref": "AWS::Region"
},
"\",\"metrics\":[[{\"label\":\"Total Messages\",\"expression\":\"m1+m2\"}],[\"AWS/SQS\",\"ApproximateNumberOfMessagesVisible\",\"QueueName\",\"",
"\",\"metrics\":[[{\"label\":\"Total Messages\",\"expression\":\"m1+m2\",\"period\":60}],[\"AWS/SQS\",\"ApproximateNumberOfMessagesVisible\",\"QueueName\",\"",
{
"Fn::GetAtt": [
"queue",
22 changes: 22 additions & 0 deletions packages/@aws-cdk/aws-cloudwatch/test/test.metric-math.ts
Original file line number Diff line number Diff line change
@@ -219,6 +219,28 @@ export = {
test.done();
},

'top level period in a MathExpression is respected in its metrics'(test: Test) {
const graph = new GraphWidget({
left: [
a,
new MathExpression({
expression: 'a + b',
usingMetrics: { a, b },
period: Duration.minutes(1),
}),
],
});

// THEN
graphMetricsAre(test, graph, [
['Test', 'ACount'],
[{ label: 'a + b', expression: 'a + b', period: 60 }],
['Test', 'ACount', { visible: false, id: 'a', period: 60 }],
['Test', 'BCount', { visible: false, id: 'b', period: 60 }],
]);
test.done();
},

'MathExpression controls period of metrics transitively used in it'(test: Test) {
// Same as the previous test, but recursively

Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

0 comments on commit c776f97

Please sign in to comment.