mirror of
https://github.com/minio/minio.git
synced 2025-11-08 21:24:55 -05:00
diskInfo: Add DiskInfo API
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"time"
|
||||
|
||||
jwtgo "github.com/dgrijalva/jwt-go"
|
||||
"github.com/minio/minio/pkg/disk"
|
||||
)
|
||||
|
||||
// isAuthenticated validates if any incoming request to be a valid JWT
|
||||
@@ -40,6 +41,19 @@ func isAuthenticated(req *http.Request) bool {
|
||||
return tokenRequest.Valid
|
||||
}
|
||||
|
||||
// DiskInfo - get disk statistics.
|
||||
func (web *WebAPI) DiskInfo(r *http.Request, args *DiskInfoArgs, reply *disk.Info) error {
|
||||
if !isAuthenticated(r) {
|
||||
return errUnAuthorizedRequest
|
||||
}
|
||||
info, err := disk.GetInfo(web.FSPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*reply = info
|
||||
return nil
|
||||
}
|
||||
|
||||
// MakeBucket - make a bucket.
|
||||
func (web *WebAPI) MakeBucket(r *http.Request, args *MakeBucketArgs, reply *string) error {
|
||||
if !isAuthenticated(r) {
|
||||
|
||||
Reference in New Issue
Block a user