
Security News
NVD Quietly Sweeps 100K+ CVEs Into a “Deferred” Black Hole
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
This gem has been extracted from https://db-backups.com.
Your "one click" backup solution for Heroku apps.
Ruby library to invoke Heroku Postgres APIs. An extension to the official Platform API gem to introduce the missing APIs for Postgres.
This gem is not officialy supported. We use the same APIs that the offical Heroku Toolbelt uses, therefore is unrealistic that a breaking change in the APIs would break it, since it means it would break both this gem and the official Heroku CLI.
Not all APIs are implemented at the moment but we are working hard on implementing all of them.
Please check the list of implemented and not implemented services.
Contributes and Pull Requests are welcome!
Add this line to your application's Gemfile:
gem 'heroku-api-postgres'
And then execute:
$ bundle
Or install it yourself as:
$ gem install heroku-api-postgres
This gem client needs to be instantiated in a similar way to the PlatformAPI. You can use the same oauth key or API key that you use for the PlatformAPI.
postgres_api_client = Heroku::Api::Postgres.connect(ENV['HEROKU_API_KEY'])
postgres_api_client = Heroku::Api::Postgres.connect_oauth(ENV['HEROKU_OAUTH_TOKEN'])
Look into Models for a detailed description of the JSON objects returned by the APIs. Those are the bare objects returned by the official Heroku API.
databases_client = postgres_api_client.databases
database_info = databases_client.info(app_id, database_id)
returns a Database.
database = postgres_api_client.databases.wait(app_id, database_id, wait_interval: 5)
Waits for the given database to be ready.
Polls every wait_interval
seconds (default 3).
credentials_client = postgres_api_client.credentials
credentials_client.rotate(app_id, database_id)
Rotate the database credentials.
backups_client = postgres_api_client.backups
backups = backups_client.info(app_id, backup_id)
returns a Backup.
backups = backups_client.list(app_id)
returns an array of Backup.
The app_id can be either the name of your heroku app or the id.
To retrieve the APP_ID and DATABASE_ID needed to run the tests you can use the name of the app as APP_ID and execute:
heroku addons --json --app YOUR_APP
to retrieve the DATABASE_ID.
schedules = backups_client.schedules(app_id, database_id)
Returns all the backup schedules associated with the database.
Returns an array of Schedule
schedule = backups_client.schedule(app_id, database_id)
Schedules the backups at 00:00 UTC.
Returns a Schedule
backup = backups_client.capture(app_id, database_id)
Captures a new backup for the given database
Returns a Backup
backup_url = backups_client.url(app_id, backup_num)
Returns a temporary, public accessible URL to download a backup.
Needs the num
attribute of a Backup.
Returns a BackupUrl
backup = backups_client.restore(app_id, database_id, dump_url)
Restores a dump from a public URL.
Returns a Backup
backup = postgres_api_client.backups.wait(app_id, backup_id, wait_interval: 5)
Waits for the given backup/restore to be ready.
Polls every wait_interval
seconds (default 3).
You can pass a block to be executed at each interval:
backup = postgres_api_client.backups.wait(app_id, backup_id) do |info|
puts "Processed #{info[:processed_bytes]} bytes"
end
You can obtain a database id by calling the Heroku Platform API
heroku = PlatformAPI.connect_oauth(ENV['HEROKU_OAUTH_TOKEN'])
addons = heroku.addon.list
databases = addons.select { |addon| addon['addon_service']['name'] == 'heroku-postgresql' }
databases_ids = databases.map{ |addon| addon['id'] }
Check also the Official API
After checking out the repo, run bin/setup
to install dependencies.
Then, run rake spec
to run the tests.
You can run bin/check
to run linter and the tests together.
You can also run bin/console
for an interactive prompt that will allow you to experiment.
You need some app and database ids to run the tests and record the cassettes. In particular you need an app with a postgres database on the free plan and one with a database on a pro plan.
To install this gem onto your local machine, run bundle exec rake install
.
To release a new version, update the version number in version.rb
, and then run bundle exec rake release
,
which will create a git tag for the version, push git commits and tags,
and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/coorasse/heroku-api-postgres.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that heroku-api-postgres demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Research
Security News
Lazarus-linked threat actors expand their npm malware campaign with new RAT loaders, hex obfuscation, and over 5,600 downloads across 11 packages.
Security News
Safari 18.4 adds support for Iterator Helpers and two other TC39 JavaScript features, bringing full cross-browser coverage to key parts of the ECMAScript spec.