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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 # TODO(kjlubick): Rework these APIs, the http_method part seems to break | 319 # TODO(kjlubick): Rework these APIs, the http_method part seems to break |
320 # API explorer. | 320 # API explorer. |
321 @auth.endpoints_method(message_types.VoidMessage, ServerDetails, | 321 @auth.endpoints_method( |
| 322 message_types.VoidMessage, ServerDetails, |
322 http_method='GET') | 323 http_method='GET') |
323 @auth.require(acl.isolate_readable) | 324 @auth.require(acl.isolate_readable) |
324 def server_details(self, _request): | 325 def server_details(self, _request): |
325 return ServerDetails(server_version=utils.get_app_version()) | 326 return ServerDetails(server_version=utils.get_app_version()) |
326 | 327 |
327 ### Utility | 328 ### Utility |
328 | 329 |
329 @staticmethod | 330 @staticmethod |
330 def storage_helper(request, uploaded_to_gs): | 331 def storage_helper(request, uploaded_to_gs): |
331 """Implement shared logic between store_inline and finalize_gs. | 332 """Implement shared logic between store_inline and finalize_gs. |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 url = '/internal/taskqueue/tag/%s/%s' % ( | 545 url = '/internal/taskqueue/tag/%s/%s' % ( |
545 collection.namespace.namespace, | 546 collection.namespace.namespace, |
546 utils.datetime_to_timestamp(utils.utcnow())) | 547 utils.datetime_to_timestamp(utils.utcnow())) |
547 payload = ''.join( | 548 payload = ''.join( |
548 binascii.unhexlify(digest.digest) for digest in collection.items) | 549 binascii.unhexlify(digest.digest) for digest in collection.items) |
549 return utils.enqueue_task(url, 'tag', payload=payload) | 550 return utils.enqueue_task(url, 'tag', payload=payload) |
550 | 551 |
551 | 552 |
552 def get_routes(): | 553 def get_routes(): |
553 return endpoints_webapp2.api_routes(IsolateService) | 554 return endpoints_webapp2.api_routes(IsolateService) |
OLD | NEW |