-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(route53): support for scoping down domain names in IHostedZone.g…
…rantDelegation() Adds a backwards compatible parameter to `IHostedZone.grantDelegation()` in order to restrict the `NS` records with `UPSERT`/`DELETE` access.
- Loading branch information
Showing
11 changed files
with
186 additions
and
17 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
...rk-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/integ.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
packages/aws-cdk-lib/aws-route53/lib/delegation-grant-names.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Limit the delegation grant to a set of domain names using the IAM | ||
* `route53:ChangeResourceRecordSetsNormalizedRecordNames` context key. | ||
*/ | ||
export abstract class DelegationGrantNames { | ||
/** | ||
* Match the domain names using the IAM `StringEquals` condition. | ||
* | ||
* @param names List of allowed record names. | ||
*/ | ||
public static ofEquals(...names: string[]): DelegationGrantNames { | ||
return new (class extends DelegationGrantNames { | ||
public _equals() { | ||
return names; | ||
} | ||
})(); | ||
} | ||
|
||
/** | ||
* Match the domain names using the IAM `StringLike` condition. | ||
* | ||
* @param names List of allowed record names. | ||
*/ | ||
public static ofLike(...names: string[]): DelegationGrantNames { | ||
return new (class extends DelegationGrantNames { | ||
public _like() { | ||
return names; | ||
} | ||
})(); | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
public _equals(): string[] | null { | ||
return null; | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
public _like(): string[] | null { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/aws-cdk-lib/aws-route53/test/delegation-grant-names.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { DelegationGrantNames } from '../lib/delegation-grant-names'; | ||
|
||
describe('delegation-grant-names', () => { | ||
const NAMES = ['name-1', 'name-2']; | ||
|
||
test('ofEquals() creates instance whose _equals() is not null', () => { | ||
// WHEN | ||
const actual = DelegationGrantNames.ofEquals(...NAMES); | ||
|
||
// THEN | ||
expect(actual._equals()).toStrictEqual(NAMES); | ||
expect(actual._like()).toBeNull(); | ||
}); | ||
|
||
test('ofLike() creates instance whose _like() is not null', () => { | ||
// WHEN | ||
const actual = DelegationGrantNames.ofLike(...NAMES); | ||
|
||
// THEN | ||
expect(actual._equals()).toBeNull(); | ||
expect(actual._like()).toStrictEqual(NAMES); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters