I found out that Heroku::Client::Pgbackups is already deprecated so I'm wondering if it's possible to run in Ruby a command to execute "heroku pgbackups" with using only the heroku-api gem.
I'm trying to make a maintenance site for my heroku apps. Just list down all the apps, and on just a click of a button, I can view the list of backups and can also revert/download backups from the list.
Most of the CLI processes are already available in the gem, except for listing backups. Is there any way to do it aside from doing a system() command? Because I might host my app on a server w/o heroku toolbelt installed. That way, my app can only connect via the api using heroku-api gem.
I know this asks too much, but if you can provide me something to work on that would be pretty much be appreciated. Thanks!
turns out that it's possible to do this to get the backup:
api = Heroku::API.new(:api_key => your_api_key)
pgbackups_url = api.get_config_vars('app_name').body['PGBACKUPS_URL']
client = Heroku::Client::Pgbackups.new pgbackups_url
client.get_backups
then it returns the list of the backups. So awesome! For more pgbackups functions, check it here: https://github.com/heroku/heroku/blob/master/lib/heroku/client/pgbackups.rb
Yes, you can.
https://devcenter.heroku.com/articles/pgbackups#list-backups
$ heroku pgbackups
ID | Backup Time | Size | Database
-----+---------------------+-------+------------------------
a226 | 2012/02/22 20:02.19 | 5.3KB | DATABASE_URL
a227 | 2012/02/23 20:02.19 | 5.3KB | DATABASE_URL
b251 | 2012/02/24 16:08.02 | 5.3KB | HEROKU_POSTGRESQL_BLACK
b252 | 2012/02/24 16:08.53 | 5.3KB | HEROKU_POSTGRESQL_PINK
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With