events: Fix the message printed by events{add,remove} (#1911)

Fixes #1900
This commit is contained in:
Harshavardhana
2016-12-05 14:14:01 -08:00
committed by GitHub
parent f0d926ebba
commit a542145c85
2 changed files with 15 additions and 5 deletions
+12 -3
View File
@@ -75,7 +75,11 @@ func checkEventsAddSyntax(ctx *cli.Context) {
// eventsAddMessage container
type eventsAddMessage struct {
Status string `json:"status"`
ARN string `json:"arn"`
Events []string `json:"events"`
Prefix string `json:"prefix"`
Suffix string `json:"suffix"`
Status string `json:"status"`
}
// JSON jsonified update message.
@@ -87,7 +91,7 @@ func (u eventsAddMessage) JSON() string {
}
func (u eventsAddMessage) String() string {
msg := console.Colorize("Events", "Successfully accomplished.")
msg := console.Colorize("Events", "Successfully added "+u.ARN)
return msg
}
@@ -117,7 +121,12 @@ func mainEventsAdd(ctx *cli.Context) error {
err = s3Client.AddNotificationConfig(arn, events, prefix, suffix)
fatalIf(err, "Cannot enable notification on the specified bucket.")
printMsg(eventsAddMessage{})
printMsg(eventsAddMessage{
ARN: arn,
Events: events,
Prefix: prefix,
Suffix: suffix,
})
return nil
}
+3 -2
View File
@@ -69,6 +69,7 @@ func checkEventsRemoveSyntax(ctx *cli.Context) {
// eventsRemoveMessage container
type eventsRemoveMessage struct {
ARN string `json:"arn"`
Status string `json:"status"`
}
@@ -81,7 +82,7 @@ func (u eventsRemoveMessage) JSON() string {
}
func (u eventsRemoveMessage) String() string {
msg := console.Colorize("Events", "Successfully accomplished.")
msg := console.Colorize("Events", "Successfully removed "+u.ARN)
return msg
}
@@ -111,7 +112,7 @@ func mainEventsRemove(ctx *cli.Context) error {
err = s3Client.RemoveNotificationConfig(arn)
fatalIf(err, "Cannot enable notification on the specified bucket.")
printMsg(eventsRemoveMessage{})
printMsg(eventsRemoveMessage{ARN: arn})
return nil
}