-
Notifications
You must be signed in to change notification settings - Fork 247
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-gen2): Gen 2 infra #5026
Conversation
), | ||
AmplifyIntegCategory( | ||
category: Category.api, | ||
backends: [ |
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.
Q: Which backend becomes the "default" (the one set to const amplifyConfig = ...
in the outputs file? I added a new backend and that one is now the "default". Maybe it would be beneficial to specify one as default?
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.
It's currently implicit, as the first one in the list will be default. I'm not sure its work adding more logic to explicitly set the default since this script is typically used once-per team member.
infra-gen2/tool/deploy_gen2.dart
Outdated
} | ||
|
||
/// Only append environments if there are multiple backends | ||
if (category.backends.length > 1) { |
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.
Q: Do you need this since you have if (category.backends.length <= 1) continue
above?
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.
Yeah, this is outside the for loop (scope of previous if statement), so single backend groups would still hit this. If it was removed, all output files would have an empty amplifyEnvironments
definition, which might not be a bad thing?
infra-gen2/tool/deploy_gen2.dart
Outdated
String matchingBuckets = bucketNames.firstWhere( | ||
(name) => regex.hasMatch(name), | ||
orElse: () => '', | ||
); |
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.
Q: This will return an empty string if there is no bucket match. It will return the first bucket if there are multiple matches. Is that the desired behavior?
You could update to the following if you want to thrown an exception in either of those cases.
final matchingBuckets = bucketNames.where((name) => regex.hasMatch(name));
if (matchingBuckets.length != 1) {
throw Exception(...);
}
return matchingBuckets.single;
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.
Good suggestion! Cleaned this up using your approach. We only want to throw if there are more than 1 bucket. If there isn't a bucket we want to create one.
@@ -29,4 +29,20 @@ void main() async { | |||
graph_user_pools_test.main(useExistingTestUser: true); | |||
rest_test.main(useExistingTestUser: true); | |||
}); | |||
|
|||
group('amplify_api gen 2', () { |
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.
Note: We should discuss when the tests with gen1/cdk are removed. They add some benefit as they test that we are still properly supporting Gen 1 config formats. Integration tests are not an efficient way to test that though. If we feel good about the mapping from Gen 1 -> Gen 2 we could probably remove them.
* feat(core): add AmplifyOutputs types based on the CLI Gen2 client config schema (#4859) * chore: map AmplifyConfig to AmplifyOutputs (#4935) * chore: map AmplifyConfig to AmplifyOutputs * chore: formatting, license headers * chore: rename amplify_outputs_mapping_test.dart * chore: update API config * chore: support multiple graphql or rest APIs (#4982) * chore: update gen2 version and config mapping tests (#5010) chore: update gen2 version and tests * chore: supporting missing auth config options (#5011) * chore: map null passwordSettings to null passwordPolicy (#5024) * chore(core): updated asyncConfig to use AmplifyOutputs (#4995) * feat(core): add AmplifyOutputs types based on the CLI Gen2 client config schema (#4859) * chore: map AmplifyConfig to AmplifyOutputs (#4935) * chore: map AmplifyConfig to AmplifyOutputs * chore: formatting, license headers * chore: rename amplify_outputs_mapping_test.dart * chore: update API config * chore: support multiple graphql or rest APIs (#4982) * chore(core): updated asyncConfig to use AmplifyOutputs * feat(core): add AmplifyOutputs types based on the CLI Gen2 client config schema (#4859) * chore: map AmplifyConfig to AmplifyOutputs (#4935) * chore: map AmplifyConfig to AmplifyOutputs * chore: formatting, license headers * chore: rename amplify_outputs_mapping_test.dart * chore: update API config * chore: support multiple graphql or rest APIs (#4982) * chore(core): updated exports to expose MFA/Password Policies/Identity Providers * chore(auth): updated unit test to use AmplifyOutputs * chore(authenticator): updated to use AmplifyOutputs type * chore(test): updated test stub to use AmplifyOutputs * chore: update gen2 version and config mapping tests (#5010) chore: update gen2 version and tests * chore: supporting missing auth config options (#5011) * chore(core): updated unit tests AmplifyConfig Json to AmplifyOutputs Json * chore(authenticator): updated unit tests AmplifyOutputs Json values * chore(core): updated amplify_core.dart file format * chore(core): re-internalized IdentityProvider, MFA, and PasswordPolicies * chore(authenticator): renamed InheritedConfig.amplifyConfig to InheritedConfig.amplifyOutputs * chore(authenticator): Renamed FormFieldValidator.validateNewPassword's AmplifyOutputs parameter --------- Co-authored-by: NikaHsn <nika.hasani@gmail.com> Co-authored-by: Jordan Nelson <Jordanryannelson@gmail.com> * chore: fix oauth outputs (#5028) * chore: fix oauth outputs * fix naming typo --------- Co-authored-by: Nika Hassani <nikaws@amazon.com> * chore(infra-gen2): Gen 2 infra (#5026) * chore(infra): gen 2 api rename (#5040) * chore(infra): Add verbose flag to deploy step (#5042) * chore: update configure apis to use AmplifyOutputs instead of AmplifyConfig (#5017) * chore(core): add validation checks for AmplifyOutputs Json deserialization (#5077) * Chore/authenticator password validation (#5078) * chore(test): Removed linter ignore * chore(authenticator): cleaned up extra import * chore(authenticator): Updated password policy validator to use a type not affiliated with config * chore(authenticator): updated AmplifyConfig references to AmplifyOutputs --------- Co-authored-by: Jordan Nelson <Jordanryannelson@gmail.com> Co-authored-by: Tyler-Larkin <tyllark@amazon.com> Co-authored-by: Nika Hassani <nikaws@amazon.com> Co-authored-by: Elijah Quartey <Equartey@users.noreply.github.com>
* feat(core): add AmplifyOutputs types based on the CLI Gen2 client config schema (#4859) * chore: map AmplifyConfig to AmplifyOutputs (#4935) * chore: map AmplifyConfig to AmplifyOutputs * chore: formatting, license headers * chore: rename amplify_outputs_mapping_test.dart * chore: update API config * chore: support multiple graphql or rest APIs (#4982) * chore: update gen2 version and config mapping tests (#5010) chore: update gen2 version and tests * chore: supporting missing auth config options (#5011) * chore: map null passwordSettings to null passwordPolicy (#5024) * chore(core): updated asyncConfig to use AmplifyOutputs (#4995) * feat(core): add AmplifyOutputs types based on the CLI Gen2 client config schema (#4859) * chore: map AmplifyConfig to AmplifyOutputs (#4935) * chore: map AmplifyConfig to AmplifyOutputs * chore: formatting, license headers * chore: rename amplify_outputs_mapping_test.dart * chore: update API config * chore: support multiple graphql or rest APIs (#4982) * chore(core): updated asyncConfig to use AmplifyOutputs * feat(core): add AmplifyOutputs types based on the CLI Gen2 client config schema (#4859) * chore: map AmplifyConfig to AmplifyOutputs (#4935) * chore: map AmplifyConfig to AmplifyOutputs * chore: formatting, license headers * chore: rename amplify_outputs_mapping_test.dart * chore: update API config * chore: support multiple graphql or rest APIs (#4982) * chore(core): updated exports to expose MFA/Password Policies/Identity Providers * chore(auth): updated unit test to use AmplifyOutputs * chore(authenticator): updated to use AmplifyOutputs type * chore(test): updated test stub to use AmplifyOutputs * chore: update gen2 version and config mapping tests (#5010) chore: update gen2 version and tests * chore: supporting missing auth config options (#5011) * chore(core): updated unit tests AmplifyConfig Json to AmplifyOutputs Json * chore(authenticator): updated unit tests AmplifyOutputs Json values * chore(core): updated amplify_core.dart file format * chore(core): re-internalized IdentityProvider, MFA, and PasswordPolicies * chore(authenticator): renamed InheritedConfig.amplifyConfig to InheritedConfig.amplifyOutputs * chore(authenticator): Renamed FormFieldValidator.validateNewPassword's AmplifyOutputs parameter --------- Co-authored-by: NikaHsn <nika.hasani@gmail.com> Co-authored-by: Jordan Nelson <Jordanryannelson@gmail.com> * chore: fix oauth outputs (#5028) * chore: fix oauth outputs * fix naming typo --------- Co-authored-by: Nika Hassani <nikaws@amazon.com> * chore(infra-gen2): Gen 2 infra (#5026) * chore(infra): gen 2 api rename (#5040) * chore(infra): Add verbose flag to deploy step (#5042) * chore: update configure apis to use AmplifyOutputs instead of AmplifyConfig (#5017) * chore(core): add validation checks for AmplifyOutputs Json deserialization (#5077) * Chore/authenticator password validation (#5078) * chore(test): Removed linter ignore * chore(authenticator): cleaned up extra import * chore(authenticator): Updated password policy validator to use a type not affiliated with config * chore(authenticator): updated AmplifyConfig references to AmplifyOutputs --------- Co-authored-by: Jordan Nelson <Jordanryannelson@gmail.com> Co-authored-by: Tyler-Larkin <tyllark@amazon.com> Co-authored-by: Nika Hassani <nikaws@amazon.com> Co-authored-by: Elijah Quartey <Equartey@users.noreply.github.com>
* feat(core): add AmplifyOutputs types based on the CLI Gen2 client config schema (#4859) * chore: map AmplifyConfig to AmplifyOutputs (#4935) * chore: map AmplifyConfig to AmplifyOutputs * chore: formatting, license headers * chore: rename amplify_outputs_mapping_test.dart * chore: update API config * chore: support multiple graphql or rest APIs (#4982) * chore: update gen2 version and config mapping tests (#5010) chore: update gen2 version and tests * chore: supporting missing auth config options (#5011) * chore: map null passwordSettings to null passwordPolicy (#5024) * chore(core): updated asyncConfig to use AmplifyOutputs (#4995) * feat(core): add AmplifyOutputs types based on the CLI Gen2 client config schema (#4859) * chore: map AmplifyConfig to AmplifyOutputs (#4935) * chore: map AmplifyConfig to AmplifyOutputs * chore: formatting, license headers * chore: rename amplify_outputs_mapping_test.dart * chore: update API config * chore: support multiple graphql or rest APIs (#4982) * chore(core): updated asyncConfig to use AmplifyOutputs * feat(core): add AmplifyOutputs types based on the CLI Gen2 client config schema (#4859) * chore: map AmplifyConfig to AmplifyOutputs (#4935) * chore: map AmplifyConfig to AmplifyOutputs * chore: formatting, license headers * chore: rename amplify_outputs_mapping_test.dart * chore: update API config * chore: support multiple graphql or rest APIs (#4982) * chore(core): updated exports to expose MFA/Password Policies/Identity Providers * chore(auth): updated unit test to use AmplifyOutputs * chore(authenticator): updated to use AmplifyOutputs type * chore(test): updated test stub to use AmplifyOutputs * chore: update gen2 version and config mapping tests (#5010) chore: update gen2 version and tests * chore: supporting missing auth config options (#5011) * chore(core): updated unit tests AmplifyConfig Json to AmplifyOutputs Json * chore(authenticator): updated unit tests AmplifyOutputs Json values * chore(core): updated amplify_core.dart file format * chore(core): re-internalized IdentityProvider, MFA, and PasswordPolicies * chore(authenticator): renamed InheritedConfig.amplifyConfig to InheritedConfig.amplifyOutputs * chore(authenticator): Renamed FormFieldValidator.validateNewPassword's AmplifyOutputs parameter --------- Co-authored-by: NikaHsn <nika.hasani@gmail.com> Co-authored-by: Jordan Nelson <Jordanryannelson@gmail.com> * chore: fix oauth outputs (#5028) * chore: fix oauth outputs * fix naming typo --------- Co-authored-by: Nika Hassani <nikaws@amazon.com> * chore(infra-gen2): Gen 2 infra (#5026) * chore(infra): gen 2 api rename (#5040) * chore(infra): Add verbose flag to deploy step (#5042) * chore: update configure apis to use AmplifyOutputs instead of AmplifyConfig (#5017) * chore(core): add validation checks for AmplifyOutputs Json deserialization (#5077) * Chore/authenticator password validation (#5078) * chore(test): Removed linter ignore * chore(authenticator): cleaned up extra import * chore(authenticator): Updated password policy validator to use a type not affiliated with config * chore(authenticator): updated AmplifyConfig references to AmplifyOutputs --------- Co-authored-by: Jordan Nelson <Jordanryannelson@gmail.com> Co-authored-by: Tyler-Larkin <tyllark@amazon.com> Co-authored-by: Nika Hassani <nikaws@amazon.com> Co-authored-by: Elijah Quartey <Equartey@users.noreply.github.com>
Description of changes:
This adds a new
infra-gen2
directory to hold Gen 2 backends for integration testing. It includes a scripttool/deploy_gen2.dart
that will:/backends
amplifyEnvironments
amplify_outputs.dart
to example appsAdditionally, this includes a bash file,
pull_test_gen2_backend.sh
, that lives in example apps to allow GitHub Actions to pull the required config for a given App.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.