CloudMigration: Interpret error code from migration resource item (#94407)

* start on loading the error code

* error code to message mapping

* use resource code type

* use defined error code

* partial updates from comments

* i18nKey gen

* fixed t

* fixed translations

* typing
This commit is contained in:
Dana Axinte
2024-10-17 14:09:09 +01:00
committed by GitHub
parent 1051561154
commit a50507e645
13 changed files with 190 additions and 13 deletions
+1
View File
@@ -390,6 +390,7 @@ func (cma *CloudMigrationAPI) GetSnapshot(c *contextmodel.ReqContext) response.R
RefID: results[i].RefID,
Status: ItemStatus(results[i].Status),
Message: results[i].Error,
ErrorCode: ItemErrorCode(results[i].ErrorCode),
ParentName: results[i].ParentName,
}
}
+18 -2
View File
@@ -113,8 +113,9 @@ type MigrateDataResponseItemDTO struct {
// required:true
RefID string `json:"refId"`
// required:true
Status ItemStatus `json:"status"`
Message string `json:"message,omitempty"`
Status ItemStatus `json:"status"`
Message string `json:"message,omitempty"`
ErrorCode ItemErrorCode `json:"errorCode,omitempty"`
}
// swagger:enum MigrateDataType
@@ -143,6 +144,21 @@ const (
ItemStatusUnknown ItemStatus = "UNKNOWN"
)
// swagger:enum ItemErrorCode
type ItemErrorCode string
const (
ErrDatasourceNameConflict ItemErrorCode = "DATASOURCE_NAME_CONFLICT"
ErrDashboardAlreadyManaged ItemErrorCode = "DASHBOARD_ALREADY_MANAGED"
ErrLibraryElementNameConflict ItemErrorCode = "LIBRARY_ELEMENT_NAME_CONFLICT"
ErrUnsupportedDataType ItemErrorCode = "UNSUPPORTED_DATA_TYPE"
ErrResourceConflict ItemErrorCode = "RESOURCE_CONFLICT"
ErrUnexpectedStatus ItemErrorCode = "UNEXPECTED_STATUS_CODE"
ErrInternalServiceError ItemErrorCode = "INTERNAL_SERVICE_ERROR"
ErrOnlyCoreDataSources ItemErrorCode = "ONLY_CORE_DATA_SOURCES"
ErrGeneric ItemErrorCode = "GENERIC_ERROR"
)
// swagger:parameters getCloudMigrationRun
type GetMigrationRunParams struct {
// RunUID of a migration run