Skip to content

Commit

Permalink
Merge pull request #115 from Scalingo/fix/cli/450/backups-create
Browse files Browse the repository at this point in the history
Add BackupCreate method
  • Loading branch information
john-scalingo authored Jul 17, 2019
2 parents 90775f6 + d2428d4 commit af83bc1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## To Be Released

* Add `RegionMigrationsService`
* Add `BackupCreate` method

## v2.4.8

* Avoid using `errgo.Mask`
Expand Down
11 changes: 10 additions & 1 deletion backups.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (
)

type BackupsService interface {
BackupList(app string, addonID string) ([]Backup, error)
BackupList(app, addonID string) ([]Backup, error)
BackupCreate(app, addonID string) error
BackupShow(app, addonID, backupID string) (*Backup, error)
BackupDownloadURL(app, addonID, backupID string) (string, error)
}
Expand Down Expand Up @@ -54,6 +55,14 @@ func (c *Client) BackupList(app string, addonID string) ([]Backup, error) {
return backupRes.Backups, nil
}

func (c *Client) BackupCreate(app, addonID string) error {
err := c.DBAPI(app, addonID).SubresourceAdd("databases", addonID, "backups", nil, nil)
if err != nil {
return errgo.Notef(err, "fail to order a new backup creation")
}
return nil
}

func (c *Client) BackupShow(app, addonID, backup string) (*Backup, error) {
var backupRes BackupRes
err := c.DBAPI(app, addonID).ResourceGet("backups", backup, nil, &backupRes)
Expand Down

0 comments on commit af83bc1

Please sign in to comment.