Class: Heroku::Api::Postgres::Credentials

Inherits:
Object
  • Object
show all
Defined in:
lib/heroku/api/postgres/credentials.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Credentials

Returns a new instance of Credentials.



11
12
13
# File 'lib/heroku/api/postgres/credentials.rb', line 11

def initialize(client)
  @client = client
end

Instance Method Details

#rotate(app_id, database_id, name: 'default') ⇒ Object

Public: Rotate the database credentials.

Parameters:

  • app_id (String)

    the application name.

  • database_id (String)

    the database UUID.

  • name (String) (defaults to: 'default')

    the credential name to be rotated (default: ‘default`).



20
21
22
23
24
# File 'lib/heroku/api/postgres/credentials.rb', line 20

def rotate(app_id, database_id, name: 'default')
  path = "/postgres/v0/databases/#{database_id}/credentials" \
         "/#{URI.encode_www_form_component(name)}/credentials_rotation"
  @client.perform_post_request(path, {}, host: db_host(app_id, database_id))
end