-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cognito): add analyticsConfiguration to UserPoolClient #32862
Open
ren-yamanashi
wants to merge
38
commits into
aws:main
Choose a base branch
from
ren-yamanashi:32837-feat-add-analytics-configuration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,374
−1
Open
Changes from 5 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
d4ba257
feat: add `analyticsConfiguration` to UserPoolClient
ren-yamanashi 2444316
feat: change property name
ren-yamanashi 06842c4
feat: add unit test
ren-yamanashi 012183d
docs: add documents
ren-yamanashi 67b914f
feat: change method name
ren-yamanashi 6531be3
feat: add integ test
ren-yamanashi 73ca9d9
feat: update unit test
ren-yamanashi 3c7a594
chore: add jsdoc comment
ren-yamanashi 0dcb1e2
docs: update README.md
ren-yamanashi c31198e
feat: update integ test
ren-yamanashi 114fa85
Merge branch 'main' of https://github.com/aws/aws-cdk into 32837-feat…
ren-yamanashi 228177a
feat: update jsDoc
ren-yamanashi 8319091
Merge branch 'main' of https://github.com/aws/aws-cdk into 32837-feat…
ren-yamanashi 9d26e09
feat: update integ test
ren-yamanashi 080d156
feat: update integ test
ren-yamanashi 0bc7aac
Merge branch 'main' of https://github.com/aws/aws-cdk into 32837-feat…
ren-yamanashi 415929d
feat: update integ test
ren-yamanashi 407ee7e
feat: implementation modification at user-pool-client.ts
ren-yamanashi c12092d
test: fix test
ren-yamanashi 47e8800
test: update unit test
ren-yamanashi 73ddec4
docs: update README.md
ren-yamanashi bed1061
docs: update README.md
ren-yamanashi 91569e3
test: update integ test
ren-yamanashi 73b368c
Merge branch 'main' of https://github.com/aws/aws-cdk into 32837-feat…
ren-yamanashi b1098de
docs: update README.md
ren-yamanashi 436a666
docs: update README.md
ren-yamanashi af90b5c
feat: change property name
ren-yamanashi 4c548c2
feat: change import order
ren-yamanashi 0cf0934
feat: update property type
ren-yamanashi 2804b8c
test: update integ test
ren-yamanashi 5959b3e
docs: update README.md
ren-yamanashi 2c82f2e
Merge branch 'main' of https://github.com/aws/aws-cdk into 32837-feat…
ren-yamanashi 03948d8
test: update integ test
ren-yamanashi f16fa90
test: update integ test
ren-yamanashi 0c03d77
test: update integ test
ren-yamanashi 683ddf0
Merge branch 'main' of https://github.com/aws/aws-cdk into 32837-feat…
ren-yamanashi a3904fd
test: update integ test
ren-yamanashi 5ca76ad
Merge branch 'main' of https://github.com/aws/aws-cdk into 32837-feat…
ren-yamanashi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -353,6 +353,45 @@ export interface UserPoolClientProps extends UserPoolClientOptions { | |
* The UserPool resource this client will have access to | ||
*/ | ||
readonly userPool: IUserPool; | ||
|
||
/** | ||
* The analytics configuration for this client. | ||
*/ | ||
readonly analytics?: AnalyticsConfiguration; | ||
} | ||
|
||
/** | ||
* The settings for Amazon Pinpoint analytics configuration. | ||
* | ||
* With an analytics configuration, your application can collect user-activity metrics for user notifications with a Amazon Pinpoint campaign. | ||
* | ||
* Amazon Pinpoint isn't available in all AWS Regions. For a list of available Regions, see [Amazon Cognito and Amazon Pinpoint Region availability](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-pinpoint-integration.html#cognito-user-pools-find-region-mappings). | ||
*/ | ||
export interface AnalyticsConfiguration { | ||
/** | ||
* The Amazon Resource Name (ARN) of an Amazon Pinpoint project that you want to connect to your user pool app client. | ||
*/ | ||
readonly applicationArn?: string; | ||
|
||
/** | ||
* Your Amazon Pinpoint project ID. | ||
*/ | ||
readonly applicationId?: string; | ||
|
||
/** | ||
* The [external ID](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html) of the role that Amazon Cognito assumes to send analytics data to Amazon Pinpoint. | ||
*/ | ||
readonly externalId?: string; | ||
|
||
/** | ||
* The ARN of an AWS Identity and Access Management role that has the permissions required for Amazon Cognito to publish events to Amazon Pinpoint analytics. | ||
*/ | ||
readonly roleArn?: string; | ||
|
||
/** | ||
* If `UserDataShared` is `true` , Amazon Cognito includes user data in the events that it publishes to Amazon Pinpoint analytics. | ||
*/ | ||
readonly userDataShared?: boolean; | ||
} | ||
|
||
/** | ||
|
@@ -447,6 +486,10 @@ export class UserPoolClient extends Resource implements IUserPoolClient { | |
throw new Error('Cannot activate enablePropagateAdditionalUserContextData in an app client without a client secret.'); | ||
} | ||
|
||
if (props.analytics) { | ||
this.validateAnalytics(props.analytics); | ||
} | ||
|
||
this._generateSecret = props.generateSecret; | ||
this.userPool = props.userPool; | ||
|
||
|
@@ -467,6 +510,7 @@ export class UserPoolClient extends Resource implements IUserPoolClient { | |
writeAttributes: props.writeAttributes?.attributes(), | ||
enableTokenRevocation: props.enableTokenRevocation, | ||
enablePropagateAdditionalUserContextData: props.enablePropagateAdditionalUserContextData, | ||
analyticsConfiguration: props.analytics, | ||
}); | ||
this.configureAuthSessionValidity(resource, props); | ||
this.configureTokenValidity(resource, props); | ||
|
@@ -618,4 +662,13 @@ export class UserPoolClient extends Resource implements IUserPoolClient { | |
throw new Error(`${name}: Must be a duration between ${min.toHumanString()} and ${max.toHumanString()} (inclusive); received ${value.toHumanString()}.`); | ||
} | ||
} | ||
|
||
private validateAnalytics(analytics: AnalyticsConfiguration) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the CloudFormation expects either |
||
if (analytics.applicationArn && !Token.isUnresolved(analytics.applicationArn) && !analytics.applicationArn.startsWith('arn:')) { | ||
throw new Error(`applicationArn must be start with "arn:"; received ${analytics.applicationArn}`); | ||
} | ||
if (analytics.roleArn && !Token.isUnresolved(analytics.roleArn) && !analytics.roleArn.startsWith('arn:')) { | ||
throw new Error(`roleArn must be start with "arn:"; received ${analytics.roleArn}`); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting.