Skip to content

Commit 9449f9c

Browse files
authored
fix(cognito-identitypool-alpha): remove RoleAttachment construct (#33305)
### Issue # (if applicable) Closes #23449 ### Reason for this change What we had assumed was a bug from the service team had been investigated and revealed to be expected behaviour: an `IdentityPool` can only have a single `IdentityPoolRoleAttachment` attached to it. This went against our initial assumptions that were supported by previously-written code, which was that multiple of these attachments could be created. As such, to ensure clarity and prevent ambiguity, this library will be updated to abstract away the role attachment, as one is already created by default. ### Description of changes * Deleted `identitypool-role-attachment.ts`, moving or deleting its contents: * Removed `IdentityPoolRoleAttachment` class * `IdentityPoolRoleAttachment.configureRoleMappings()` function has been moved inside of `IdentityPool` * Removed `IIdentityPoolRoleAttachment` and `IdentityPoolRoleAttachmentProps` interfaces * Moved `IdentityPoolRoleMapping`, `RoleMatchingMatchType`, and `RoleMappingRule` to `lib/identitypool.ts` * `IdentityPool`'s `private roleAttachmentCount` attribute has been removed, as it never should have been there to begin with * `IdentityPool.addRoleMappings()` method has been removed * The logic for creating a default role attachment has been altered to create the L1 instead of the L2. **This will trigger redeployments for all users of the `IdentityPool` construct.** * Unit tests have been tweaked to reflect this new behaviour ### Describe any new or updated permissions being added N/A ### Description of how you validated changes `yarn test` runs and the integ test snapshot was updated via `yarn integ`. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) BREAKING CHANGE: The `IdentityPoolRoleAttachment` construct and `IdentityPool.addRoleMappings()` function will no longer exist. This is to disambiguate that only one role attachment can exist per Identity Pool. If you are using the `IdentityPool` construct, this change will trigger a redeployment. If you need to add role mappings, please do so when the `IdentityPool` is created. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent fdd451c commit 9449f9c

15 files changed

+691
-493
lines changed

packages/@aws-cdk/aws-cognito-identitypool-alpha/README.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -302,19 +302,6 @@ new IdentityPool(this, 'myidentitypool', {
302302
});
303303
```
304304

305-
Role mappings can also be added after instantiation with the Identity Pool's `addRoleMappings` method:
306-
307-
```ts
308-
import { IdentityPoolRoleMapping } from '@aws-cdk/aws-cognito-identitypool-alpha';
309-
310-
declare const identityPool: IdentityPool;
311-
declare const myAddedRoleMapping1: IdentityPoolRoleMapping;
312-
declare const myAddedRoleMapping2: IdentityPoolRoleMapping;
313-
declare const myAddedRoleMapping3: IdentityPoolRoleMapping;
314-
315-
identityPool.addRoleMappings(myAddedRoleMapping1, myAddedRoleMapping2, myAddedRoleMapping3);
316-
```
317-
318305
#### Provider Urls
319306

320307
Role mappings must be associated with the url of an Identity Provider which can be supplied

packages/@aws-cdk/aws-cognito-identitypool-alpha/lib/identitypool-role-attachment.ts

Lines changed: 0 additions & 211 deletions
This file was deleted.

0 commit comments

Comments
 (0)