Skip to content
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

chore(infra): Api migrate to Gen 2 E2E #5043

Merged
merged 16 commits into from
Jul 18, 2024
Merged

chore(infra): Api migrate to Gen 2 E2E #5043

merged 16 commits into from
Jul 18, 2024

Conversation

Equartey
Copy link
Contributor

@Equartey Equartey commented Jun 20, 2024

Description of changes:

  • Adds Gen 2 API category backend
  • Enables Gen 2 API integration tests

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Equartey Equartey force-pushed the chore/api-integ-gen2 branch from 5c1108f to 007a014 Compare June 25, 2024 21:53
@Equartey Equartey changed the title Chore/api integ gen2 chore(infra-gen2): Gen 2 infra Jun 25, 2024
@Equartey Equartey changed the title chore(infra-gen2): Gen 2 infra chore(infra): Api migrate to Gen 2 E2E Jun 25, 2024
@Equartey Equartey force-pushed the chore/api-integ-gen2 branch from d0499c8 to 16d1a13 Compare June 26, 2024 20:51
@Equartey Equartey marked this pull request as ready for review June 26, 2024 20:51
@Equartey Equartey requested a review from a team as a code owner June 26, 2024 20:51
Copy link
Member

@Jordan-Nelson Jordan-Nelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few questions. Will review the rest later

.gitignore Show resolved Hide resolved
// extract L1 CfnUserPool resources
const { cfnUserPool } = backend.auth.resources.cfnResources;
// modify cfnUserPool policies directly
cfnUserPool.policies = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: What is the default? Why do we need to change it? Can that change not be made in Gen 2?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the default?

8 Chars, 1 lower, 1 upper, 1 symbol

Why do we need to change it?

To match the current pattern and password generator methods we have.

Can that change not be made in Gen 2?

This is the recommended way when using Gen 2.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current generatePassword method used in integ tests inlcudes a UUID, an upper case character, and a symbol. That should always meet those requirements. Am I missing something?

String generatePassword() =>
uuid() +
uppercaseLetters[random.nextInt(uppercaseLetters.length)] +
symbols[random.nextInt(symbols.length)];

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this function wasn't being called. Previously it was just a uuid for the password. Updated.

infra-gen2/backends/api/apiMultiAuth/package.json Outdated Show resolved Hide resolved
packages/api/amplify_api/example/lib/models/gen2/Blog.dart Outdated Show resolved Hide resolved
Base automatically changed from feat/config-gen2 to main June 27, 2024 16:16
.gitignore Show resolved Hide resolved
.gitattributes Show resolved Hide resolved
// extract L1 CfnUserPool resources
const { cfnUserPool } = backend.auth.resources.cfnResources;
// modify cfnUserPool policies directly
cfnUserPool.policies = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current generatePassword method used in integ tests inlcudes a UUID, an upper case character, and a symbol. That should always meet those requirements. Am I missing something?

String generatePassword() =>
uuid() +
uppercaseLetters[random.nextInt(uppercaseLetters.length)] +
symbols[random.nextInt(symbols.length)];

@@ -18,6 +18,7 @@ export 'src/category/amplify_categories.dart';

/// Config
export 'src/config/amplify_config.dart';
export 'src/config/amplify_outputs/amplify_outputs.dart';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I think merge conflicts are causing changes to show in this PR that are not part of the PR. I am going to ignore files that I don't think are intended to be part of the PR and we re-review once the PR is updated.

@Jordan-Nelson Jordan-Nelson force-pushed the chore/api-integ-gen2 branch from ff69629 to b2977db Compare July 2, 2024 18:14
@Equartey Equartey force-pushed the chore/api-integ-gen2 branch 2 times, most recently from b9a3607 to c3c0860 Compare July 12, 2024 20:04
Jordan-Nelson
Jordan-Nelson previously approved these changes Jul 16, 2024
final req = ModelQueries.list<Blog>(Blog.classType);
final req = ModelQueries.list<Blog>(
Blog.classType,
authorizationMode: APIAuthorizationType.iam,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Is this change expected? Does gen 2 default to a different auth mode than gen 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unclear why this is necessary now, but it appears to be more accurate since these models have multiple authentication modes and an explicit mode should have been defined from the start.

Jordan-Nelson
Jordan-Nelson previously approved these changes Jul 16, 2024
NikaHsn
NikaHsn previously approved these changes Jul 16, 2024
infra-gen2/tool/deploy_gen2.dart Outdated Show resolved Hide resolved
infra-gen2/tool/deploy_gen2.dart Show resolved Hide resolved
@Equartey Equartey dismissed stale reviews from NikaHsn and Jordan-Nelson via e9ad65a July 18, 2024 14:17
@Equartey Equartey force-pushed the chore/api-integ-gen2 branch from e9ad65a to 61b6f3c Compare July 18, 2024 14:18
@Equartey Equartey merged commit 46d9ad2 into main Jul 18, 2024
78 checks passed
@Equartey Equartey deleted the chore/api-integ-gen2 branch July 18, 2024 17:04
tyllark pushed a commit to tyllark/amplify-flutter that referenced this pull request Aug 14, 2024
tyllark pushed a commit that referenced this pull request Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants