 Chromium Code Reviews
 Chromium Code Reviews Issue 2220373003:
  Allow botlist API call to respond to quarantined: and is_dead:  (Closed) 
  Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
    
  
    Issue 2220373003:
  Allow botlist API call to respond to quarantined: and is_dead:  (Closed) 
  Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master| 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 | |
| 
M-A Ruel
2016/08/09 18:05:27
two empty lines between file level symbols.
 
kjlubick
2016/08/09 19:25:03
Done.
 | |
| 56 def to_bool(three_state): | |
| 
M-A Ruel
2016/08/09 18:05:27
you could add:
if three_state in (None, True, Fal
 
kjlubick
2016/08/09 19:25:03
Done.
 | |
| 57 if three_state == ThreeStateBool.FALSE: | |
| 58 return False | |
| 59 if three_state == ThreeStateBool.TRUE: | |
| 60 return True | |
| 61 | |
| 51 ### Server related. | 62 ### Server related. | 
| 52 | 63 | 
| 53 | 64 | 
| 54 class ServerDetails(messages.Message): | 65 class ServerDetails(messages.Message): | 
| 55 """Reports the server version.""" | 66 """Reports the server version.""" | 
| 56 server_version = messages.StringField(1) | 67 server_version = messages.StringField(1) | 
| 57 | 68 | 
| 58 | 69 | 
| 59 class FileContentRequest(messages.Message): | 70 class FileContentRequest(messages.Message): | 
| 60 """Content of a file.""" | 71 """Content of a file.""" | 
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 ### Bot-Related Requests | 312 ### Bot-Related Requests | 
| 302 | 313 | 
| 303 | 314 | 
| 304 class BotsRequest(messages.Message): | 315 class BotsRequest(messages.Message): | 
| 305 """Information needed to request bot data.""" | 316 """Information needed to request bot data.""" | 
| 306 limit = messages.IntegerField(1, default=200) | 317 limit = messages.IntegerField(1, default=200) | 
| 307 cursor = messages.StringField(2) | 318 cursor = messages.StringField(2) | 
| 308 # Must be a list of 'key:value' strings to filter the returned list of bots | 319 # Must be a list of 'key:value' strings to filter the returned list of bots | 
| 309 # on. | 320 # on. | 
| 310 dimensions = messages.StringField(3, repeated=True) | 321 dimensions = messages.StringField(3, repeated=True) | 
| 322 quarantined = messages.EnumField(ThreeStateBool, 4, default='NONE') | |
| 323 is_dead = messages.EnumField(ThreeStateBool, 5, default='NONE') | |
| 311 | 324 | 
| 312 | 325 | 
| 313 class BotEventsRequest(messages.Message): | 326 class BotEventsRequest(messages.Message): | 
| 314 """Request to get events for a bot.""" | 327 """Request to get events for a bot.""" | 
| 315 limit = messages.IntegerField(1, default=200) | 328 limit = messages.IntegerField(1, default=200) | 
| 316 cursor = messages.StringField(2) | 329 cursor = messages.StringField(2) | 
| 317 # These should be DateTimeField but endpoints + protorpc have trouble encoding | 330 # These should be DateTimeField but endpoints + protorpc have trouble encoding | 
| 318 # this message in a GET request, this is due to DateTimeField's special | 331 # 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 | 332 # 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 | 333 # 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 | 439 | 
| 427 | 440 | 
| 428 class DeletedResponse(messages.Message): | 441 class DeletedResponse(messages.Message): | 
| 429 """Indicates whether a bot was deleted.""" | 442 """Indicates whether a bot was deleted.""" | 
| 430 deleted = messages.BooleanField(1) | 443 deleted = messages.BooleanField(1) | 
| 431 | 444 | 
| 432 | 445 | 
| 433 class TerminateResponse(messages.Message): | 446 class TerminateResponse(messages.Message): | 
| 434 """Returns the pseudo taskid to wait for the bot to shut down.""" | 447 """Returns the pseudo taskid to wait for the bot to shut down.""" | 
| 435 task_id = messages.StringField(1) | 448 task_id = messages.StringField(1) | 
| OLD | NEW |