| 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 import os | 9 import os |
| 10 | 10 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 @swarming_api.api_class(resource_name='server', path='server') | 128 @swarming_api.api_class(resource_name='server', path='server') |
| 129 class SwarmingServerService(remote.Service): | 129 class SwarmingServerService(remote.Service): |
| 130 @gae_ts_mon.instrument_endpoint() | 130 @gae_ts_mon.instrument_endpoint() |
| 131 @auth.endpoints_method( | 131 @auth.endpoints_method( |
| 132 message_types.VoidMessage, swarming_rpcs.ServerDetails, | 132 message_types.VoidMessage, swarming_rpcs.ServerDetails, |
| 133 http_method='GET') | 133 http_method='GET') |
| 134 @auth.require(acl.is_bot_or_user) | 134 @auth.require(acl.is_bot_or_user) |
| 135 def details(self, _request): | 135 def details(self, _request): |
| 136 """Returns information about the server.""" | 136 """Returns information about the server.""" |
| 137 host = 'https://' + os.environ['HTTP_HOST'] | 137 host = 'https://' + os.environ['HTTP_HOST'] |
| 138 |
| 139 mpp = '' |
| 140 if config.settings().mp and config.settings().mp.server: |
| 141 mpp = config.settings().mp.server |
| 142 |
| 138 return swarming_rpcs.ServerDetails( | 143 return swarming_rpcs.ServerDetails( |
| 139 bot_version = bot_code.get_bot_version(host), | 144 bot_version = bot_code.get_bot_version(host), |
| 140 server_version = utils.get_app_version()) | 145 server_version = utils.get_app_version(), |
| 146 machine_provider_prefix = mpp, |
| 147 milo_prefix = config.settings().milo_server_prefix, |
| 148 sk_revision_prefix = config.settings().sk_revision_prefix) |
| 141 | 149 |
| 142 @gae_ts_mon.instrument_endpoint() | 150 @gae_ts_mon.instrument_endpoint() |
| 143 @auth.endpoints_method( | 151 @auth.endpoints_method( |
| 144 message_types.VoidMessage, swarming_rpcs.BootstrapToken) | 152 message_types.VoidMessage, swarming_rpcs.BootstrapToken) |
| 145 @auth.require(acl.is_bootstrapper) | 153 @auth.require(acl.is_bootstrapper) |
| 146 def token(self, _request): | 154 def token(self, _request): |
| 147 """Returns a token to bootstrap a new bot.""" | 155 """Returns a token to bootstrap a new bot.""" |
| 148 return swarming_rpcs.BootstrapToken( | 156 return swarming_rpcs.BootstrapToken( |
| 149 bootstrap_token = bot_code.generate_bootstrap_token(), | 157 bootstrap_token = bot_code.generate_bootstrap_token(), |
| 150 ) | 158 ) |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 def get_routes(): | 737 def get_routes(): |
| 730 return ( | 738 return ( |
| 731 endpoints_webapp2.api_routes(SwarmingServerService) + | 739 endpoints_webapp2.api_routes(SwarmingServerService) + |
| 732 endpoints_webapp2.api_routes(SwarmingTaskService) + | 740 endpoints_webapp2.api_routes(SwarmingTaskService) + |
| 733 endpoints_webapp2.api_routes(SwarmingTasksService) + | 741 endpoints_webapp2.api_routes(SwarmingTasksService) + |
| 734 endpoints_webapp2.api_routes(SwarmingBotService) + | 742 endpoints_webapp2.api_routes(SwarmingBotService) + |
| 735 endpoints_webapp2.api_routes(SwarmingBotsService) + | 743 endpoints_webapp2.api_routes(SwarmingBotsService) + |
| 736 # components.config endpoints for validation and configuring of luci-config | 744 # components.config endpoints for validation and configuring of luci-config |
| 737 # service URL. | 745 # service URL. |
| 738 endpoints_webapp2.api_routes(config.ConfigApi)) | 746 endpoints_webapp2.api_routes(config.ConfigApi)) |
| OLD | NEW |