Add proper JSON status field for API compatibility (#2807)
This commit is contained in:
committed by
kannappanr
parent
675618574a
commit
98e88c2ff0
@@ -89,7 +89,7 @@ type accountStat struct {
|
||||
func (c accountStat) JSON() string {
|
||||
c.Status = "success"
|
||||
accountMessageBytes, e := json.MarshalIndent(c, "", " ")
|
||||
fatalIf(probe.NewError(e), "Failed to marshal account stat.")
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
|
||||
|
||||
return string(accountMessageBytes)
|
||||
}
|
||||
|
||||
+1
-1
@@ -143,7 +143,7 @@ func (c copyMessage) String() string {
|
||||
func (c copyMessage) JSON() string {
|
||||
c.Status = "success"
|
||||
copyMessageBytes, e := json.MarshalIndent(c, "", " ")
|
||||
fatalIf(probe.NewError(e), "Failed to marshal copy message.")
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
|
||||
|
||||
return string(copyMessageBytes)
|
||||
}
|
||||
|
||||
+4
-2
@@ -118,8 +118,9 @@ EXAMPLES:
|
||||
|
||||
// Structured message depending on the type of console.
|
||||
type rmMessage struct {
|
||||
Key string `json:"key"`
|
||||
Size int64 `json:"size"`
|
||||
Status string `json:"status"`
|
||||
Key string `json:"key"`
|
||||
Size int64 `json:"size"`
|
||||
}
|
||||
|
||||
// Colorized message for console printing.
|
||||
@@ -129,6 +130,7 @@ func (r rmMessage) String() string {
|
||||
|
||||
// JSON'ified message for scripting.
|
||||
func (r rmMessage) JSON() string {
|
||||
r.Status = "success"
|
||||
msgBytes, e := json.MarshalIndent(r, "", " ")
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
|
||||
return string(msgBytes)
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ func (s shareMesssage) String() string {
|
||||
func (s shareMesssage) JSON() string {
|
||||
s.Status = "success"
|
||||
shareMessageBytes, e := json.MarshalIndent(s, "", " ")
|
||||
fatalIf(probe.NewError(e), "Failed to marshal into JSON.")
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
|
||||
|
||||
// JSON encoding escapes ampersand into its unicode character
|
||||
// which is not usable directly for share and fails with cloud
|
||||
|
||||
@@ -450,6 +450,7 @@ func (s updateMessage) String() string {
|
||||
|
||||
// JSON jsonified make bucket message.
|
||||
func (s updateMessage) JSON() string {
|
||||
s.Status = "success"
|
||||
updateJSONBytes, e := json.MarshalIndent(s, "", " ")
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user