Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2015 The LUCI Authors. All rights reserved. | 1 # Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """This module defines ProtoRPC types for the Swarming Server handlers.""" | 5 """This module defines ProtoRPC types for the Swarming Server handlers.""" |
| 6 | 6 |
| 7 from protorpc import message_types | 7 from protorpc import message_types |
| 8 from protorpc import messages | 8 from protorpc import messages |
| 9 | 9 |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 key = messages.StringField(1) | 41 key = messages.StringField(1) |
| 42 value = messages.StringField(2) | 42 value = messages.StringField(2) |
| 43 | 43 |
| 44 | 44 |
| 45 class StringListPair(messages.Message): | 45 class StringListPair(messages.Message): |
| 46 """Represents a mapping of string to list of strings.""" | 46 """Represents a mapping of string to list of strings.""" |
| 47 key = messages.StringField(1) | 47 key = messages.StringField(1) |
| 48 value = messages.StringField(2, repeated=True) | 48 value = messages.StringField(2, repeated=True) |
| 49 | 49 |
| 50 | 50 |
| 51 class ThreeStateBool(messages.Enum): | |
| 52 FALSE = 1 | |
| 53 TRUE = 2 | |
| 54 NONE = 3 | |
| 55 | |
| 56 | |
| 57 def to_bool(three_state): | |
| 58 if three_state in (None, True, False): | |
| 59 return three_state | |
| 60 if three_state == ThreeStateBool.FALSE: | |
| 61 return False | |
| 62 if three_state == ThreeStateBool.TRUE: | |
| 63 return True | |
| 64 | |
|
M-A Ruel
2016/08/09 20:23:13
2 lines here
kjlubick
2016/08/09 20:44:44
Done.
| |
| 51 ### Server related. | 65 ### Server related. |
| 52 | 66 |
| 53 | 67 |
| 54 class ServerDetails(messages.Message): | 68 class ServerDetails(messages.Message): |
| 55 """Reports the server version.""" | 69 """Reports the server version.""" |
| 56 server_version = messages.StringField(1) | 70 server_version = messages.StringField(1) |
| 57 | 71 |
| 58 | 72 |
| 59 class FileContentRequest(messages.Message): | 73 class FileContentRequest(messages.Message): |
| 60 """Content of a file.""" | 74 """Content of a file.""" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 ### Bot-Related Requests | 315 ### Bot-Related Requests |
| 302 | 316 |
| 303 | 317 |
| 304 class BotsRequest(messages.Message): | 318 class BotsRequest(messages.Message): |
| 305 """Information needed to request bot data.""" | 319 """Information needed to request bot data.""" |
| 306 limit = messages.IntegerField(1, default=200) | 320 limit = messages.IntegerField(1, default=200) |
| 307 cursor = messages.StringField(2) | 321 cursor = messages.StringField(2) |
| 308 # Must be a list of 'key:value' strings to filter the returned list of bots | 322 # Must be a list of 'key:value' strings to filter the returned list of bots |
| 309 # on. | 323 # on. |
| 310 dimensions = messages.StringField(3, repeated=True) | 324 dimensions = messages.StringField(3, repeated=True) |
| 325 quarantined = messages.EnumField(ThreeStateBool, 4, default='NONE') | |
| 326 is_dead = messages.EnumField(ThreeStateBool, 5, default='NONE') | |
| 311 | 327 |
| 312 | 328 |
| 313 class BotEventsRequest(messages.Message): | 329 class BotEventsRequest(messages.Message): |
| 314 """Request to get events for a bot.""" | 330 """Request to get events for a bot.""" |
| 315 limit = messages.IntegerField(1, default=200) | 331 limit = messages.IntegerField(1, default=200) |
| 316 cursor = messages.StringField(2) | 332 cursor = messages.StringField(2) |
| 317 # These should be DateTimeField but endpoints + protorpc have trouble encoding | 333 # These should be DateTimeField but endpoints + protorpc have trouble encoding |
| 318 # this message in a GET request, this is due to DateTimeField's special | 334 # this message in a GET request, this is due to DateTimeField's special |
| 319 # encoding in protorpc-1.0/protorpc/message_types.py that is bypassed when | 335 # encoding in protorpc-1.0/protorpc/message_types.py that is bypassed when |
| 320 # using endpoints-1.0/endpoints/protojson.py to add GET query parameter | 336 # using endpoints-1.0/endpoints/protojson.py to add GET query parameter |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 | 442 |
| 427 | 443 |
| 428 class DeletedResponse(messages.Message): | 444 class DeletedResponse(messages.Message): |
| 429 """Indicates whether a bot was deleted.""" | 445 """Indicates whether a bot was deleted.""" |
| 430 deleted = messages.BooleanField(1) | 446 deleted = messages.BooleanField(1) |
| 431 | 447 |
| 432 | 448 |
| 433 class TerminateResponse(messages.Message): | 449 class TerminateResponse(messages.Message): |
| 434 """Returns the pseudo taskid to wait for the bot to shut down.""" | 450 """Returns the pseudo taskid to wait for the bot to shut down.""" |
| 435 task_id = messages.StringField(1) | 451 task_id = messages.StringField(1) |
| OLD | NEW |