 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 | |
| 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 | |
| 65 | |
| 51 ### Server related. | 66 ### Server related. | 
| 52 | 67 | 
| 53 | 68 | 
| 54 class ServerDetails(messages.Message): | 69 class ServerDetails(messages.Message): | 
| 55 """Reports the server version.""" | 70 """Reports the server version.""" | 
| 56 server_version = messages.StringField(1) | 71 server_version = messages.StringField(1) | 
| 57 | 72 | 
| 58 | 73 | 
| 59 class FileContentRequest(messages.Message): | 74 class FileContentRequest(messages.Message): | 
| 60 """Content of a file.""" | 75 """Content of a file.""" | 
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 ### Bot-Related Requests | 316 ### Bot-Related Requests | 
| 302 | 317 | 
| 303 | 318 | 
| 304 class BotsRequest(messages.Message): | 319 class BotsRequest(messages.Message): | 
| 305 """Information needed to request bot data.""" | 320 """Information needed to request bot data.""" | 
| 306 limit = messages.IntegerField(1, default=200) | 321 limit = messages.IntegerField(1, default=200) | 
| 307 cursor = messages.StringField(2) | 322 cursor = messages.StringField(2) | 
| 308 # Must be a list of 'key:value' strings to filter the returned list of bots | 323 # Must be a list of 'key:value' strings to filter the returned list of bots | 
| 309 # on. | 324 # on. | 
| 310 dimensions = messages.StringField(3, repeated=True) | 325 dimensions = messages.StringField(3, repeated=True) | 
| 326 quarantined = messages.EnumField(ThreeStateBool, 4, default='NONE') | |
| 327 is_dead = messages.EnumField(ThreeStateBool, 5, default='NONE') | |
| 311 | 328 | 
| 312 | 329 | 
| 330 class BotsCountRequest(messages.Message): | |
| 331 """Information needed to request bot counts.""" | |
| 332 # Must be a list of 'key:value' strings to filter the returned list of bots | |
| 333 # on. | |
| 334 dimensions = messages.StringField(1, repeated=True) | |
| 335 | |
| 
M-A Ruel
2016/08/10 12:38:33
add one line
 | |
| 313 class BotEventsRequest(messages.Message): | 336 class BotEventsRequest(messages.Message): | 
| 314 """Request to get events for a bot.""" | 337 """Request to get events for a bot.""" | 
| 315 limit = messages.IntegerField(1, default=200) | 338 limit = messages.IntegerField(1, default=200) | 
| 316 cursor = messages.StringField(2) | 339 cursor = messages.StringField(2) | 
| 317 # These should be DateTimeField but endpoints + protorpc have trouble encoding | 340 # These should be DateTimeField but endpoints + protorpc have trouble encoding | 
| 318 # this message in a GET request, this is due to DateTimeField's special | 341 # 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 | 342 # 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 | 343 # using endpoints-1.0/endpoints/protojson.py to add GET query parameter | 
| 321 # support. | 344 # support. | 
| 322 end = messages.FloatField(3) | 345 end = messages.FloatField(3) | 
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 | 449 | 
| 427 | 450 | 
| 428 class DeletedResponse(messages.Message): | 451 class DeletedResponse(messages.Message): | 
| 429 """Indicates whether a bot was deleted.""" | 452 """Indicates whether a bot was deleted.""" | 
| 430 deleted = messages.BooleanField(1) | 453 deleted = messages.BooleanField(1) | 
| 431 | 454 | 
| 432 | 455 | 
| 433 class TerminateResponse(messages.Message): | 456 class TerminateResponse(messages.Message): | 
| 434 """Returns the pseudo taskid to wait for the bot to shut down.""" | 457 """Returns the pseudo taskid to wait for the bot to shut down.""" | 
| 435 task_id = messages.StringField(1) | 458 task_id = messages.StringField(1) | 
| OLD | NEW |