Fix import cycle issue
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"path"
|
||||
"sync"
|
||||
|
||||
"emperror.dev/errors"
|
||||
"github.com/apex/log"
|
||||
"github.com/pterodactyl/wings/api"
|
||||
"github.com/pterodactyl/wings/config"
|
||||
@@ -21,45 +20,13 @@ const (
|
||||
S3BackupAdapter AdapterType = "s3"
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
Adapter AdapterType `json:"adapter"`
|
||||
Uuid string `json:"uuid"`
|
||||
Ignore string `json:"ignore"`
|
||||
}
|
||||
|
||||
// AsBackup returns a new backup adapter based on the request value.
|
||||
func (r *Request) AsBackup() (BackupInterface, error) {
|
||||
var adapter BackupInterface
|
||||
switch r.Adapter {
|
||||
case LocalBackupAdapter:
|
||||
adapter = &LocalBackup{
|
||||
Backup{
|
||||
Uuid: r.Uuid,
|
||||
Ignore: r.Ignore,
|
||||
adapter: LocalBackupAdapter,
|
||||
},
|
||||
}
|
||||
case S3BackupAdapter:
|
||||
adapter = &S3Backup{
|
||||
Backup: Backup{
|
||||
Uuid: r.Uuid,
|
||||
Ignore: r.Ignore,
|
||||
adapter: S3BackupAdapter,
|
||||
},
|
||||
}
|
||||
default:
|
||||
return nil, errors.New("server/backup: unsupported adapter type: " + string(r.Adapter))
|
||||
}
|
||||
return adapter, nil
|
||||
}
|
||||
|
||||
type ArchiveDetails struct {
|
||||
Checksum string `json:"checksum"`
|
||||
ChecksumType string `json:"checksum_type"`
|
||||
Size int64 `json:"size"`
|
||||
}
|
||||
|
||||
// Returns a request object.
|
||||
// ToRequest returns a request object.
|
||||
func (ad *ArchiveDetails) ToRequest(successful bool) api.BackupRequest {
|
||||
return api.BackupRequest{
|
||||
Checksum: ad.Checksum,
|
||||
|
||||
Reference in New Issue
Block a user