| OLD | NEW |
| 1 # Copyright 2014 The LUCI Authors. All rights reserved. | 1 # Copyright 2014 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 Isolate Server frontend url handlers.""" | 5 """This module defines Isolate Server frontend url handlers.""" |
| 6 | 6 |
| 7 import binascii | 7 import binascii |
| 8 import datetime | 8 import datetime |
| 9 import hashlib | 9 import hashlib |
| 10 import logging | 10 import logging |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 'Invalid offset %d. Offset must be between 0 and content length.' % | 309 'Invalid offset %d. Offset must be between 0 and content length.' % |
| 310 offset) | 310 offset) |
| 311 stats.add_entry( | 311 stats.add_entry( |
| 312 stats.RETURN, | 312 stats.RETURN, |
| 313 stored.compressed_size - offset, | 313 stored.compressed_size - offset, |
| 314 'GS; %s' % stored.key.id()) | 314 'GS; %s' % stored.key.id()) |
| 315 return RetrievedContent(url=self.gs_url_signer.get_download_url( | 315 return RetrievedContent(url=self.gs_url_signer.get_download_url( |
| 316 filename=key.id(), | 316 filename=key.id(), |
| 317 expiration=DEFAULT_LINK_EXPIRATION)) | 317 expiration=DEFAULT_LINK_EXPIRATION)) |
| 318 | 318 |
| 319 @auth.endpoints_method(message_types.VoidMessage, ServerDetails) | 319 # TODO(kjlubick): Rework these APIs, the http_method part seems to break |
| 320 # API explorer. |
| 321 @auth.endpoints_method(message_types.VoidMessage, ServerDetails, |
| 322 http_method='GET') |
| 320 @auth.require(acl.isolate_readable) | 323 @auth.require(acl.isolate_readable) |
| 321 def server_details(self, _request): | 324 def server_details(self, _request): |
| 322 return ServerDetails(server_version=utils.get_app_version()) | 325 return ServerDetails(server_version=utils.get_app_version()) |
| 323 | 326 |
| 324 ### Utility | 327 ### Utility |
| 325 | 328 |
| 326 @staticmethod | 329 @staticmethod |
| 327 def storage_helper(request, uploaded_to_gs): | 330 def storage_helper(request, uploaded_to_gs): |
| 328 """Implement shared logic between store_inline and finalize_gs. | 331 """Implement shared logic between store_inline and finalize_gs. |
| 329 | 332 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 url = '/internal/taskqueue/tag/%s/%s' % ( | 544 url = '/internal/taskqueue/tag/%s/%s' % ( |
| 542 collection.namespace.namespace, | 545 collection.namespace.namespace, |
| 543 utils.datetime_to_timestamp(utils.utcnow())) | 546 utils.datetime_to_timestamp(utils.utcnow())) |
| 544 payload = ''.join( | 547 payload = ''.join( |
| 545 binascii.unhexlify(digest.digest) for digest in collection.items) | 548 binascii.unhexlify(digest.digest) for digest in collection.items) |
| 546 return utils.enqueue_task(url, 'tag', payload=payload) | 549 return utils.enqueue_task(url, 'tag', payload=payload) |
| 547 | 550 |
| 548 | 551 |
| 549 def get_routes(): | 552 def get_routes(): |
| 550 return endpoints_webapp2.api_routes(IsolateService) | 553 return endpoints_webapp2.api_routes(IsolateService) |
| OLD | NEW |