-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(events): add maintenance events #356
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By looking the event names, I'm wonder, did you succeed to test locally?
There are some changes that need to be done, probably on API side according to the user information, otherwise it should be good.
CHANGELOG.md
Outdated
@@ -2,6 +2,8 @@ | |||
|
|||
## To Be Released | |||
|
|||
* feat(events): add maintenance events" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* feat(events): add maintenance events" | |
* feat(events): add maintenance events |
events_structs.go
Outdated
func (ev *EventDatabaseMaintenancePlannedType) String() string { | ||
return fmt.Sprintf("A maintenance has been scheduled on the %s addon (Maintenance ID: %s).", ev.TypeData.AddonName, ev.TypeData.MaintenanceID) | ||
} | ||
|
||
func (ev *EventDatabaseMaintenancePlannedType) Who() string { | ||
if ev.TypeData.AddonName != "" { | ||
return fmt.Sprintf("Addon %s", ev.TypeData.AddonName) | ||
} | ||
return ev.Event.Who() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From slack discussion I talked more about the following format:
A maintenance (ID 65004006a8acb50076cf9c1b) has been scheduled on the Redis addon. <scalingo-platform (deploy@scalingo.com)>
Two things:
- non-blocking: in order to make as small as possible the output, move the "Maintenance ID" right after "maintenance" using only
(ID: 123)
- blocking: The user is missing here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the message format, but the user is well added here. Just not handled in this file.
events_structs.go
Outdated
func (ev *EventDatabaseMaintenanceStartedType) String() string { | ||
return fmt.Sprintf("A maintenance has started on the %s addon (Maintenance ID: %s).", ev.TypeData.AddonName, ev.TypeData.MaintenanceID) | ||
} | ||
|
||
func (ev *EventDatabaseMaintenanceStartedType) Who() string { | ||
if ev.TypeData.AddonName != "" { | ||
return fmt.Sprintf("Addon %s", ev.TypeData.AddonName) | ||
} | ||
return ev.Event.Who() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
events_structs.go
Outdated
func (ev *EventDatabaseMaintenanceCompletedType) String() string { | ||
return fmt.Sprintf("A maintenance has been completed on the %s addon (Maintenance ID: %s).", ev.TypeData.AddonName, ev.TypeData.MaintenanceID) | ||
} | ||
|
||
func (ev *EventDatabaseMaintenanceCompletedType) Who() string { | ||
if ev.TypeData.AddonName != "" { | ||
return fmt.Sprintf("Addon %s", ev.TypeData.AddonName) | ||
} | ||
return ev.Event.Who() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed as well
events_structs.go
Outdated
EventDatabaseMaintenancePlanned EventTypeName = "database_maintenance_planned" | ||
EventDatabaseMaintenanceStarted EventTypeName = "database_maintenance_started" | ||
EventDatabaseMaintenanceCompleted EventTypeName = "database_maintenance_completed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are not the right event names. You can find them from the API event.rake
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, only need to take in account recent API changes and we'll ready to go 👍
events_structs.go
Outdated
AddonName string `json:"addon_name"` | ||
MaintenanceID string `json:"maintenance_id"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the last update of the API we probably want to add all available information,
i.e. adding:
maintenance_type
maintenance_duration
maintenance_duration
events_structs.go
Outdated
if ev.TypeData.AddonName != "" { | ||
return fmt.Sprintf("Database %s", ev.TypeData.AddonName) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to use the user from the payload. Either remove the condition completely or change the condition to fallback, as you wish.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You didn't take this comment into account
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
events_structs.go
Outdated
AddonName string `json:"addon_name"` | ||
MaintenanceID string `json:"maintenance_id"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
events_structs.go
Outdated
if ev.TypeData.AddonName != "" { | ||
return fmt.Sprintf("Database %s", ev.TypeData.AddonName) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You didn't take this comment into account
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed as well
events_structs.go
Outdated
AddonName string `json:"addon_name"` | ||
MaintenanceID string `json:"maintenance_id"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
events_structs.go
Outdated
if ev.TypeData.AddonName != "" { | ||
return fmt.Sprintf("Database %s", ev.TypeData.AddonName) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You didn't take this comment into account
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user is still the addon name. We want to use the one from the payload
events_structs.go
Outdated
if ev.TypeData.AddonName != "" { | ||
return fmt.Sprintf("Database %s", ev.TypeData.AddonName) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You didn't take this comment into account
events_structs.go
Outdated
if ev.TypeData.AddonName != "" { | ||
return fmt.Sprintf("Database %s", ev.TypeData.AddonName) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You didn't take this comment into account
events_structs.go
Outdated
if ev.TypeData.AddonName != "" { | ||
return fmt.Sprintf("Database %s", ev.TypeData.AddonName) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You didn't take this comment into account
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a remaining typo and we are good to go
events_structs.go
Outdated
@@ -855,3 +858,69 @@ func (ev *EventStackChangedType) String() string { | |||
d := ev.TypeData | |||
return fmt.Sprintf("Stack changed from '%s' to %s", d.PreviousStackName, d.CurrentStackName) | |||
} | |||
|
|||
// Database maintenance planned | |||
type EventPlanDatabaseMaintenancedTypeData struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type EventPlanDatabaseMaintenancedTypeData struct { | |
type EventPlanDatabaseMaintenanceTypeData struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh damn you're completely right, fixed
events_structs.go
Outdated
|
||
type EventPlanDatabaseMaintenanceType struct { | ||
Event | ||
TypeData EventPlanDatabaseMaintenancedTypeData `json:"type_data"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeData EventPlanDatabaseMaintenancedTypeData `json:"type_data"` | |
TypeData EventPlanDatabaseMaintenanceTypeData `json:"type_data"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, fixed
fix #354
fix #357
fix #358