Skip to content

Commit

Permalink
Merge branch 'master' into eks-serviceLinkRole
Browse files Browse the repository at this point in the history
  • Loading branch information
pahud authored May 1, 2020
2 parents 329299e + 5861d18 commit 6ff144f
Show file tree
Hide file tree
Showing 153 changed files with 1,210 additions and 3,181 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

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.36.1](https://github.com/aws/aws-cdk/compare/v1.36.0...v1.36.1) (2020-04-29)

### Bug Fixes

* multiple breakages due to jest version upgrade ([#7667](https://github.com/aws/aws-cdk/pull/7667)) ([e18312](https://github.com/aws/aws-cdk/commit/e18312c4de42857d893913bd3124bd06bb16982e)), closes [#7657](https://github.com/aws/aws-cdk/issues/7657)

## [1.36.0](https://github.com/aws/aws-cdk/compare/v1.35.0...v1.36.0) (2020-04-28)


Expand Down
4 changes: 4 additions & 0 deletions buildspec-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ version: 0.2
phases:
install:
commands:
# Start docker daemon inside the container
- nohup /usr/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2&
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"

# Install yarn if it wasn't already present in the image
- yarn --version || npm -g install yarn
build:
Expand Down
4 changes: 4 additions & 0 deletions buildspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ version: 0.2
phases:
install:
commands:
# Start docker daemon inside the container
- nohup /usr/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2&
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"

# Install yarn if it wasn't already present in the image
- yarn --version || npm -g install yarn
pre_build:
Expand Down
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.36.0"
"version": "1.36.1"
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk/alexa-ask/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
<!--END STABILITY BANNER-->

```ts
const alexaAsk = require('@aws-cdk/alexa-ask');
import * as alexaAsk from '@aws-cdk/alexa-ask';
```
10 changes: 5 additions & 5 deletions packages/@aws-cdk/app-delivery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ The example below defines a *CDK App* that contains 3 stacks:
#### `index.ts`

```typescript
import codebuild = require('@aws-cdk/aws-codebuild');
import codepipeline = require('@aws-cdk/aws-codepipeline');
import codepipeline_actions = require('@aws-cdk/aws-codepipeline-actions');
import cdk = require('@aws-cdk/core');
import cicd = require('@aws-cdk/app-delivery');
import * as codebuild from '@aws-cdk/aws-codebuild';
import * as codepipeline from '@aws-cdk/aws-codepipeline';
import * as codepipeline_actions from '@aws-cdk/aws-codepipeline-actions';
import * as cdk from '@aws-cdk/core';
import * as cicd from '@aws-cdk/app-delivery';

const app = new cdk.App();

Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"devDependencies": {
"@types/jest": "^25.2.1",
"cdk-build-tools": "0.0.0",
"jest": "^25.5.2",
"jest": "^25.5.3",
"pkglint": "0.0.0",
"ts-jest": "^25.4.0"
},
Expand All @@ -44,7 +44,7 @@
},
"peerDependencies": {
"@aws-cdk/core": "0.0.0",
"jest": "^25.5.2",
"jest": "^25.5.3",
"constructs": "^3.0.2"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-accessanalyzer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.

```ts
import accessanalyzer = require('@aws-cdk/aws-accessanalyzer');
import * as accessanalyzer from '@aws-cdk/aws-accessanalyzer';
```
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-acmpca/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.

```ts
import acmpca = require('@aws-cdk/aws-acmpca');
import * as acmpca from '@aws-cdk/aws-acmpca';
```
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-amazonmq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
<!--END STABILITY BANNER-->

```ts
const amazonmq = require('@aws-cdk/aws-amazonmq');
import * as amazonmq from '@aws-cdk/aws-amazonmq';
```
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-amplify/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ The AWS Amplify Console provides a Git-based workflow for deploying and hosting
### Setting up an app with branches, custom rules and a domain
To set up an Amplify Console app, define an `App`:
```ts
import codebuild = require('@aws-cdk/aws-codebuild');
import amplify = require('@aws-cdk/aws-amplify');
import cdk = require('@aws-cdk/core');
import * as codebuild from '@aws-cdk/aws-codebuild';
import * as amplify from '@aws-cdk/aws-amplify';
import * as cdk from '@aws-cdk/core';

const amplifyApp = new amplify.App(this, 'MyApp', {
sourceCodeProvider: new amplify.GitHubSourceCodeProvider({
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigatewayv2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.

```ts
import apigatewayv2 = require('@aws-cdk/aws-apigatewayv2');
import * as apigatewayv2 from '@aws-cdk/aws-apigatewayv2';
```
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appconfig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.

```ts
import appconfig = require('@aws-cdk/aws-appconfig');
import * as appconfig from '@aws-cdk/aws-appconfig';
```
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appstream/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
<!--END STABILITY BANNER-->

```ts
const appstream = require('@aws-cdk/aws-appstream');
import * as appstream from '@aws-cdk/aws-appstream';
```
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-appsync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ export class ApiStack extends Stack {
constructor(scope: Construct, id: string) {
super(scope, id);

const userPool = new UserPool(this, 'UserPool', {
signInType: SignInType.USERNAME,
const userPool = new UserPool(this, 'UserPool'{
userPoolName: 'myPool',
});

const api = new GraphQLApi(this, 'Api', {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-autoscaling-hooktargets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.5.2",
"jest": "^25.5.3",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-autoscaling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ An `AutoScalingGroup` represents a number of instances on which you run your cod
pick the size of the fleet, the instance type and the OS image:

```ts
import autoscaling = require('@aws-cdk/aws-autoscaling');
import ec2 = require('@aws-cdk/aws-ec2');
import * as autoscaling from '@aws-cdk/aws-autoscaling';
import * as ec2 from '@aws-cdk/aws-ec2';

new autoscaling.AutoScalingGroup(this, 'ASG', {
vpc,
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-batch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.5.2",
"jest": "^25.5.3",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cassandra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.

```ts
import cassandra = require('@aws-cdk/aws-cassandra');
import * as cassandra from '@aws-cdk/aws-cassandra';
```
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ce/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.

```ts
import ce = require('@aws-cdk/aws-ce');
import * as ce from '@aws-cdk/aws-ce';
```
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-chatbot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.

```ts
import chatbot = require('@aws-cdk/aws-chatbot');
import * as chatbot from '@aws-cdk/aws-chatbot';
```
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-cloudformation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ The following example will define a single top-level stack that contains two nes

```ts
import { Stack, Construct, StackProps } from '@aws-cdk/core';
import cfn = require('@aws-cdk/aws-cloudformation');
import s3 = require('@aws-cdk/aws-s3');
import * as cfn from '@aws-cdk/aws-cloudformation';
import * as s3 from '@aws-cdk/aws-s3';

class MyNestedStack extends cfn.NestedStack {
constructor(scope: Construct, id: string, props?: cfn.NestedStackProps) {
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.30",
"aws-sdk": "^2.666.0",
"aws-sdk": "^2.667.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
Expand Down
10 changes: 5 additions & 5 deletions packages/@aws-cdk/aws-cloudtrail/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Add a CloudTrail construct - for ease of setting up CloudTrail logging in your a
Example usage:

```ts
import cloudtrail = require('@aws-cdk/aws-cloudtrail');
import * as cloudtrail from '@aws-cdk/aws-cloudtrail';

const trail = new cloudtrail.Trail(this, 'CloudTrail');
```
Expand All @@ -43,7 +43,7 @@ For example, to log to CloudWatch Logs

```ts

import cloudtrail = require('@aws-cdk/aws-cloudtrail');
import * as cloudtrail from '@aws-cdk/aws-cloudtrail';

const trail = new cloudtrail.Trail(this, 'CloudTrail', {
sendToCloudWatchLogs: true
Expand All @@ -58,7 +58,7 @@ you can use the `CloudTrailProps` configuration object.
Example:

```ts
import cloudtrail = require('@aws-cdk/aws-cloudtrail');
import * as cloudtrail from '@aws-cdk/aws-cloudtrail';

const trail = new cloudtrail.Trail(this, 'MyAmazingCloudTrail');

Expand All @@ -77,8 +77,8 @@ For using CloudTrail event selector to log events about Lambda
functions, you can use `addLambdaEventSelector`.

```ts
import cloudtrail = require('@aws-cdk/aws-cloudtrail');
import lambda = require('@aws-cdk/aws-lambda');
import * as cloudtrail from '@aws-cdk/aws-cloudtrail';
import * as lambda from '@aws-cdk/aws-lambda';

const trail = new cloudtrail.Trail(this, 'MyAmazingCloudTrail');
const lambdaFunction = new lambda.Function(stack, 'AnAmazingFunction', {
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 @@
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@types/nodeunit": "^0.0.30",
"aws-sdk": "^2.666.0",
"aws-sdk": "^2.667.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-cloudwatch-actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.5.2",
"jest": "^25.5.3",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
7 changes: 6 additions & 1 deletion packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IAlarmAction } from './alarm-action';
import { CfnAlarm, CfnAlarmProps } from './cloudwatch.generated';
import { HorizontalAnnotation } from './graph';
import { CreateAlarmOptions } from './metric';
import { IMetric, MetricStatConfig } from './metric-types';
import { IMetric, MetricExpressionConfig, MetricStatConfig } from './metric-types';
import { dispatchMetric, metricPeriod } from './private/metric-util';
import { dropUndefined } from './private/object';
import { MetricSet } from './private/rendering';
Expand Down Expand Up @@ -326,6 +326,7 @@ export class Alarm extends Resource implements IAlarm {
expression: expr.expression,
id: entry.id || uniqueMetricId(),
label: conf.renderingProperties?.label,
period: mathExprHasSubmetrics(expr) ? undefined : expr.period,
returnData: entry.tag ? undefined : false, // Tag stores "primary" attribute, default is "true"
};
},
Expand Down Expand Up @@ -388,4 +389,8 @@ function renderIfExtendedStatistic(statistic?: string): string | undefined {
return undefined;
}

function mathExprHasSubmetrics(expr: MetricExpressionConfig) {
return Object.keys(expr.usingMetrics).length > 0;
}

type Writeable<T> = { -readonly [P in keyof T]: T[P] };
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-cloudwatch/lib/metric-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,11 @@ export interface MetricExpressionConfig {
* Metrics used in the math expression
*/
readonly usingMetrics: Record<string, IMetric>;

/**
* How many seconds to aggregate over
*/
readonly period: number;
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-cloudwatch/lib/metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ export class MathExpression implements IMetric {
public toMetricConfig(): MetricConfig {
return {
mathExpression: {
period: this.period.toSeconds(),
expression: this.expression,
usingMetrics: this.usingMetrics,
},
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-cloudwatch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@
"props-default-doc:@aws-cdk/aws-cloudwatch.MetricGraphConfig.unit",
"props-default-doc:@aws-cdk/aws-cloudwatch.MetricRenderingProperties.color",
"props-default-doc:@aws-cdk/aws-cloudwatch.MetricRenderingProperties.label",
"props-default-doc:@aws-cdk/aws-cloudwatch.MetricRenderingProperties.stat"
"props-default-doc:@aws-cdk/aws-cloudwatch.MetricRenderingProperties.stat",
"duration-prop-type:@aws-cdk/aws-cloudwatch.MetricExpressionConfig.period"
]
},
"engines": {
Expand Down
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
Expand Up @@ -507,6 +507,28 @@ export = {
test.done();
},

'MathExpression without inner metrics emits its own period'(test: Test) {
// WHEN
new Alarm(stack, 'Alarm', {
threshold: 1, evaluationPeriods: 1,
metric: new MathExpression({
expression: 'INSIGHT_RULE_METRIC("SomeId", UniqueContributors)',
usingMetrics: {},
}),
});

// THEN
alarmMetricsAre([
{
Expression: 'INSIGHT_RULE_METRIC("SomeId", UniqueContributors)',
Id: 'expr_1',
Period: 300,
},
]);

test.done();
},

'annotation for a mathexpression alarm is calculated based upon constituent metrics'(test: Test) {
// GIVEN
const alarm = new Alarm(stack, 'Alarm', {
Expand Down
Loading

0 comments on commit 6ff144f

Please sign in to comment.