-
Notifications
You must be signed in to change notification settings - Fork 822
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: storage import #5893
feat: storage import #5893
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5893 +/- ##
==========================================
+ Coverage 58.13% 58.16% +0.02%
==========================================
Files 413 407 -6
Lines 18886 18746 -140
Branches 3573 3738 +165
==========================================
- Hits 10980 10903 -77
+ Misses 7244 7051 -193
- Partials 662 792 +130
Continue to review full report at Codecov.
|
This pull request introduces 1 alert when merging e31160e into f3df233 - view on LGTM.com new alerts:
|
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.
Overall looks good!
): Promise<{ questionParameters: S3ImportParameters; answers: S3ImportAnswers } | undefined> => { | ||
await ensureAuth(context); | ||
|
||
let authResources = (await context.amplify.getResourceStatus('auth')).allResources.filter( |
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.
allResources
also includes resources that will be deleted in the next push right. What do you think about filtering those
const amplifyMeta = stateManager.getMeta(); | ||
const { Region } = amplifyMeta.providers[providerName]; | ||
|
||
// Get list of user pools to see if there is anything to import |
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.
Copy/paste from auth
// Get list of user pools to see if there is anything to import | ||
const bucketList = await s3.listBuckets(); | ||
|
||
// Return it no userpools found in the project's region |
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.
Same
|
||
const ensureAuth = async (context: $TSContext): Promise<void> => { | ||
while (!checkIfAuthExists(context)) { | ||
const addOrImportQuestion = { |
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.
Should we expose this as a method in auth category so we dont have multiple places to maintain this
|
||
tableList = tableList.filter(t => !dynamoDBResources.includes(t)); | ||
|
||
// Return it no userpools found in the project's region |
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.
comment should be ddb
// const resourceName = resourceAlreadyExists(context); | ||
const { amplify } = context; | ||
const { amplifyMeta } = amplify.getProjectDetails(); | ||
|
||
const dynamoDbResources = {}; | ||
|
||
Object.keys(amplifyMeta[category]).forEach(resourceName => { | ||
if (amplifyMeta[category][resourceName].service === serviceName && amplifyMeta[category][resourceName].mobileHubMigrated !== true) { | ||
if ( |
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.
Do we need to print a more friendlier message when customer has imported or migrated table? When they do amplify status
they would see the table but when they run update
the error message says No resources to update. May be if we can metion that they also can't update imported resource that would make it clearer
|
||
const resource = _.get(context.exeInfo, ['amplifyMeta', category, resourceName]); | ||
|
||
// Imported auth resource behavior is different from Amplify managed resources, as |
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.
Comment needs to be updated for storage
|
||
// check if this initialization is happening on a pull | ||
if (isPulling && allResources.length > 0) { | ||
tasks.push(...allResources); |
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.
Why push here and concat on the line above?
This pull request introduces 3 alerts when merging 3ea61da into d6909f4 - view on LGTM.com new alerts:
|
This pull request has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Description of changes:
Add import functionality to the CLI for S3 and DynamoDB resources via the
amplify storage import
command.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.