-
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
base: main
Are you sure you want to change the base?
feat(cognito): add analyticsConfiguration to UserPoolClient #32862
Conversation
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.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #32862 +/- ##
=======================================
Coverage 81.38% 81.38%
=======================================
Files 222 222
Lines 13695 13695
Branches 2412 2412
=======================================
Hits 11145 11145
Misses 2271 2271
Partials 279 279
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…-add-analytics-configuration
…-add-analytics-configuration
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.
hi @ren-yamanashi , thank you for this contribution, could you please adjust the validation and tests as described in the comments? thank you in advance!
@@ -618,4 +667,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 comment
The reason will be displayed to describe this comment to others. Learn more.
the CloudFormation expects either ApplicationArn
or all of ApplicationId
, ExternalId
and RoleArn
to be provided. Could you please adjust the validation for this?
// resources: [pinpointApp.attrArn], | ||
// })); | ||
|
||
new UserPoolClient(stack, 'Client', { |
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.
cloud you please provide more test cases for 1) providing only ApplicationArn
and using the Cognito's service role and 2) providing all of ApplicationId
, ExternalId
and RoleArn
?
Thank you comment ! I will adjust the PR content based on your comment and #32865 🙏. |
…-add-analytics-configuration
…-add-analytics-configuration
If you specify the `applicationArn` property, do not specify the `applicationId`, `externalId`, or `roleArn` properties. | ||
|
||
```ts | ||
import * as pinpoint from 'aws-cdk-lib/aws-pinpoint'; |
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.
The following error occurs at build time, so the import
statement is added.
aws-cdk-lib.aws_cognito-README-L1123.ts:4:28 - error TS2503: Cannot find namespace 'pinpoint'.
4 declare const pinpointApp: pinpoint.CfnApp;
☑️ Nothing to do
|
…-add-analytics-configuration
…-add-analytics-configuration
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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.
thank you for your work on this! all looks good to me, now waiting for someone from maintainers to review and merge 🤞
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.
Thanks 👍 Left comments for some initial adjustments.
analytics.applicationArn && | ||
(analytics.applicationId || analytics.externalId || analytics.role) | ||
) { | ||
throw new Error('Either `applicationArn` or all of `applicationId`, `externalId` and `role` must be specified.'); |
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.
Can you please provide some docs/explanation about this validation?
* 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). |
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.
* 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). | |
* The settings for Amazon Pinpoint analytics configuration. | |
* With an analytics configuration, your application can collect user-activity metrics for user notifications with an 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). |
Formatting.
* The Amazon Resource Name (ARN) of an Amazon Pinpoint project that you want to connect to your user pool app client.\ | ||
* Amazon Cognito publishes events to the Amazon Pinpoint project that `ApplicationArn` declares. You can also configure your application to pass an endpoint ID in the `AnalyticsMetadata` parameter of sign-in operations. The endpoint ID is information about the destination for push notifications |
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.
* The Amazon Resource Name (ARN) of an Amazon Pinpoint project that you want to connect to your user pool app client.\ | |
* Amazon Cognito publishes events to the Amazon Pinpoint project that `ApplicationArn` declares. You can also configure your application to pass an endpoint ID in the `AnalyticsMetadata` parameter of sign-in operations. The endpoint ID is information about the destination for push notifications | |
* The Amazon Resource Name (ARN) of an Amazon Pinpoint project that you want to connect to your user pool app client. | |
* Amazon Cognito publishes events to the Amazon Pinpoint project that `ApplicationArn` declares. | |
* You can also configure your application to pass an endpoint ID in the `AnalyticsMetadata` parameter of sign-in operations. | |
* The endpoint ID is information about the destination for push notifications. |
Formatting
readonly role?: IRole; | ||
|
||
/** | ||
* If `UserDataShared` is `true` , Amazon Cognito includes user data in the events that it publishes to Amazon Pinpoint analytics. |
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.
* If `UserDataShared` is `true` , Amazon Cognito includes user data in the events that it publishes to Amazon Pinpoint analytics. | |
* If `true`, Amazon Cognito includes user data in the events that it publishes to Amazon Pinpoint analytics. |
Formatting.
Issue # (if applicable)
Closes #32837
Reason for this change
UserPoolClient in Cognito did not support the
analyticsConfiguration
property.Description of changes
analytics
property to UserPoolClientProps(interface)validationAnalytics
method to UserPoolClient(Class / L2 Construct)Description of how you validated changes
Added both unit and integration tests.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license