From b2a1e39d14c74e1c1809404a2b71a4de9990bf93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Michon?= Date: Mon, 22 Jul 2019 16:00:51 +0200 Subject: [PATCH] Add DatabaseShow method --- CHANGELOG.md | 2 ++ databases.go | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac95508d..b9e409f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## To Be Released +* Add `DatabaseShow` + ## v2.5.0 * Add periodic backups configuration method diff --git a/databases.go b/databases.go index 5ecf4080..e82ff0dc 100644 --- a/databases.go +++ b/databases.go @@ -78,6 +78,15 @@ type DatabaseRes struct { Database Database `json:"database"` } +func (c *Client) DatabaseShow(app, addonID string) (Database, error) { + var db Database + err := c.DBAPI(app, addonID).ResourceGet("databases", addonID, nil, &db) + if err != nil { + return Database{}, errgo.Notef(err, "fail to get the database") + } + return db, nil +} + type PeriodicBackupsConfigParams struct { ScheduledAt *int `json:"periodic_backups_scheduled_at,omitempty"` Enabled *bool `json:"periodic_backups_enabled,omitempty"`