Merge pull request #1096 from krishnasrinivas/web-remove-object

JSONrpc: implement removeObject RPC call
master
Harshavardhana 9 years ago
commit 5b4c73e74d
  1. 7
      web-definitions.go
  2. 14
      web-handlers.go

@ -52,6 +52,13 @@ type GetObjectURLArgs struct {
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.
type BucketInfo struct {
// The name of the bucket.

@ -214,6 +214,20 @@ func (web *WebAPI) GetObjectURL(r *http.Request, args *GetObjectURLArgs, reply *
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.
func (web *WebAPI) Login(r *http.Request, args *LoginArgs, reply *AuthToken) error {
jwt := InitJWT()

Loading…
Cancel
Save