List buckets re-design (#1058)

* New Bucket Listing

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>

Co-authored-by: Alex <33497058+bexsoft@users.noreply.github.com>
Co-authored-by: Lenin Alevski <alevsk.8772@gmail.com>
This commit is contained in:
Daniel Valdivia
2021-09-20 11:13:34 -07:00
committed by GitHub
parent d85b693751
commit 64e38ca8d3
42 changed files with 1126 additions and 411 deletions

View File

@@ -3623,10 +3623,64 @@ func init() {
"creation_date": {
"type": "string"
},
"details": {
"type": "object",
"properties": {
"locking": {
"type": "boolean"
},
"quota": {
"type": "object",
"properties": {
"quota": {
"type": "integer",
"format": "int64"
},
"type": {
"type": "string",
"enum": [
"fifo",
"hard"
]
}
}
},
"replication": {
"type": "boolean"
},
"tags": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"versioning": {
"type": "boolean"
},
"versioningSuspended": {
"type": "boolean"
}
}
},
"name": {
"type": "string",
"minLength": 3
},
"objects": {
"type": "integer",
"format": "int64"
},
"rw_access": {
"type": "object",
"properties": {
"read": {
"type": "boolean"
},
"write": {
"type": "boolean"
}
}
},
"size": {
"type": "integer",
"format": "int64"
@@ -8974,6 +9028,72 @@ func init() {
}
},
"definitions": {
"BucketDetails": {
"type": "object",
"properties": {
"locking": {
"type": "boolean"
},
"quota": {
"type": "object",
"properties": {
"quota": {
"type": "integer",
"format": "int64"
},
"type": {
"type": "string",
"enum": [
"fifo",
"hard"
]
}
}
},
"replication": {
"type": "boolean"
},
"tags": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"versioning": {
"type": "boolean"
},
"versioningSuspended": {
"type": "boolean"
}
}
},
"BucketDetailsQuota": {
"type": "object",
"properties": {
"quota": {
"type": "integer",
"format": "int64"
},
"type": {
"type": "string",
"enum": [
"fifo",
"hard"
]
}
}
},
"BucketRwAccess": {
"type": "object",
"properties": {
"read": {
"type": "boolean"
},
"write": {
"type": "boolean"
}
}
},
"WidgetDetailsOptions": {
"type": "object",
"properties": {
@@ -9237,10 +9357,64 @@ func init() {
"creation_date": {
"type": "string"
},
"details": {
"type": "object",
"properties": {
"locking": {
"type": "boolean"
},
"quota": {
"type": "object",
"properties": {
"quota": {
"type": "integer",
"format": "int64"
},
"type": {
"type": "string",
"enum": [
"fifo",
"hard"
]
}
}
},
"replication": {
"type": "boolean"
},
"tags": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"versioning": {
"type": "boolean"
},
"versioningSuspended": {
"type": "boolean"
}
}
},
"name": {
"type": "string",
"minLength": 3
},
"objects": {
"type": "integer",
"format": "int64"
},
"rw_access": {
"type": "object",
"properties": {
"read": {
"type": "boolean"
},
"write": {
"type": "boolean"
}
}
},
"size": {
"type": "integer",
"format": "int64"

View File

@@ -307,11 +307,38 @@ func getAccountInfo(ctx context.Context, client MinioAdmin) ([]*models.Bucket, e
var bucketInfos []*models.Bucket
for _, bucket := range info.Buckets {
bucketElem := &models.Bucket{
Name: swag.String(bucket.Name),
Size: int64(bucket.Size),
CreationDate: bucket.Created.Format(time.RFC3339),
Details: &models.BucketDetails{
Quota: nil,
},
RwAccess: &models.BucketRwAccess{
Read: bucket.Access.Read,
Write: bucket.Access.Write,
},
Name: swag.String(bucket.Name),
Objects: int64(bucket.Objects),
Size: int64(bucket.Size),
}
if bucket.Details != nil {
if bucket.Details.Tagging != nil {
bucketElem.Details.Tags = bucket.Details.Tagging.ToMap()
}
bucketElem.Details.Locking = bucket.Details.Locking
bucketElem.Details.Replication = bucket.Details.Replication
bucketElem.Details.Versioning = bucket.Details.Versioning
bucketElem.Details.VersioningSuspended = bucket.Details.VersioningSuspended
if bucket.Details.Quota != nil {
bucketElem.Details.Quota = &models.BucketDetailsQuota{
Quota: int64(bucket.Details.Quota.Quota),
Type: string(bucket.Details.Quota.Type),
}
}
}
bucketInfos = append(bucketInfos, bucketElem)
}
return bucketInfos, nil