| 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 """Cloud endpoints for the Machine Provider API.""" | 5 """Cloud endpoints for the Machine Provider API.""" |
| 6 | 6 |
| 7 import hashlib | 7 import hashlib |
| 8 import json | 8 import json |
| 9 import logging | 9 import logging |
| 10 | 10 |
| 11 import endpoints | 11 import endpoints |
| 12 | 12 |
| 13 from google.appengine import runtime | 13 from google.appengine import runtime |
| 14 from google.appengine.api import app_identity | 14 from google.appengine.api import app_identity |
| 15 from google.appengine.api import datastore_errors | 15 from google.appengine.api import datastore_errors |
| 16 from google.appengine.ext import ndb | 16 from google.appengine.ext import ndb |
| 17 | 17 |
| 18 from protorpc import protobuf | 18 from protorpc import protobuf |
| 19 from protorpc import remote | 19 from protorpc import remote |
| 20 | 20 |
| 21 import gae_ts_mon | 21 import gae_ts_mon |
| 22 | 22 |
| 23 from components import auth | 23 from components import auth |
| 24 from components import pubsub | 24 from components import pubsub |
| 25 from components import utils | 25 from components import utils |
| 26 from components.machine_provider import rpc_messages | 26 from components.machine_provider import rpc_messages |
| 27 | 27 |
| 28 import acl | 28 import acl |
| 29 import config |
| 29 import metrics | 30 import metrics |
| 30 import models | 31 import models |
| 31 | 32 |
| 32 | 33 |
| 33 PUBSUB_DEFAULT_PROJECT = app_identity.get_application_id() | 34 PUBSUB_DEFAULT_PROJECT = app_identity.get_application_id() |
| 34 | 35 |
| 35 | 36 |
| 36 @auth.endpoints_api(name='catalog', version='v1') | 37 @auth.endpoints_api(name='catalog', version='v1') |
| 37 class CatalogEndpoints(remote.Service): | 38 class CatalogEndpoints(remote.Service): |
| 38 """Implements cloud endpoints for the Machine Provider Catalog.""" | 39 """Implements cloud endpoints for the Machine Provider Catalog.""" |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 'LeaseReleaseRequest referred to already reclaimed LeaseRequest: %s', | 523 'LeaseReleaseRequest referred to already reclaimed LeaseRequest: %s', |
| 523 request_hash, | 524 request_hash, |
| 524 ) | 525 ) |
| 525 return rpc_messages.LeaseReleaseRequestError.ALREADY_RECLAIMED | 526 return rpc_messages.LeaseReleaseRequestError.ALREADY_RECLAIMED |
| 526 logging.info('Releasing LeaseRequest: %s', request_hash) | 527 logging.info('Releasing LeaseRequest: %s', request_hash) |
| 527 request.released = True | 528 request.released = True |
| 528 request.put() | 529 request.put() |
| 529 | 530 |
| 530 | 531 |
| 531 def create_endpoints_app(): | 532 def create_endpoints_app(): |
| 532 return endpoints.api_server([CatalogEndpoints, MachineProviderEndpoints]) | 533 return endpoints.api_server([ |
| 534 CatalogEndpoints, |
| 535 MachineProviderEndpoints, |
| 536 config.ConfigApi, |
| 537 ]) |
| OLD | NEW |