Skip to content

Commit b027e1a

Browse files
committed
refactor(storage): move storage backup commands into a sub-directory
This syncs directory structure with command structure similarly than with server and database commands.
1 parent 10bac54 commit b027e1a

File tree

7 files changed

+22
-9
lines changed

7 files changed

+22
-9
lines changed

internal/commands/all/all.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/UpCloudLtd/upcloud-cli/internal/commands/server/networkinterface"
1616
serverstorage "github.com/UpCloudLtd/upcloud-cli/internal/commands/server/storage"
1717
"github.com/UpCloudLtd/upcloud-cli/internal/commands/storage"
18+
storagebackup "github.com/UpCloudLtd/upcloud-cli/internal/commands/storage/backup"
1819
"github.com/UpCloudLtd/upcloud-cli/internal/commands/zone"
1920
"github.com/UpCloudLtd/upcloud-cli/internal/config"
2021

@@ -65,9 +66,9 @@ func BuildCommands(rootCmd *cobra.Command, conf *config.Config) {
6566
commands.BuildCommand(storage.ImportCommand(), storageCommand.Cobra(), conf)
6667
commands.BuildCommand(storage.ShowCommand(), storageCommand.Cobra(), conf)
6768

68-
backupCommand := commands.BuildCommand(storage.BackupCommand(), storageCommand.Cobra(), conf)
69-
commands.BuildCommand(storage.CreateBackupCommand(), backupCommand.Cobra(), conf)
70-
commands.BuildCommand(storage.RestoreBackupCommand(), backupCommand.Cobra(), conf)
69+
backupCommand := commands.BuildCommand(storagebackup.BackupCommand(), storageCommand.Cobra(), conf)
70+
commands.BuildCommand(storagebackup.CreateBackupCommand(), backupCommand.Cobra(), conf)
71+
commands.BuildCommand(storagebackup.RestoreBackupCommand(), backupCommand.Cobra(), conf)
7172

7273
// IP Addresses
7374
ipAddressCommand := commands.BuildCommand(ipaddress.BaseIPAddressCommand(), rootCmd, conf)
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
package storage
1+
package storagebackup
22

33
import "github.com/UpCloudLtd/upcloud-cli/internal/commands"
44

55
// BackupCommand creates the "storage backup" command
66
func BackupCommand() commands.Command {
7-
return &storageCommand{
7+
return &backupCommand{
88
commands.New("backup", "Manage backups"),
99
}
1010
}
11+
12+
type backupCommand struct {
13+
*commands.BaseCommand
14+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package storagebackup
2+
3+
const (
4+
Title1 = "mock-storage-title1"
5+
Title2 = "mock-storage-title2"
6+
UUID1 = "0127dfd6-3884-4079-a948-3a8881df1a7a"
7+
UUID2 = "012bde1d-f0e7-4bb2-9f4a-74e1f2b49c07"
8+
)

internal/commands/storage/backup_create.go renamed to internal/commands/storage/backup/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package storage
1+
package storagebackup
22

33
import (
44
"fmt"

internal/commands/storage/backup_create_test.go renamed to internal/commands/storage/backup/create_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package storage
1+
package storagebackup
22

33
import (
44
"testing"

internal/commands/storage/backup_restore.go renamed to internal/commands/storage/backup/restore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package storage
1+
package storagebackup
22

33
import (
44
"fmt"

internal/commands/storage/backup_restore_test.go renamed to internal/commands/storage/backup/restore_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package storage
1+
package storagebackup
22

33
import (
44
"testing"

0 commit comments

Comments
 (0)