improve versioning status display and delete with versions when versioning is suspended (#2689)

This commit is contained in:
Prakash Senthil Vel
2023-03-03 00:11:44 +05:30
committed by GitHub
parent c700ee491e
commit b8e14ee269
18 changed files with 375 additions and 61 deletions

View File

@@ -2597,7 +2597,7 @@ func init() {
"tags": [
"Configuration"
],
"summary": "Uploads an Object.",
"summary": "Uploads a file to import MinIO server config.",
"parameters": [
{
"type": "file",
@@ -5906,8 +5906,25 @@ func init() {
"bucketVersioningResponse": {
"type": "object",
"properties": {
"is_versioned": {
"ExcludeFolders": {
"type": "boolean"
},
"ExcludedPrefixes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Prefix": {
"type": "string"
}
}
}
},
"MFADelete": {
"type": "string"
},
"Status": {
"type": "string"
}
}
},
@@ -11432,7 +11449,7 @@ func init() {
"tags": [
"Configuration"
],
"summary": "Uploads an Object.",
"summary": "Uploads a file to import MinIO server config.",
"parameters": [
{
"type": "file",
@@ -14172,6 +14189,14 @@ func init() {
}
}
},
"BucketVersioningResponseExcludedPrefixesItems0": {
"type": "object",
"properties": {
"Prefix": {
"type": "string"
}
}
},
"LoginRequestFeatures": {
"type": "object",
"properties": {
@@ -14867,8 +14892,20 @@ func init() {
"bucketVersioningResponse": {
"type": "object",
"properties": {
"is_versioned": {
"ExcludeFolders": {
"type": "boolean"
},
"ExcludedPrefixes": {
"type": "array",
"items": {
"$ref": "#/definitions/BucketVersioningResponseExcludedPrefixesItems0"
}
},
"MFADelete": {
"type": "string"
},
"Status": {
"type": "string"
}
}
},

View File

@@ -51,7 +51,7 @@ func NewPostConfigsImport(ctx *middleware.Context, handler PostConfigsImportHand
/*
PostConfigsImport swagger:route POST /configs/import Configuration postConfigsImport
Uploads an Object.
Uploads a file to import MinIO server config.
*/
type PostConfigsImport struct {
Context *middleware.Context

View File

@@ -357,9 +357,19 @@ func getBucketVersionedResponse(session *models.Principal, params bucketApi.GetB
ErrorWithContext(ctx, fmt.Errorf("error versioning bucket: %v", err))
}
excludedPrefixes := make([]*models.BucketVersioningResponseExcludedPrefixesItems0, len(res.ExcludedPrefixes))
for i, v := range res.ExcludedPrefixes {
excludedPrefixes[i] = &models.BucketVersioningResponseExcludedPrefixesItems0{
Prefix: v.Prefix,
}
}
// serialize output
bucketVResponse := &models.BucketVersioningResponse{
IsVersioned: res.Status == "Enabled",
ExcludeFolders: res.ExcludeFolders,
ExcludedPrefixes: excludedPrefixes,
MFADelete: res.MFADelete,
Status: res.Status,
}
return bucketVResponse, nil
}