Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <[email protected]>
  • Loading branch information
gaiksaya committed Dec 21, 2023
1 parent b848b1f commit f519507
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/networking/vpc-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ export class NetworkStack extends Stack {

constructor(scope: Construct, id: string, props: VpcProps) {
super(scope, id, props);

let serverAccess: IPeer;
// Properties and context variables check
let cidrRange = `${props?.cidr ?? scope.node.tryGetContext('cidr')}`;
if (cidrRange == 'undefined'){
cidrRange = '10.0.0.0/16'
if (cidrRange === 'undefined') {
cidrRange = '10.0.0.0/16';
}
let vpcId = `${props?.vpcId ?? scope.node.tryGetContext('vpcId')}`;
let serverAccessType = `${props?.serverAccessType ?? scope.node.tryGetContext('serverAccessType')}`
let restrictServerAccessTo = `${props?.restrictServerAccessTo ?? scope.node.tryGetContext('restrictServerAccessTo')}`
let secGroupId = `${props?.securityGroupId ?? scope.node.tryGetContext('securityGroupId')}`
const vpcId = `${props?.vpcId ?? scope.node.tryGetContext('vpcId')}`;
const serverAccessType = `${props?.serverAccessType ?? scope.node.tryGetContext('serverAccessType')}`;
const restrictServerAccessTo = `${props?.restrictServerAccessTo ?? scope.node.tryGetContext('restrictServerAccessTo')}`;
const secGroupId = `${props?.securityGroupId ?? scope.node.tryGetContext('securityGroupId')}`;

if (typeof restrictServerAccessTo === 'undefined' || typeof serverAccessType === 'undefined') {
throw new Error('serverAccessType and restrictServerAccessTo parameters are required - eg: serverAccessType=ipv4 restrictServerAccessTo=10.10.10.10/32');

Check warning on line 50 in lib/networking/vpc-stack.ts

View check run for this annotation

Codecov / codecov/patch

lib/networking/vpc-stack.ts#L50

Added line #L50 was not covered by tests
Expand Down Expand Up @@ -74,7 +74,7 @@ export class NetworkStack extends Stack {
} else {
console.log('VPC provided, using existing');

Check warning on line 75 in lib/networking/vpc-stack.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
this.vpc = Vpc.fromLookup(this, 'opensearchClusterVpc', {
vpcId: vpcId,
vpcId,
});
}

Expand Down

0 comments on commit f519507

Please sign in to comment.