diskInfo: Add DiskInfo API

This commit is contained in:
Harshavardhana
2016-01-26 12:08:45 -08:00
parent 1341fb79c3
commit 13feabefd5
3 changed files with 20 additions and 6 deletions

View File

@@ -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) {