JSONrpc: implement removeObject RPC call

This commit is contained in:
Krishna Srinivas 2016-02-05 19:46:36 +05:30
parent 3a55d05eff
commit 3a8fff46f9
2 changed files with 21 additions and 0 deletions

View File

@ -52,6 +52,13 @@ type GetObjectURLArgs struct {
ObjectName string `json:"objectName"` ObjectName string `json:"objectName"`
} }
// RemoveObjectArgs - args to remove an object
type RemoveObjectArgs struct {
TargetHost string `json:"targetHost"`
BucketName string `json:"bucketName"`
ObjectName string `json:"objectName"`
}
// BucketInfo container for list buckets metadata. // BucketInfo container for list buckets metadata.
type BucketInfo struct { type BucketInfo struct {
// The name of the bucket. // The name of the bucket.

View File

@ -214,6 +214,20 @@ func (web *WebAPI) GetObjectURL(r *http.Request, args *GetObjectURLArgs, reply *
return nil return nil
} }
// RemoveObject - removes an object.
func (web *WebAPI) RemoveObject(r *http.Request, args *RemoveObjectArgs, reply *int) error {
if !isAuthenticated(r) {
return errUnAuthorizedRequest
}
e := web.Client.RemoveObject(args.BucketName, args.ObjectName)
if e != nil {
return e
}
*reply = 0
return nil
}
// Login - user login handler. // Login - user login handler.
func (web *WebAPI) Login(r *http.Request, args *LoginArgs, reply *AuthToken) error { func (web *WebAPI) Login(r *http.Request, args *LoginArgs, reply *AuthToken) error {
jwt := InitJWT() jwt := InitJWT()