Skip to content

Commit 9df2962

Browse files
authored
2 parents 0d1b77f + b23334e commit 9df2962

File tree

247 files changed

+2734
-454
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

247 files changed

+2734
-454
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "Assigns members from team aws-cdk-owners to PRs"
2+
on:
3+
pull_request_target:
4+
types: [opened]
5+
6+
jobs:
7+
team-assignment-manager:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: peterwoodworth/team-assignment-manager@main
11+
with:
12+
github-token: "${{ secrets.PROJEN_GITHUB_TOKEN }}"
13+
team: "aws-cdk-owners"
14+
exempt-team: "aws-cdk-team"
15+

.mergify.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pull_request_rules:
1010
label:
1111
add: [ contribution/core ]
1212
conditions:
13-
- author~=^(RomainMuller|garnaat|skinny85|rix0rrr|NGL321|Jerry-AWS|MrArnoldPalmer|iliapolo|pkandasamy91|SoManyHs|uttarasridhar|otaviomacedo|madeline-k|kaizencc|comcalvi|Chriscbr|corymhall|peterwoodworth|ryparker|TheRealAmazonKendra|yuth)$
13+
- author~=^(RomainMuller|garnaat|skinny85|rix0rrr|NGL321|Jerry-AWS|MrArnoldPalmer|iliapolo|pkandasamy91|SoManyHs|uttarasridhar|otaviomacedo|madeline-k|kaizencc|comcalvi|Chriscbr|corymhall|peterwoodworth|ryparker|TheRealAmazonKendra|yuth|vinayak-kukreja)$
1414
- -label~="contribution/core"
1515
- name: automatic merge
1616
actions:

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
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.
44

