|
8 | 8 | ## Overview |
9 | 9 |
|
10 | 10 | The dx_maint command displays a summary of Direct Connect maintenance events |
11 | | -available from the AWS Health service sorted by the time AWS published the |
12 | | -event, which is not necessarily the start of maintenance. Only recent events |
13 | | -(past 7 days) and upcoming events are displayed by default. |
| 11 | +available from the AWS Health service sorted by the start time of the event. |
| 12 | +Only recent events (past 7 days) and upcoming events are displayed by default. |
| 13 | +The output includes the time the event was published (first date column), the |
| 14 | +start time of the event (second date column), and the end time of the event |
| 15 | +(last date column). |
14 | 16 |
|
15 | 17 | $ awsrun --account 111222333444 --account 222111444333 dx_maint --region us-east-1 --region us-west-2 |
16 | 18 | 111222333444 us-east-1 2021-11-19 09:11 CST closed MAINTENANCE_CANCELLED 2021-11-23 02:11 CST -> 2021-11-23 06:11 CST dxcon-aaaaaaaa available |
17 | 19 | 111222333444 us-west-2 2021-12-07 05:12 CST closed MAINTENANCE_COMPLETE 2021-12-07 03:12 CST -> 2021-12-07 07:12 CST dxcon-bbbbbbbb available |
18 | 20 | 111222333444 us-east-1 2022-01-18 02:01 CST closed MAINTENANCE_COMPLETE 2022-01-17 22:01 CST -> 2022-01-18 02:01 CST dxcon-cccccccc available |
19 | | - 222111444333 us-east-1 2022-01-31 21:01 CST upcoming MAINTENANCE_SCHEDULED 2022-02-14 22:02 CST -> 2022-02-15 02:02 CST dxcon-dddddddd available |
20 | 21 | 111222333444 us-east-1 2022-02-01 21:02 CST upcoming MAINTENANCE_SCHEDULED 2022-02-08 22:02 CST -> 2022-02-09 02:02 CST dxcon-eeeeeeee available |
| 22 | + 222111444333 us-east-1 2022-01-31 21:01 CST upcoming MAINTENANCE_SCHEDULED 2022-02-14 22:02 CST -> 2022-02-15 02:02 CST dxcon-dddddddd available |
21 | 23 |
|
22 | 24 | For non-emergency maintenance events that occurred in the past, the default |
23 | 25 | output only shows the COMPLETED or CANCELLED event to minimize on noise. For |
@@ -268,12 +270,15 @@ def regional_collect_results(self, acct, region, get_result): |
268 | 270 | def post_hook(self): |
269 | 271 | # The awsrun post hook is called once after all accounts have been |
270 | 272 | # processed. At this point, we have collected everything we need in the |
271 | | - # all_results instance variable. We sort this list by the last update |
272 | | - # time as we want to display the maintenance events in the order they |
273 | | - # were published by AWS. You might ask why don't we sort by the |
274 | | - # maintenance start time? Because AWS sometimes does not publish a |
275 | | - # start time for an event (I have no idea why). |
276 | | - self.all_results.sort(key=lambda r: r[3]["lastUpdatedTime"]) |
| 273 | + # all_results instance variable. We sort this list by start time when |
| 274 | + # possible, but the AWS API doesn't always send a startTime, so we |
| 275 | + # fallback to the lastUpdatedTime, which seems to always be present. |
| 276 | + self.all_results.sort( |
| 277 | + key=lambda r: ( |
| 278 | + r[3].get("startTime", r[3]["lastUpdatedTime"]), |
| 279 | + r[3]["lastUpdatedTime"], |
| 280 | + ) |
| 281 | + ) |
277 | 282 |
|
278 | 283 | for acct, region, dx, event in self.all_results: |
279 | 284 | for color, field in ( |
|
0 commit comments