Skip to content

Commit de96f76

Browse files
authored
refactor(restore/backup): structure pgBackRest options as map for safer and flexible (#46)
2 parents 9b48b29 + 3a51f44 commit de96f76

File tree

27 files changed

+693
-534
lines changed

27 files changed

+693
-534
lines changed

api/design/backup.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ var BackupOptions = g.Type("BackupOptions", func() {
1616
"key": "value",
1717
})
1818
})
19-
g.Attribute("extra_options", g.ArrayOf(g.String), func() {
20-
g.Description("Extra options for the backup.")
21-
g.Example([]string{"--option1", "--option2"})
19+
g.Attribute("backup_options", g.MapOf(g.String, g.String), func() {
20+
g.Description("Options for the backup.")
21+
g.Example(map[string]string{
22+
"archive-check": "n",
23+
})
2224
})
2325

2426
g.Required("type")

api/design/database.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,21 @@ var RestoreConfigSpec = g.Type("RestoreConfigSpec", func() {
316316
g.Attribute("repository", RestoreRepositorySpec, func() {
317317
g.Description("The repository to restore this database from.")
318318
})
319-
g.Attribute("restore_options", g.ArrayOf(g.String), func() {
319+
g.Attribute("restore_options", g.MapOf(g.String, g.String), func() {
320320
g.Description("Additional options to use when restoring this database. If omitted, the database will be restored to the latest point in the given repository.")
321-
g.Example([]string{"--type=time", "--target=2025-01-01T01:30:00Z"})
322-
g.Example([]string{"--type=lsn", "--target=0/30000000"})
323-
g.Example([]string{"--set=20250505-153628F", "--type=xid", "--target=123456"})
321+
g.Example(map[string]string{
322+
"type": "time",
323+
"target": "2025-01-01T01:30:00Z",
324+
})
325+
g.Example(map[string]string{
326+
"type": "lsn",
327+
"target": "0/30000000",
328+
})
329+
g.Example(map[string]string{
330+
"set": "20250505-153628F",
331+
"type": "xid",
332+
"target": "123456",
333+
})
324334
})
325335

326336
g.Required("source_database_id", "source_node_name", "source_database_name", "repository")

api/gen/control_plane/service.go

Lines changed: 13 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/gen/control_plane/views/view.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/gen/http/cli/control_plane/cli.go

Lines changed: 58 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/gen/http/control_plane/client/cli.go

Lines changed: 10 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)