Skip to content

Commit

Permalink
Merge branch 'main' into corymhall/lambda-sources/fix-queue
Browse files Browse the repository at this point in the history
  • Loading branch information
corymhall authored Sep 8, 2022
2 parents 87af50c + be65da6 commit e1764b2
Show file tree
Hide file tree
Showing 24 changed files with 2,247 additions and 108 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,7 @@ export class ListenerAction implements IListenerAction {
* Called when the action is being used in a listener
*/
public bind(scope: Construct, listener: IApplicationListener, associatingConstruct?: IConstruct) {
// Empty on purpose
Array.isArray(scope);
Array.isArray(listener);
Array.isArray(associatingConstruct);
this.next?.bind(scope, listener, associatingConstruct);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Metric } from '@aws-cdk/aws-cloudwatch';
import * as ec2 from '@aws-cdk/aws-ec2';
import { describeDeprecated, testDeprecated } from '@aws-cdk/cdk-build-tools';
import * as cdk from '@aws-cdk/core';
import { SecretValue } from '@aws-cdk/core';
import * as constructs from 'constructs';
import * as elbv2 from '../../lib';
import { FakeSelfRegisteringTarget } from '../helpers';
Expand Down Expand Up @@ -261,6 +262,53 @@ describe('tests', () => {
});
});

test('bind is called for all next targets', () => {
// GIVEN
const stack = new cdk.Stack();
const vpc = new ec2.Vpc(stack, 'Stack');
const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc });
const listener = lb.addListener('Listener', { port: 80 });
const fake = new FakeSelfRegisteringTarget(stack, 'FakeTG', vpc);
const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', {
vpc,
port: 80,
targets: [fake],
});

// WHEN
listener.addAction('first-action', {
action: elbv2.ListenerAction.authenticateOidc({
next: elbv2.ListenerAction.forward([group]),
issuer: 'dummy',
clientId: 'dummy',
clientSecret: SecretValue.unsafePlainText('dummy'),
tokenEndpoint: 'dummy',
userInfoEndpoint: 'dummy',
authorizationEndpoint: 'dummy',
}),
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupIngress', {
IpProtocol: 'tcp',
Description: 'Load balancer to target',
FromPort: 80,
ToPort: 80,
GroupId: {
'Fn::GetAtt': [
'FakeTGSG50E257DF',
'GroupId',
],
},
SourceSecurityGroupId: {
'Fn::GetAtt': [
'LBSecurityGroup8A41EA2B',
'GroupId',
],
},
});
});

testDeprecated('Can implicitly create target groups with and without conditions', () => {
// GIVEN
const stack = new cdk.Stack();
Expand Down
4 changes: 3 additions & 1 deletion packages/@aws-cdk/aws-neptune/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const cluster = new neptune.DatabaseCluster(this, 'Cluster', {
iamAuthentication: true, // Optional - will be automatically set if you call grantConnect().
});
const role = new iam.Role(this, 'DBRole', { assumedBy: new iam.AccountPrincipal(this.account) });
cluster.grantConnect(role); // Grant the role connection access to the DB.
cluster.grantConnect(role); // Grant the role neptune-db:* access to the DB.
```

## Customizing parameters
Expand Down Expand Up @@ -104,6 +104,8 @@ const cluster = new neptune.DatabaseCluster(this, 'Database', {
});
```

Note: if you want to use Neptune engine `1.2.0.0` or later, you need to specify the corresponding `engineVersion` prop to `neptune.DatabaseCluster` and `family` prop of `ParameterGroupFamily.NEPTUNE_1_2` to `neptune.ClusterParameterGroup` and `neptune.ParameterGroup`.

## Adding replicas

`DatabaseCluster` allows launching replicas along with the writer instance. This can be specified using the `instanceCount`
Expand Down
4 changes: 4 additions & 0 deletions packages/@aws-cdk/aws-neptune/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export class EngineVersion {
* Neptune engine version 1.1.1.0
*/
public static readonly V1_1_1_0 = new EngineVersion('1.1.1.0');
/**
* Neptune engine version 1.2.0.0
*/
public static readonly V1_2_0_0 = new EngineVersion('1.2.0.0');

/**
* Constructor for specifying a custom engine version
Expand Down
32 changes: 30 additions & 2 deletions packages/@aws-cdk/aws-neptune/lib/parameter-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@ import { IResource, Resource } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { CfnDBClusterParameterGroup, CfnDBParameterGroup } from './neptune.generated';

/**
* The DB parameter group family that a DB parameter group is compatible with
*/
export class ParameterGroupFamily {

/**
* Family used by Neptune engine versions before 1.2.0.0
*/
public static readonly NEPTUNE_1 = new ParameterGroupFamily('neptune1');
/**
* Family used by Neptune engine versions 1.2.0.0 and later
*/
public static readonly NEPTUNE_1_2 = new ParameterGroupFamily('neptune1.2');

/**
* Constructor for specifying a custom parameter group famil
* @param family the family of the parameter group Neptune
*/
public constructor(public readonly family: string) {}
}

/**
* Properties for a parameter group
*/
Expand All @@ -17,6 +38,13 @@ interface ParameterGroupPropsBase {
* The parameters in this parameter group
*/
readonly parameters: { [key: string]: string };

/**
* Parameter group family
*
* @default - NEPTUNE_1
*/
readonly family?: ParameterGroupFamily;
}

/**
Expand Down Expand Up @@ -81,7 +109,7 @@ export class ClusterParameterGroup extends Resource implements IClusterParameter
const resource = new CfnDBClusterParameterGroup(this, 'Resource', {
name: props.clusterParameterGroupName,
description: props.description || 'Cluster parameter group for neptune db cluster',
family: 'neptune1',
family: (props.family ?? ParameterGroupFamily.NEPTUNE_1).family,
parameters: props.parameters,
});

Expand Down Expand Up @@ -126,7 +154,7 @@ export class ParameterGroup extends Resource implements IParameterGroup {
const resource = new CfnDBParameterGroup(this, 'Resource', {
name: props.parameterGroupName,
description: props.description || 'Instance parameter group for neptune db instances',
family: 'neptune1',
family: (props.family ?? ParameterGroupFamily.NEPTUNE_1).family,
parameters: props.parameters,
});

Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-neptune/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"@aws-cdk/assertions": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/integ-runner": "0.0.0",
"@aws-cdk/integ-tests": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.5.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "21.0.0",
"files": {
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
"source": {
"path": "ClusterTestDefaultTestDeployAssert6A1BBA9D.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "21.0.0",
"files": {
"06bc77521a70e494cf9fb7d601f5111e19745b0ecde4b6ac42b311f1a19f8328": {
"source": {
"path": "aws-cdk-neptune-integ.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "06bc77521a70e494cf9fb7d601f5111e19745b0ecde4b6ac42b311f1a19f8328.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Loading

0 comments on commit e1764b2

Please sign in to comment.