| // Copyright 2016 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| /// Requests an application health check. |
| class GetHealth implements Command { |
| final String kind = 'get_health'; |
| static GetHealth deserialize(Map<String, String> json) => new GetHealth(); |
| Map<String, String> serialize() => const {}; |
| /// Application health status. |
| /// Application is known to be in a good shape and should be able to respond. |
| /// Application is not known to be in a good shape and may be unresponsive. |
| final EnumIndex<HealthStatus> _healthStatusIndex = |
| new EnumIndex<HealthStatus>(HealthStatus.values); |
| /// Application health status. |
| class Health extends Result { |
| static Health fromJson(Map<String, dynamic> json) { |
| return new Health(_healthStatusIndex.lookupBySimpleName(json['status'])); |
| final HealthStatus status; |
| Map<String, dynamic> toJson() => { |
| 'status': _healthStatusIndex.toSimpleName(status) |