5+
## [1.155.0](https://github.com/aws/aws-cdk/compare/v1.154.0...v1.155.0) (2022-05-04)
6+
7+
8+
### Features
9+
10+
* **cfnspec:** cloudformation spec v68.0.0 ([#20065](https://github.com/aws/aws-cdk/issues/20065)) ([f199fad](https://github.com/aws/aws-cdk/commit/f199faddc0b8e565aa413e480e51d25fed5321bf))
11+
* **cloudwatch:** Add CustomWidget ([#19327](https://github.com/aws/aws-cdk/issues/19327)) ([489340e](https://github.com/aws/aws-cdk/commit/489340ea383c9130c315853afae0137b1fa03eb0)), closes [#17579](https://github.com/aws/aws-cdk/issues/17579)
12+
* **ec2:** add i4i instance type ([#20134](https://github.com/aws/aws-cdk/issues/20134)) ([64c5064](https://github.com/aws/aws-cdk/commit/64c50640e7f5897f08af3f86cd28a1dab3cd2430))
13+
* **iam:** add convenience method `inOrganization` to ArnPrincipal ([#20109](https://github.com/aws/aws-cdk/issues/20109)) ([c545bfe](https://github.com/aws/aws-cdk/commit/c545bfe2a3ccb53fa5ae2eb725a1696677703c0a)), closes [/github.com/aws/aws-cdk/pull/19975#discussion_r857385168](https://github.com/aws//github.com/aws/aws-cdk/pull/19975/issues/discussion_r857385168) [#19975](https://github.com/aws/aws-cdk/issues/19975)
14+
* **lambda:** `function.addAlias()` simplifies Alias creation ([#20034](https://github.com/aws/aws-cdk/issues/20034)) ([a79bc47](https://github.com/aws/aws-cdk/commit/a79bc47aaa6737628562c251e2f1990b2c7b88ef))
15+
* **rds:** add secret rotation to `DatabaseClusterFromSnapshot` ([#20020](https://github.com/aws/aws-cdk/issues/20020)) ([abc3502](https://github.com/aws/aws-cdk/commit/abc3502eef9b1b950f4e9d2c3f5f44b7e2f6476d)), closes [#12877](https://github.com/aws/aws-cdk/issues/12877)
16+
17+
18+
### Bug Fixes
19+
20+
* **lambda:** grant invoke twice with different principals ([#20174](https://github.com/aws/aws-cdk/issues/20174)) ([bb4c950](https://github.com/aws/aws-cdk/commit/bb4c9506c7395fc3c84725fb8e6054ac23ca2bf7))
21+
* **ubergen:** expose exports in core module for v2 ([#20176](https://github.com/aws/aws-cdk/issues/20176)) ([fc2cd48](https://github.com/aws/aws-cdk/commit/fc2cd48a3aabaf0d5214b322794c6a49d9c700c9)), closes [#19773](https://github.com/aws/aws-cdk/issues/19773)
22+
523
## [1.154.0](https://github.com/aws/aws-cdk/compare/v1.153.1...v1.154.0) (2022-04-27)
624

725

packages/@aws-cdk/aws-cloudwatch/README.md

+22
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,28 @@ dashboard.addWidgets(new cloudwatch.LogQueryWidget({
501501
}));
502502
```
503503

504+
### Custom widget
505+
506+
A `CustomWidget` shows the result of an AWS Lambda function:
507+
508+
```ts
509+
declare const dashboard: cloudwatch.Dashboard;
510+
511+
// Import or create a lambda function
512+
const fn = lambda.Function.fromFunctionArn(
513+
dashboard,
514+
'Function',
515+
'arn:aws:lambda:us-east-1:123456789012:function:MyFn',
516+
);
517+
518+
dashboard.addWidgets(new cloudwatch.CustomWidget({
519+
functionArn: fn.functionArn,
520+
title: 'My lambda baked widget',
521+
}));
522+
```
523+
524+
You can learn more about custom widgets in the [Amazon Cloudwatch User Guide](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/add_custom_widget_dashboard.html).
525+
504526
### Dashboard Layout
505527

506528
The widgets on a dashboard are visually laid out in a grid that is 24 columns

packages/@aws-cdk/aws-cloudwatch/lib/graph.ts

+91
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,97 @@ export class SingleValueWidget extends ConcreteWidget {
368368
}
369369
}
370370

371+
/**
372+
* The properties for a CustomWidget
373+
*/
374+
export interface CustomWidgetProps {
375+
/**
376+
* The Arn of the AWS Lambda function that returns HTML or JSON that will be displayed in the widget
377+
*/
378+
readonly functionArn: string;
379+
380+
/**
381+
* Width of the widget, in a grid of 24 units wide
382+
*
383+
* @default 6
384+
*/
385+
readonly width?: number;
386+
387+
/**
388+
* Height of the widget
389+
*
390+
* @default - 6 for Alarm and Graph widgets.
391+
* 3 for single value widgets where most recent value of a metric is displayed.
392+
*/
393+
readonly height?: number;
394+
395+
/**
396+
* The title of the widget
397+
*/
398+
readonly title: string;
399+
400+
/**
401+
* Update the widget on refresh
402+
*
403+
* @default true
404+
*/
405+
readonly updateOnRefresh?: boolean;
406+
407+
/**
408+
* Update the widget on resize
409+
*
410+
* @default true
411+
*/
412+
readonly updateOnResize?: boolean;
413+
414+
/**
415+
* Update the widget on time range change
416+
*
417+
* @default true
418+
*/
419+
readonly updateOnTimeRangeChange?: boolean;
420+
421+
/**
422+
* Parameters passed to the lambda function
423+
*
424+
* @default - no parameters are passed to the lambda function
425+
*/
426+
readonly params?: any;
427+
}
428+
429+
/**
430+
* A CustomWidget shows the result of a AWS lambda function
431+
*/
432+
export class CustomWidget extends ConcreteWidget {
433+
434+
private readonly props: CustomWidgetProps;
435+
436+
public constructor(props: CustomWidgetProps) {
437+
super(props.width ?? 6, props.height ?? 6);
438+
this.props = props;
439+
}
440+
441+
public toJson(): any[] {
442+
return [{
443+
type: 'custom',
444+
width: this.width,
445+
height: this.height,
446+
x: this.x,
447+
y: this.y,
448+
properties: {
449+
endpoint: this.props.functionArn,
450+
params: this.props.params,
451+
title: this.props.title,
452+
updateOn: {
453+
refresh: this.props.updateOnRefresh ?? true,
454+
resize: this.props.updateOnResize ?? true,
455+
timeRange: this.props.updateOnTimeRangeChange ?? true,
456+
},
457+
},
458+
}];
459+
}
460+
}
461+
371462
/**
372463
* Horizontal annotation to be added to a graph
373464
*/

packages/@aws-cdk/aws-cloudwatch/test/alarm-and-dashboard.integ.snapshot/aws-cdk-cloudwatch-alarms.template.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
"QueueName"
117117
]
118118
},
119-
"\"]],\"singleValueFullPrecision\":true}}]}"
119+
"\"]],\"singleValueFullPrecision\":true}},{\"type\":\"custom\",\"width\":6,\"height\":6,\"x\":0,\"y\":56,\"properties\":{\"endpoint\":\"arn:aws:lambda:us-west-2:123456789012:function:my-function\",\"title\":\"My custom alarm\",\"updateOn\":{\"refresh\":true,\"resize\":true,\"timeRange\":true}}}]}"
120120
]
121121
]
122122
},

packages/@aws-cdk/aws-cloudwatch/test/alarm-and-dashboard.integ.snapshot/tree.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
"QueueName"
163163
]
164164
},
165-
"\"]],\"singleValueFullPrecision\":true}}]}"
165+
"\"]],\"singleValueFullPrecision\":true}},{\"type\":\"custom\",\"width\":6,\"height\":6,\"x\":0,\"y\":56,\"properties\":{\"endpoint\":\"arn:aws:lambda:us-west-2:123456789012:function:my-function\",\"title\":\"My custom alarm\",\"updateOn\":{\"refresh\":true,\"resize\":true,\"timeRange\":true}}}]}"
166166
]
167167
]
168168
},

packages/@aws-cdk/aws-cloudwatch/test/graphs.test.ts

+66-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Duration, Stack } from '@aws-cdk/core';
2-
import { Alarm, AlarmWidget, Color, GraphWidget, GraphWidgetView, LegendPosition, LogQueryWidget, Metric, Shading, SingleValueWidget, LogQueryVisualizationType } from '../lib';
2+
import { Alarm, AlarmWidget, Color, GraphWidget, GraphWidgetView, LegendPosition, LogQueryWidget, Metric, Shading, SingleValueWidget, LogQueryVisualizationType, CustomWidget } from '../lib';
33

44
describe('Graphs', () => {
55
test('add stacked property to graphs', () => {
@@ -348,6 +348,71 @@ describe('Graphs', () => {
348348

349349
});
350350

351+
test('custom widget basic', () => {
352+
// GIVEN
353+
const stack = new Stack();
354+
355+
// WHEN
356+
const widget = new CustomWidget({
357+
functionArn: 'arn:aws:lambda:us-east-1:123456789:function:customwidgetfunction',
358+
title: 'CustomWidget',
359+
});
360+
361+
// THEN
362+
expect(stack.resolve(widget.toJson())).toEqual([{
363+
type: 'custom',
364+
width: 6,
365+
height: 6,
366+
properties: {
367+
title: 'CustomWidget',
368+
endpoint: 'arn:aws:lambda:us-east-1:123456789:function:customwidgetfunction',
369+
updateOn: {
370+
refresh: true,
371+
resize: true,
372+
timeRange: true,
373+
},
374+
},
375+
}]);
376+
});
377+
378+
test('custom widget full config', () => {
379+
// GIVEN
380+
const stack = new Stack();
381+
382+
// WHEN
383+
const widget = new CustomWidget({
384+
functionArn: 'arn:aws:lambda:us-east-1:123456789:function:customwidgetfunction',
385+
title: 'CustomWidget',
386+
height: 1,
387+
width: 1,
388+
params: {
389+
any: 'param',
390+
},
391+
updateOnRefresh: false,
392+
updateOnResize: false,
393+
updateOnTimeRangeChange: false,
394+
});
395+
396+
// THEN
397+
expect(stack.resolve(widget.toJson())).toEqual([{
398+
type: 'custom',
399+
width: 1,
400+
height: 1,
401+
properties: {
402+
title: 'CustomWidget',
403+
endpoint: 'arn:aws:lambda:us-east-1:123456789:function:customwidgetfunction',
404+
params: {
405+
any: 'param',
406+
},
407+
updateOn: {
408+
refresh: false,
409+
resize: false,
410+
timeRange: false,
411+
},
412+
},
413+
}]);
414+
});
415+
351416
test('add annotations to graph', () => {
352417
// WHEN
353418
const stack = new Stack();

packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.expected.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
"QueueName"
117117
]
118118
},
119-
"\"]],\"singleValueFullPrecision\":true}}]}"
119+
"\"]],\"singleValueFullPrecision\":true}},{\"type\":\"custom\",\"width\":6,\"height\":6,\"x\":0,\"y\":56,\"properties\":{\"endpoint\":\"arn:aws:lambda:us-west-2:123456789012:function:my-function\",\"title\":\"My custom alarm\",\"updateOn\":{\"refresh\":true,\"resize\":true,\"timeRange\":true}}}]}"
120120
]
121121
]
122122
},

packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.ts

+4
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,9 @@ dashboard.addWidgets(new cloudwatch.SingleValueWidget({
102102
metrics: [sentMessageSizeMetric],
103103
fullPrecision: true,
104104
}));
105+
dashboard.addWidgets(new cloudwatch.CustomWidget({
106+
title: 'My custom alarm',
107+
functionArn: 'arn:aws:lambda:us-west-2:123456789012:function:my-function',
108+
}));
105109

106110
app.synth();

packages/@aws-cdk/aws-ec2/lib/instance-types.ts

+10
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,16 @@ export enum InstanceClass {
452452
*/
453453
I3EN = 'i3en',
454454

455+
/**
456+
* I/O-optimized instances with local NVME drive powered by Intel Xeon Scalable processors (code named Ice Lake), 4th generation
457+
*/
458+
IO4_INTEL = 'i4i',
459+
460+
/**
461+
* I/O-optimized instances with local NVME drive powered by Intel Xeon Scalable processors (code named Ice Lake), 4th generation
462+
*/
463+
I4I = 'i4i',
464+
455465
/**
456466
* Storage optimized instances powered by Graviton2 processor, 4th generation
457467
*/

packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/lambda-target.integ.snapshot/TestStack.template.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@
445445
"TargetType": "lambda"
446446
},
447447
"DependsOn": [
448-
"FunInvokeServicePrincipalelasticloadbalancingamazonawscomD2CAC0C4"
448+
"FunInvoke2UTWxhlfyqbT5FTn5jvgbLgjFfJwzswGk55DU1HY1CA1AAFB"
449449
]
450450
},
451451
"FunServiceRole3CC876D7": {
@@ -498,7 +498,7 @@
498498
"FunServiceRole3CC876D7"
499499
]
500500
},
501-
"FunInvokeServicePrincipalelasticloadbalancingamazonawscomD2CAC0C4": {
501+
"FunInvoke2UTWxhlfyqbT5FTn5jvgbLgjFfJwzswGk55DU1HY1CA1AAFB": {
502502
"Type": "AWS::Lambda::Permission",
503503
"Properties": {
504504
"Action": "lambda:InvokeFunction",
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"17.0.0"}
1+
{"version":"18.0.0"}

packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/lambda-target.integ.snapshot/integ.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"version": "18.0.0",
33
"testCases": {
4-
"aws-elasticloadbalancingv2-targets/test/integ.lambda-target": {
4+
"integ.lambda-target": {
55
"stacks": [
66
"TestStack"
77
],

packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/lambda-target.integ.snapshot/manifest.json

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "17.0.0",
2+
"version": "18.0.0",
33
"artifacts": {
44
"Tree": {
55
"type": "cdk:tree",
@@ -177,10 +177,19 @@
177177
"data": "FunA2CCED21"
178178
}
179179
],
180-
"/TestStack/Fun/InvokeServicePrincipal(elasticloadbalancing.amazonaws.com)": [
180+
"/TestStack/Fun/Invoke2UTWxhlfyqbT5FTn--5jvgbLgj+FfJwzswGk55DU1H--Y=": [
181181
{
182182
"type": "aws:cdk:logicalId",
183-
"data": "FunInvokeServicePrincipalelasticloadbalancingamazonawscomD2CAC0C4"
183+
"data": "FunInvoke2UTWxhlfyqbT5FTn5jvgbLgjFfJwzswGk55DU1HY1CA1AAFB"
184+
}
185+
],
186+
"FunInvokeServicePrincipalelasticloadbalancingamazonawscomD2CAC0C4": [
187+
{
188+
"type": "aws:cdk:logicalId",
189+
"data": "FunInvokeServicePrincipalelasticloadbalancingamazonawscomD2CAC0C4",
190+
"trace": [
191+
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
192+
]
184193
}
185194
]
186195
},

packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/lambda-target.integ.snapshot/tree.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -850,9 +850,9 @@
850850
"version": "0.0.0"
851851
}
852852
},
853-
"InvokeServicePrincipal(elasticloadbalancing.amazonaws.com)": {
854-
"id": "InvokeServicePrincipal(elasticloadbalancing.amazonaws.com)",
855-
"path": "TestStack/Fun/InvokeServicePrincipal(elasticloadbalancing.amazonaws.com)",
853+
"Invoke2UTWxhlfyqbT5FTn--5jvgbLgj+FfJwzswGk55DU1H--Y=": {
854+
"id": "Invoke2UTWxhlfyqbT5FTn--5jvgbLgj+FfJwzswGk55DU1H--Y=",
855+
"path": "TestStack/Fun/Invoke2UTWxhlfyqbT5FTn--5jvgbLgj+FfJwzswGk55DU1H--Y=",
856856
"attributes": {
857857
"aws:cdk:cloudformation:type": "AWS::Lambda::Permission",
858858
"aws:cdk:cloudformation:props": {

0 commit comments

Comments
 (0)