| 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 Swarming Server endpoints handlers.""" | 5 """This module defines Swarming Server endpoints handlers.""" |
| 6 | 6 |
| 7 import datetime | 7 import datetime |
| 8 import logging | 8 import logging |
| 9 | 9 |
| 10 from google.appengine.api import datastore_errors | 10 from google.appengine.api import datastore_errors |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 def _query_from_request(self, request, sort=None): | 416 def _query_from_request(self, request, sort=None): |
| 417 """Returns a TaskResultSummary query.""" | 417 """Returns a TaskResultSummary query.""" |
| 418 start = message_conversion.epoch_to_datetime(request.start) | 418 start = message_conversion.epoch_to_datetime(request.start) |
| 419 end = message_conversion.epoch_to_datetime(request.end) | 419 end = message_conversion.epoch_to_datetime(request.end) |
| 420 return task_result.get_result_summaries_query( | 420 return task_result.get_result_summaries_query( |
| 421 start, end, | 421 start, end, |
| 422 sort or request.sort.name.lower(), | 422 sort or request.sort.name.lower(), |
| 423 request.state.name.lower(), | 423 request.state.name.lower(), |
| 424 request.tags) | 424 request.tags) |
| 425 | 425 |
| 426 @gae_ts_mon.instrument_endpoint() |
| 427 @auth.endpoints_method( |
| 428 message_types.VoidMessage, swarming_rpcs.TasksTags, |
| 429 http_method='GET') |
| 430 @auth.require(acl.is_privileged_user) |
| 431 def tags(self, _request): |
| 432 """Returns the cached set of tags currently seen in the fleet.""" |
| 433 tags = task_result.TagAggregation.KEY.get() |
| 434 ft = [ |
| 435 swarming_rpcs.StringListPair(key=t.tag, value=t.values) |
| 436 for t in tags.tags |
| 437 ] |
| 438 return swarming_rpcs.TasksTags(tasks_tags=ft, ts=tags.ts) |
| 439 |
| 426 | 440 |
| 427 BotId = endpoints.ResourceContainer( | 441 BotId = endpoints.ResourceContainer( |
| 428 message_types.VoidMessage, | 442 message_types.VoidMessage, |
| 429 bot_id=messages.StringField(1, required=True)) | 443 bot_id=messages.StringField(1, required=True)) |
| 430 | 444 |
| 431 | 445 |
| 432 BotEventsRequest = endpoints.ResourceContainer( | 446 BotEventsRequest = endpoints.ResourceContainer( |
| 433 swarming_rpcs.BotEventsRequest, | 447 swarming_rpcs.BotEventsRequest, |
| 434 bot_id=messages.StringField(1, required=True)) | 448 bot_id=messages.StringField(1, required=True)) |
| 435 | 449 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 def get_routes(): | 698 def get_routes(): |
| 685 return ( | 699 return ( |
| 686 endpoints_webapp2.api_routes(SwarmingServerService) + | 700 endpoints_webapp2.api_routes(SwarmingServerService) + |
| 687 endpoints_webapp2.api_routes(SwarmingTaskService) + | 701 endpoints_webapp2.api_routes(SwarmingTaskService) + |
| 688 endpoints_webapp2.api_routes(SwarmingTasksService) + | 702 endpoints_webapp2.api_routes(SwarmingTasksService) + |
| 689 endpoints_webapp2.api_routes(SwarmingBotService) + | 703 endpoints_webapp2.api_routes(SwarmingBotService) + |
| 690 endpoints_webapp2.api_routes(SwarmingBotsService) + | 704 endpoints_webapp2.api_routes(SwarmingBotsService) + |
| 691 # components.config endpoints for validation and configuring of luci-config | 705 # components.config endpoints for validation and configuring of luci-config |
| 692 # service URL. | 706 # service URL. |
| 693 endpoints_webapp2.api_routes(config.ConfigApi)) | 707 endpoints_webapp2.api_routes(config.ConfigApi)) |
| OLD | NEW |