Amplify-cli: I have delete a api, now i want to undo the operation.

Created on 4 May 2019  路  4Comments  路  Source: aws-amplify/amplify-cli

* Which Category is your question related to? *
amplify add and remove api
* What AWS Services are you utilizing? *
AWS APPSYNC amplify api remove
* Provide additional details e.g. code snippets *

1: I have added an api

  1. i made the changes to the api but havent pushed the changes
  2. i didnt like the stuff i did in there and so i deleted it.
  3. its as shown in the image.
    4 now i want to undo the operation which says remove.

how do i do that.

P.S i havent done amplify push yet.

image

pending-response platform question

Most helpful comment

I did amplify env pull --restore and it was back to what I wanted.

Although it may slightly contradict to what I asked for as I wanted a state where it's not deleted and still keep the changes.

Pull restore takes me from start but than still I can do the cleaner way for my use case

All 4 comments

Transferring to the CLI repo.

@hafizali05
Just want to get exactly what happened. You've created and pushed your api before, and the api related resources have already been created in the cloud, right?
Then you made local changes without pushing them to the cloud, but you don't want to keep those local changes.

The CLI currently does not have undo command. But there's a simple workaround.

  1. thoroughly backup your project so you can recover if things go wrong.
  2. copy the api folder from #current-cloud-backend folder to the backend folder.
  3. copy the "api" section in the amplify-meta.json from the #current-cloud-backend folder to the backend folder.
  4. copy the "api" section in the backend-config.json from the #current-cloud-backend folder to the backend folder.
  5. run amplify api gql-compile

then if you execute "amplify status", you will see that the api category is not changed, and you can continue your development normally.

I did amplify env pull --restore and it was back to what I wanted.

Although it may slightly contradict to what I asked for as I wanted a state where it's not deleted and still keep the changes.

Pull restore takes me from start but than still I can do the cleaner way for my use case

I had a similar challenged but I resolved it by copying and replacing my #current_cloud_backend folder with the backend folder. In my case, the locally served app was faultless so check again before you follow this approach.

Was this page helpful?
0 / 5 - 0 ratings