Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for restoring from backup root #6486

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 93 additions & 49 deletions api-docs/openapi/v3_0/aggregated.json
Original file line number Diff line number Diff line change
Expand Up @@ -5239,55 +5239,6 @@
]
}
},
"/apis/api.console.migration.halo.run/v1alpha1/backups/{name}/files/{filename}": {
"get": {
"operationId": "DownloadBackups",
"parameters": [
{
"description": "Backup name.",
"in": "path",
"name": "name",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "Backup filename.",
"in": "path",
"name": "filename",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {},
"tags": [
"MigrationV1alpha1Console"
]
}
},
"/apis/api.console.migration.halo.run/v1alpha1/restorations": {
"post": {
"description": "Restore backup by uploading file or providing download link or backup name.",
"operationId": "RestoreBackup",
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/RestoreRequest"
}
}
},
"required": true
},
"responses": {},
"tags": [
"MigrationV1alpha1Console"
]
}
},
"/apis/api.content.halo.run/v1alpha1/categories": {
"get": {
"description": "Lists categories.",
Expand Down Expand Up @@ -7411,6 +7362,79 @@
]
}
},
"/apis/console.api.migration.halo.run/v1alpha1/backup-files": {
"get": {
"description": "Get backup files from backup root.",
"operationId": "getBackupFiles",
"responses": {
"default": {
"content": {
"*/*": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BackupFile"
}
}
}
},
"description": "default response"
}
},
"tags": [
"MigrationV1alpha1Console"
]
}
},
"/apis/console.api.migration.halo.run/v1alpha1/backups/{name}/files/{filename}": {
"get": {
"operationId": "DownloadBackups",
"parameters": [
{
"description": "Backup name.",
"in": "path",
"name": "name",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "Backup filename.",
"in": "path",
"name": "filename",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {},
"tags": [
"MigrationV1alpha1Console"
]
}
},
"/apis/console.api.migration.halo.run/v1alpha1/restorations": {
"post": {
"description": "Restore backup by uploading file or providing download link or backup name.",
"operationId": "RestoreBackup",
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/RestoreRequest"
}
}
},
"required": true
},
"responses": {},
"tags": [
"MigrationV1alpha1Console"
]
}
},
"/apis/console.api.notification.halo.run/v1alpha1/notifiers/default-email-notifier/verify-connection": {
"post": {
"description": "Verify email sender config.",
Expand Down Expand Up @@ -15300,6 +15324,22 @@
}
}
},
"BackupFile": {
"type": "object",
"properties": {
"filename": {
"type": "string"
},
"lastModifiedTime": {
"type": "string",
"format": "date-time"
},
"size": {
"type": "integer",
"format": "int64"
}
}
},
"BackupList": {
"required": [
"first",
Expand Down Expand Up @@ -20684,6 +20724,10 @@
"file": {
"type": "string",
"format": "binary"
},
"filename": {
"type": "string",
"description": "Filename of backup file in backups root."
}
}
},
Expand Down
110 changes: 110 additions & 0 deletions api-docs/openapi/v3_0/apis_console.api_v1alpha1.json
Original file line number Diff line number Diff line change
Expand Up @@ -3106,6 +3106,79 @@
]
}
},
"/apis/console.api.migration.halo.run/v1alpha1/backup-files": {
"get": {
"description": "Get backup files from backup root.",
"operationId": "getBackupFiles",
"responses": {
"default": {
"content": {
"*/*": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BackupFile"
}
}
}
},
"description": "default response"
}
},
"tags": [
"MigrationV1alpha1Console"
]
}
},
"/apis/console.api.migration.halo.run/v1alpha1/backups/{name}/files/{filename}": {
"get": {
"operationId": "DownloadBackups",
"parameters": [
{
"description": "Backup name.",
"in": "path",
"name": "name",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "Backup filename.",
"in": "path",
"name": "filename",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {},
"tags": [
"MigrationV1alpha1Console"
]
}
},
"/apis/console.api.migration.halo.run/v1alpha1/restorations": {
"post": {
"description": "Restore backup by uploading file or providing download link or backup name.",
"operationId": "RestoreBackup",
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/RestoreRequest"
}
}
},
"required": true
},
"responses": {},
"tags": [
"MigrationV1alpha1Console"
]
}
},
"/apis/console.api.notification.halo.run/v1alpha1/notifiers/default-email-notifier/verify-connection": {
"post": {
"description": "Verify email sender config.",
Expand Down Expand Up @@ -3376,6 +3449,22 @@
}
}
},
"BackupFile": {
"type": "object",
"properties": {
"filename": {
"type": "string"
},
"lastModifiedTime": {
"type": "string",
"format": "date-time"
},
"size": {
"type": "integer",
"format": "int64"
}
}
},
"Category": {
"required": [
"apiVersion",
Expand Down Expand Up @@ -5405,6 +5494,27 @@
}
}
},
"RestoreRequest": {
"type": "object",
"properties": {
"backupName": {
"type": "string",
"description": "Backup metadata name."
},
"downloadUrl": {
"type": "string",
"description": "Remote backup HTTP URL."
},
"file": {
"type": "string",
"format": "binary"
},
"filename": {
"type": "string",
"description": "Filename of backup file in backups root."
}
}
},
"RevertSnapshotForPostParam": {
"required": [
"snapshotName"
Expand Down
34 changes: 34 additions & 0 deletions application/src/main/java/run/halo/app/migration/BackupFile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package run.halo.app.migration;

import com.fasterxml.jackson.annotation.JsonIgnore;
import java.nio.file.Path;
import java.time.Instant;
import lombok.Data;

/**
* Backup file.
*
* @author johnniang
*/
@Data
public class BackupFile {

@JsonIgnore
private Path path;

/**
* Filename of backup file.
*/
private String filename;

/**
* Size of backup file.
*/
private long size;

/**
* Last modified time of backup file.
*/
private Instant lastModifiedTime;

}
Loading
Loading