Skip to content

Commit

Permalink
Merge branch 'master' into dayjournal/add-sslSupportMethod
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Apr 7, 2022
2 parents 285f3ea + ccfbcf6 commit 0cb21d1
Show file tree
Hide file tree
Showing 427 changed files with 14,897 additions and 2,884 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
permissions:
pull-requests: write
steps:
- uses: hmarr/auto-approve-action@v2.1.0
- uses: hmarr/auto-approve-action@v2.2.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
22 changes: 22 additions & 0 deletions .github/workflows/issue-reprioritization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: issue-reprioritization
on:
schedule:
- cron: "0 0 * * 0"

jobs:
issue-reprioritization:
permissions:
issues: write
runs-on: ubuntu-latest
steps:
- uses: kaizen3031593/issue-reprioritization-manager@main
id: reprioritization-manager
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
original-label: p2
new-label: p1
reprioritization-threshold: 20
- uses: kaizen3031593/pr-triage-manager@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
on-pulls: ${{ steps.reprioritization-manager.outputs.linked-pulls }}
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@ For a detailed walkthrough, see the [tutorial](https://docs.aws.amazon.com/cdk/l
Install or update the [AWS CDK CLI] from npm (requires [Node.js ≥ 14.15.0](https://nodejs.org/download/release/latest-v14.x/)). We recommend using a version in [Active LTS](https://nodejs.org/en/about/releases/)

```console
$ npm i -g aws-cdk
npm i -g aws-cdk
```

(See [Manual Installation](./MANUAL_INSTALLATION.md) for installing the CDK from a signed .zip file).

Initialize a project:

```console
$ mkdir hello-cdk
$ cd hello-cdk
$ cdk init sample-app --language=typescript
mkdir hello-cdk
cd hello-cdk
cdk init sample-app --language=typescript
```

This creates a sample project looking like this:
Expand All @@ -113,7 +113,7 @@ export class HelloCdkStack extends cdk.Stack {
Deploy this to your account:

```console
$ cdk deploy
cdk deploy
```

Use the `cdk` command-line toolkit to interact with your project:
Expand Down
2 changes: 1 addition & 1 deletion design/aws-ecs/aws-ecs-priv-registry-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ DockerHub images are assumed public, however DockerHub also provides private rep

There's also no explicit way to specify images hosted outside of DockerHub, AWS, or your local machine. Customers hosting their own registries or using another registry host, like Quay.io or JFrog Artifactory, would need to be able to specify both the image URI and the registry credentials in order to pull their images down for ECS tasks.

Fundamentally, specifying images hosted in DockerHub or elsewhere works the same, because when passed an image URI vs. a plain (or namespaced) image name + tag, the Docker daemon does the right thing and tries to pull the image from the specified registery.
Fundamentally, specifying images hosted in DockerHub or elsewhere works the same, because when passed an image URI vs. a plain (or namespaced) image name + tag, the Docker daemon does the right thing and tries to pull the image from the specified registry.

Therefore, we should rename the existing `DockerHubImage` type be more generic and add the ability to optionally specify credentials.

Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appsync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ import * as opensearch from '@aws-cdk/aws-opensearchservice';

const user = new iam.User(this, 'User');
const domain = new opensearch.Domain(this, 'Domain', {
version: opensearch.EngineVersion.OPENSEARCH_1_1,
version: opensearch.EngineVersion.OPENSEARCH_1_2,
removalPolicy: RemovalPolicy.DESTROY,
fineGrainedAccessControl: { masterUserArn: user.userArn },
encryptionAtRest: { enabled: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"EncryptionAtRestOptions": {
"Enabled": true
},
"EngineVersion": "OpenSearch_1.1",
"EngineVersion": "OpenSearch_1.2",
"LogPublishingOptions": {},
"NodeToNodeEncryptionOptions": {
"Enabled": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const app = new cdk.App();
const stack = new cdk.Stack(app, 'appsync-opensearch');
const user = new User(stack, 'User');
const domain = new opensearch.Domain(stack, 'Domain', {
version: opensearch.EngineVersion.OPENSEARCH_1_1,
version: opensearch.EngineVersion.OPENSEARCH_1_2,
removalPolicy: cdk.RemovalPolicy.DESTROY,
fineGrainedAccessControl: {
masterUserArn: user.userArn,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MyNestedStack extends NestedStack {

if (props.subscriber) {
new lambda.Function(this, 'fn', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_14_X,
code: lambda.Code.fromInline('console.error("hi")'),
handler: 'index.handler',
environment: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class MyNestedStack extends NestedStack {

new lambda.Function(this, 'Handler', {
code: lambda.Code.fromAsset(path.join(__dirname, 'asset-directory-fixture')),
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'index.handler',
});
}
Expand Down
37 changes: 35 additions & 2 deletions packages/@aws-cdk/aws-cloudwatch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,13 @@ graph showing the Average statistic with an aggregation period of 5 minutes:

```ts
const cpuUtilization = new cloudwatch.MathExpression({
expression: "SEARCH('{AWS/EC2,InstanceId} MetricName=\"CPUUtilization\"', 'Average', 300)"
expression: "SEARCH('{AWS/EC2,InstanceId} MetricName=\"CPUUtilization\"', 'Average', 300)",

// Specifying '' as the label suppresses the default behavior
// of using the expression as metric label. This is especially appropriate
// when using expressions that return multiple time series (like SEARCH()
// or METRICS()), to show the labels of the retrieved metrics only.
label: '',
});
```

Expand Down Expand Up @@ -157,6 +163,33 @@ useful when embedding them in graphs, see below).
> happen to know the Metric you want to alarm on makes sense as a rate
> (`Average`) you can always choose to change the statistic.
### Labels

Metric labels are displayed in the legend of graphs that include the metrics.

You can use [dynamic labels](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html)
to show summary information about the displayed time series
in the legend. For example, if you use:

```ts
declare const fn: lambda.Function;

const minuteErrorRate = fn.metricErrors({
statistic: 'sum',
period: Duration.hours(1),

// Show the maximum hourly error count in the legend
label: '[max: ${MAX}] Lambda failure rate',
});
```

As the metric label, the maximum value in the visible range will
be shown next to the time series name in the graph's legend.

If the metric is a math expression producing more than one time series, the
maximum will be individually calculated and shown for each time series produce
by the math expression.

## Alarms

Alarms can be created on metrics in one of two ways. Either create an `Alarm`
Expand Down Expand Up @@ -308,7 +341,7 @@ dashboard.addWidgets(new cloudwatch.GraphWidget({
right: [errorCountMetric.with({
statistic: "average",
label: "Error rate",
color: cloudwatch.Color.GREEN
color: cloudwatch.Color.GREEN,
})]
}));
```
Expand Down
35 changes: 34 additions & 1 deletion packages/@aws-cdk/aws-cloudwatch/lib/metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ export interface CommonMetricOptions {

/**
* Label for this metric when added to a Graph in a Dashboard
*
* You can use [dynamic labels](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html)
* to show summary information about the entire displayed time series
* in the legend. For example, if you use:
*
* ```
* [max: ${MAX}] MyMetric
* ```
*
* As the metric label, the maximum value in the visible range will
* be shown next to the time series name in the graph's legend.
*
* @default - No label
*/
readonly label?: string;
Expand Down Expand Up @@ -127,7 +139,28 @@ export interface MetricOptions extends CommonMetricOptions {
*/
export interface MathExpressionOptions {
/**
* Label for this metric when added to a Graph in a Dashboard
* Label for this expression when added to a Graph in a Dashboard
*
* If this expression evaluates to more than one time series (for
* example, through the use of `METRICS()` or `SEARCH()` expressions),
* each time series will appear in the graph using a combination of the
* expression label and the individual metric label. Specify the empty
* string (`''`) to suppress the expression label and only keep the
* metric label.
*
* You can use [dynamic labels](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html)
* to show summary information about the displayed time series
* in the legend. For example, if you use:
*
* ```
* [max: ${MAX}] MyMetric
* ```
*
* As the metric label, the maximum value in the visible range will
* be shown next to the time series name in the graph's legend. If the
* math expression produces more than one time series, the maximum
* will be shown for each individual time series produce by this
* math expression.
*
* @default - Expression value is used as label
*/
Expand Down
14 changes: 10 additions & 4 deletions packages/@aws-cdk/aws-cloudwatch/lib/private/rendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,17 @@ function metricGraphJson(metric: IMetric, yAxis?: string, id?: string) {
if (yAxis !== 'left') { options.yAxis = yAxis; }
if (id) { options.id = id; }

// If math expressions don't have a label (or an ID), they'll render with an unelegant
// autogenerated id ("metric_alias0"). Our ids may in the future also be autogenerated,
// so if an ME doesn't have a label, use its toString() as the label (renders the expression).
if (options.visible !== false && options.expression && !options.label) {
options.label = metric.toString();
// Label may be '' or undefined.
//
// If undefined, we'll render the expression as the label, to suppress
// the default behavior of CW where it would render the metric
// id as label, which we (inelegantly) generate to be something like "metric_alias0".
//
// For array expressions (returning more than 1 TS) users may sometimes want to
// suppress the label completely. For those cases, we'll accept the empty string,
// and not render a label at all.
options.label = options.label === '' ? undefined : metric.toString();
}

const renderedOpts = dropUndefined(options);
Expand Down
21 changes: 21 additions & 0 deletions packages/@aws-cdk/aws-cloudwatch/test/metric-math.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,27 @@ describe('Metric Math', () => {
]);


});

test('passing an empty string as the label of a MathExpressions does not emit a label', () => {
const graph = new GraphWidget({
left: [
new MathExpression({
expression: 'a + e',
label: '',
usingMetrics: {
a,
},
}),
],
});

graphMetricsAre(graph, [
[{ expression: 'a + e' }],
['Test', 'ACount', { visible: false, id: 'a' }],
]);


});

test('can reuse identifiers in MathExpressions if metrics are the same', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const lambdaCode = lambda.Code.fromCfnParameters();
new lambda.Function(lambdaStack, 'Lambda', {
code: lambdaCode,
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_14_X,
});
// other resources that your Lambda needs, added to the lambdaStack...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@
]
},
"Handler": "index.handler",
"Runtime": "nodejs10.x"
"Runtime": "nodejs14.x"
},
"DependsOn": [
"LambdaFunServiceRoleDefaultPolicy217FED83",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const lambdaFun = new lambda.Function(stack, 'LambdaFun', {
};
`),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_14_X,
});
const lambdaStage = pipeline.addStage({ stageName: 'Lambda' });
lambdaStage.addAction(new cpactions.LambdaInvokeAction({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@
"Code": {
"ZipFile": "exports.handler = (event) => console.log(event);"
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"CustomFunctionServiceRoleD3F73B79",
"Arn"
]
},
"Runtime": "nodejs10.x"
"Handler": "index.handler",
"Runtime": "nodejs14.x"
},
"DependsOn": [
"CustomFunctionServiceRoleD3F73B79"
Expand Down Expand Up @@ -224,4 +224,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-config/test/integ.rule.lit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ConfigStack extends cdk.Stack {
const fn = new lambda.Function(this, 'CustomFunction', {
code: lambda.AssetCode.fromInline('exports.handler = (event) => console.log(event);'),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_14_X,
});

new config.CustomRule(this, 'Custom', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@
"Code": {
"ZipFile": "exports.handler = (event) => console.log(event);"
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"CustomFunctionServiceRoleD3F73B79",
"Arn"
]
},
"Runtime": "nodejs10.x"
"Handler": "index.handler",
"Runtime": "nodejs14.x"
},
"DependsOn": [
"CustomFunctionServiceRoleD3F73B79"
Expand Down Expand Up @@ -109,4 +109,4 @@
]
}
}
}
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-config/test/integ.scoped-rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const stack = new cdk.Stack(app, 'aws-cdk-config-rule-scoped-integ');
const fn = new lambda.Function(stack, 'CustomFunction', {
code: lambda.AssetCode.fromInline('exports.handler = (event) => console.log(event);'),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_14_X,
});

new config.CustomRule(stack, 'Custom', {
Expand Down
Loading

0 comments on commit 0cb21d1

Please sign in to comment.