Skip to content

Commit

Permalink
Merge branch 'master' into chaimber/lambda_perm_cond
Browse files Browse the repository at this point in the history
  • Loading branch information
BenChaimberg authored May 14, 2021
2 parents 84045fd + d82de05 commit 1a695e2
Show file tree
Hide file tree
Showing 29 changed files with 711 additions and 1,166 deletions.
4 changes: 3 additions & 1 deletion packages/@aws-cdk/aws-appsync/lib/data-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,14 @@ export class RdsDataSource extends BackedDataSource {
props.secretStore.grantRead(this);

// Change to grant with RDS grant becomes implemented

props.serverlessCluster.grantDataApiAccess(this);

Grant.addToPrincipal({
grantee: this,
actions: [
'rds-data:DeleteItems',
'rds-data:ExecuteSql',
'rds-data:ExecuteStatement',
'rds-data:GetItems',
'rds-data:InsertItems',
'rds-data:UpdateItems',
Expand Down
20 changes: 19 additions & 1 deletion packages/@aws-cdk/aws-appsync/test/appsync-rds.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,29 @@ describe('Rds Data Source configuration', () => {
Effect: 'Allow',
Resource: { Ref: 'AuroraSecret41E6E877' },
},
{
Action: [
'rds-data:BatchExecuteStatement',
'rds-data:BeginTransaction',
'rds-data:CommitTransaction',
'rds-data:ExecuteStatement',
'rds-data:RollbackTransaction',
],
Effect: 'Allow',
Resource: '*',
},
{
Action: [
'secretsmanager:GetSecretValue',
'secretsmanager:DescribeSecret',
],
Effect: 'Allow',
Resource: { Ref: 'AuroraClusterSecretAttachmentDB8032DA' },
},
{
Action: [
'rds-data:DeleteItems',
'rds-data:ExecuteSql',
'rds-data:ExecuteStatement',
'rds-data:GetItems',
'rds-data:InsertItems',
'rds-data:UpdateItems',
Expand Down
20 changes: 19 additions & 1 deletion packages/@aws-cdk/aws-cloudwatch/lib/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ export interface GraphWidgetProps extends MetricWidgetProps {
*/
readonly liveData?: boolean;


/**
* Display this metric
*
Expand All @@ -223,6 +222,23 @@ export interface GraphWidgetProps extends MetricWidgetProps {
* @default false
*/
readonly setPeriodToTimeRange?: boolean;

/**
* The default period for all metrics in this widget.
* The period is the length of time represented by one data point on the graph.
* This default can be overridden within each metric definition.
*
* @default cdk.Duration.seconds(300)
*/
readonly period?: cdk.Duration;

/**
* The default statistic to be displayed for each metric.
* This default can be overridden within the definition of each individual metric
*
* @default - The statistic for each metric is used
*/
readonly statistic?: string;
}

/**
Expand Down Expand Up @@ -287,6 +303,8 @@ export class GraphWidget extends ConcreteWidget {
legend: this.props.legendPosition !== undefined ? { position: this.props.legendPosition } : undefined,
liveData: this.props.liveData,
setPeriodToTimeRange: this.props.setPeriodToTimeRange,
period: this.props.period?.toSeconds(),
stat: this.props.statistic,
},
}];
}
Expand Down
31 changes: 30 additions & 1 deletion packages/@aws-cdk/aws-cloudwatch/test/test.graphs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Stack } from '@aws-cdk/core';
import { Duration, Stack } from '@aws-cdk/core';
import { Test } from 'nodeunit';
import { Alarm, AlarmWidget, Color, GraphWidget, GraphWidgetView, LegendPosition, LogQueryWidget, Metric, Shading, SingleValueWidget, LogQueryVisualizationType } from '../lib';

Expand Down Expand Up @@ -688,4 +688,33 @@ export = {

test.done();
},

'GraphWidget supports stat and period'(test: Test) {
// GIVEN
const stack = new Stack();
const widget = new GraphWidget({
left: [new Metric({ namespace: 'CDK', metricName: 'Test' })],
statistic: 'Average',
period: Duration.days(2),
});

// THEN
test.deepEqual(stack.resolve(widget.toJson()), [{
type: 'metric',
width: 6,
height: 6,
properties: {
view: 'timeSeries',
region: { Ref: 'AWS::Region' },
metrics: [
['CDK', 'Test'],
],
yAxis: {},
stat: 'Average',
period: 172800,
},
}]);

test.done();
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"Tags": [
{
"Key": "Name",
"Value": "aws-ecs-integ/Vpc"
"Value": "aws-ecs-integ-alb-fg-https/Vpc"
}
]
}
Expand All @@ -35,7 +35,7 @@
},
{
"Key": "Name",
"Value": "aws-ecs-integ/Vpc/PublicSubnet1"
"Value": "aws-ecs-integ-alb-fg-https/Vpc/PublicSubnet1"
}
]
}
Expand All @@ -49,7 +49,7 @@
"Tags": [
{
"Key": "Name",
"Value": "aws-ecs-integ/Vpc/PublicSubnet1"
"Value": "aws-ecs-integ-alb-fg-https/Vpc/PublicSubnet1"
}
]
}
Expand Down Expand Up @@ -87,7 +87,7 @@
"Tags": [
{
"Key": "Name",
"Value": "aws-ecs-integ/Vpc/PublicSubnet1"
"Value": "aws-ecs-integ-alb-fg-https/Vpc/PublicSubnet1"
}
]
}
Expand All @@ -107,7 +107,7 @@
"Tags": [
{
"Key": "Name",
"Value": "aws-ecs-integ/Vpc/PublicSubnet1"
"Value": "aws-ecs-integ-alb-fg-https/Vpc/PublicSubnet1"
}
]
}
Expand All @@ -132,7 +132,7 @@
},
{
"Key": "Name",
"Value": "aws-ecs-integ/Vpc/PublicSubnet2"
"Value": "aws-ecs-integ-alb-fg-https/Vpc/PublicSubnet2"
}
]
}
Expand All @@ -146,7 +146,7 @@
"Tags": [
{
"Key": "Name",
"Value": "aws-ecs-integ/Vpc/PublicSubnet2"
"Value": "aws-ecs-integ-alb-fg-https/Vpc/PublicSubnet2"
}
]
}
Expand Down Expand Up @@ -184,7 +184,7 @@
"Tags": [
{
"Key": "Name",
"Value": "aws-ecs-integ/Vpc/PublicSubnet2"
"Value": "aws-ecs-integ-alb-fg-https/Vpc/PublicSubnet2"
}
]
}
Expand All @@ -204,7 +204,7 @@
"Tags": [
{
"Key": "Name",
"Value": "aws-ecs-integ/Vpc/PublicSubnet2"
"Value": "aws-ecs-integ-alb-fg-https/Vpc/PublicSubnet2"
}
]
}
Expand All @@ -229,7 +229,7 @@
},
{
"Key": "Name",
"Value": "aws-ecs-integ/Vpc/PrivateSubnet1"
"Value": "aws-ecs-integ-alb-fg-https/Vpc/PrivateSubnet1"
}
]
}
Expand All @@ -243,7 +243,7 @@
"Tags": [
{
"Key": "Name",
"Value": "aws-ecs-integ/Vpc/PrivateSubnet1"
"Value": "aws-ecs-integ-alb-fg-https/Vpc/PrivateSubnet1"
}
]
}
Expand Down Expand Up @@ -291,7 +291,7 @@
},
{
"Key": "Name",
"Value": "aws-ecs-integ/Vpc/PrivateSubnet2"
"Value": "aws-ecs-integ-alb-fg-https/Vpc/PrivateSubnet2"
}
]
}
Expand All @@ -305,7 +305,7 @@
"Tags": [
{
"Key": "Name",
"Value": "aws-ecs-integ/Vpc/PrivateSubnet2"
"Value": "aws-ecs-integ-alb-fg-https/Vpc/PrivateSubnet2"
}
]
}
Expand Down Expand Up @@ -339,7 +339,7 @@
"Tags": [
{
"Key": "Name",
"Value": "aws-ecs-integ/Vpc"
"Value": "aws-ecs-integ-alb-fg-https/Vpc"
}
]
}
Expand Down Expand Up @@ -394,7 +394,7 @@
"myServiceLBSecurityGroupFE0ED608": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "Automatically created Security Group for ELB awsecsintegmyServiceLB1F7A535D",
"GroupDescription": "Automatically created Security Group for ELB awsecsintegalbfghttpsmyServiceLB8BEE3C49",
"SecurityGroupIngress": [
{
"CidrIp": "0.0.0.0/0",
Expand All @@ -416,7 +416,7 @@
}
}
},
"myServiceLBSecurityGrouptoawsecsintegmyServiceSecurityGroup8DAB521180B6703B07": {
"myServiceLBSecurityGrouptoawsecsintegalbfghttpsmyServiceSecurityGroup49C558AD803FB613FF": {
"Type": "AWS::EC2::SecurityGroupEgress",
"Properties": {
"GroupId": {
Expand Down Expand Up @@ -451,15 +451,15 @@
"LoadBalancerArn": {
"Ref": "myServiceLB168895E1"
},
"Port": 443,
"Protocol": "HTTPS",
"Certificates": [
{
"CertificateArn": {
"Ref": "myServiceCertificate152F9DDA"
}
}
]
],
"Port": 443,
"Protocol": "HTTPS"
}
},
"myServiceLBPublicListenerECSGroup17E9BBC1": {
Expand Down Expand Up @@ -513,8 +513,7 @@
"Type": "A",
"AliasTarget": {
"DNSName": {
"Fn::Join":
[
"Fn::Join": [
"",
[
"dualstack.",
Expand Down Expand Up @@ -589,7 +588,7 @@
"Arn"
]
},
"Family": "awsecsintegmyServiceTaskDefA3A33D18",
"Family": "awsecsintegalbfghttpsmyServiceTaskDefD8ABFBF2",
"Memory": "512",
"NetworkMode": "awsvpc",
"RequiresCompatibilities": [
Expand Down Expand Up @@ -709,7 +708,7 @@
"myServiceSecurityGroupC3B9D4E0": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "aws-ecs-integ/myService/Service/SecurityGroup",
"GroupDescription": "aws-ecs-integ-alb-fg-https/myService/Service/SecurityGroup",
"SecurityGroupEgress": [
{
"CidrIp": "0.0.0.0/0",
Expand All @@ -722,7 +721,7 @@
}
}
},
"myServiceSecurityGroupfromawsecsintegmyServiceLBSecurityGroupFA544FE5800A81885C": {
"myServiceSecurityGroupfromawsecsintegalbfghttpsmyServiceLBSecurityGroupA934AF89808E9FB7A3": {
"Type": "AWS::EC2::SecurityGroupIngress",
"Properties": {
"IpProtocol": "tcp",
Expand Down Expand Up @@ -767,4 +766,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { App, Stack } from '@aws-cdk/core';
import { ApplicationLoadBalancedFargateService } from '../../lib';

const app = new App();
const stack = new Stack(app, 'aws-ecs-integ');
const stack = new Stack(app, 'aws-ecs-integ-alb-fg-https');
const vpc = new Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new Cluster(stack, 'Cluster', { vpc });

Expand Down
Loading

0 comments on commit 1a695e2

Please sign in to comment.