Skip to content

Commit

Permalink
fix: unused lines
Browse files Browse the repository at this point in the history
  • Loading branch information
badmintoncryer committed Jan 26, 2024
1 parent e44f737 commit 660e616
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
16 changes: 13 additions & 3 deletions packages/aws-cdk-lib/aws-route53/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ To enable [IP-based routing](https://docs.aws.amazon.com/Route53/latest/Develope
```ts
declare const myZone: route53.HostedZone;

new route53.ARecord(this, 'ARecordIpBased1', {
const record1 = new route53.ARecord(this, 'ARecordIpBased1', {
zone: myZone,
recordName: 'test',
target: route53.RecordTarget.fromIpAddresses('1.2.3.4'),
cidrRoutingConfig: {
cidrList: ['192.168.1.0/24', '192.168.16.0/20'],
Expand All @@ -191,8 +192,17 @@ new route53.ARecord(this, 'ARecordIpBased1', {
});

// You can also add a new Location to an existing CidrCollection


// Ensure all locations for the same record set name and type are part of the same CIDR collection to guarantee consistent routing.
const record2 = new route53.ARecord(this, 'ARecordIpBased2', {
zone: myZone,
recordName: 'test',
target: route53.RecordTarget.fromIpAddresses('2.3.4.5'),
cidrRoutingConfig: {
cidrList: ['192.168.2.0/24', '192.168.48.0/20'],
locationName: 'LondonServer',
collection: record1.cidrCollection,
},
});
```

To specify a unique identifier to differentiate among multiple resource record sets that have the same combination of name and type, use the `setIdentifier` parameter:
Expand Down
13 changes: 7 additions & 6 deletions packages/aws-cdk-lib/aws-route53/lib/record-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import * as iam from '../../aws-iam';
import { CustomResource, Duration, IResource, Names, RemovalPolicy, Resource, Token } from '../../core';
import { CrossAccountZoneDelegationProvider } from '../../custom-resource-handlers/dist/aws-route53/cross-account-zone-delegation-provider.generated';
import { DeleteExistingRecordSetProvider } from '../../custom-resource-handlers/dist/aws-route53/delete-existing-record-set-provider.generated';
import { create } from '../../../../tools/@aws-cdk/eslint-plugin/lib/rules/no-literal-partition';
import { findResources } from '../../assertions/lib/private/resources';

const CROSS_ACCOUNT_ZONE_DELEGATION_RESOURCE_TYPE = 'Custom::CrossAccountZoneDelegation';
const DELETE_EXISTING_RECORD_SET_RESOURCE_TYPE = 'Custom::DeleteExistingRecordSet';
Expand Down Expand Up @@ -210,7 +208,7 @@ export interface RecordSetOptions {
*
* @default - Do not set IP based routing
*/
readonly cidrRoutingConfig?: CidrRoutingConfig;
readonly cidrRoutingConfig?: ICidrRoutingConfig;

/**
* The Amazon EC2 Region where you created the resource that this resource record set refers to.
Expand Down Expand Up @@ -241,7 +239,7 @@ export interface RecordSetOptions {
/**
* Configuration for IP-based routing.
*/
export interface CidrRoutingConfig {
export interface ICidrRoutingConfig {
/**
* List of CIDR blocks.
*
Expand Down Expand Up @@ -333,11 +331,11 @@ export interface RecordSetProps extends RecordSetOptions {
*/
export class RecordSet extends Resource implements IRecordSet {
public readonly domainName: string;
public _cidrCollection: CfnCidrCollection | undefined;
private readonly geoLocation?: GeoLocation;
private readonly weight?: number;
private readonly region?: string;
private cidrLocation?: CfnRecordSet.CidrRoutingConfigProperty;
private _cidrCollection: CfnCidrCollection | undefined;

constructor(scope: Construct, id: string, props: RecordSetProps) {
super(scope, id);
Expand Down Expand Up @@ -455,11 +453,14 @@ export class RecordSet extends Resource implements IRecordSet {
}
}

/**
* The Cidr Collection associated with this record.
*/
public get cidrCollection(): CfnCidrCollection | undefined {
return this._cidrCollection;
}

private configureIpBasedRouting(cidrRoutingConfig: CidrRoutingConfig): void {
private configureIpBasedRouting(cidrRoutingConfig: ICidrRoutingConfig): void {
const locationName = cidrRoutingConfig.locationName ?? Names.uniqueResourceName(this, { maxLength: 8 }).substring(0, 16);
const cidrList = cidrRoutingConfig.cidrList;
const isDefaultLocation = locationName === '*';
Expand Down

0 comments on commit 660e616

Please sign in to comment.