OLD | NEW |
(Empty) | |
| 1 # Copyright 2016 Google Inc. All Rights Reserved. |
| 2 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at |
| 6 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # |
| 9 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 # See the License for the specific language governing permissions and |
| 13 # limitations under the License. |
| 14 |
| 15 """Interface to the BackendService that serves API configurations.""" |
| 16 |
| 17 import logging |
| 18 |
| 19 from protorpc import message_types |
| 20 from protorpc import messages |
| 21 from protorpc import remote |
| 22 |
| 23 |
| 24 package = 'google.appengine.endpoints' |
| 25 |
| 26 |
| 27 __all__ = [ |
| 28 'GetApiConfigsRequest', |
| 29 'LogMessagesRequest', |
| 30 'ApiConfigList', |
| 31 'BackendService', |
| 32 'package', |
| 33 ] |
| 34 |
| 35 |
| 36 class GetApiConfigsRequest(messages.Message): |
| 37 """Request body for fetching API configs.""" |
| 38 appRevision = messages.StringField(1) # pylint: disable=g-bad-name |
| 39 |
| 40 |
| 41 class ApiConfigList(messages.Message): |
| 42 """List of API configuration file contents.""" |
| 43 items = messages.StringField(1, repeated=True) |
| 44 |
| 45 |
| 46 class LogMessagesRequest(messages.Message): |
| 47 """Request body for log messages sent by Swarm FE.""" |
| 48 |
| 49 class LogMessage(messages.Message): |
| 50 """A single log message within a LogMessagesRequest.""" |
| 51 |
| 52 class Level(messages.Enum): |
| 53 """Levels that can be specified for a log message.""" |
| 54 debug = logging.DEBUG |
| 55 info = logging.INFO |
| 56 warning = logging.WARNING |
| 57 error = logging.ERROR |
| 58 critical = logging.CRITICAL |
| 59 |
| 60 level = messages.EnumField(Level, 1) |
| 61 message = messages.StringField(2, required=True) |
| 62 |
| 63 messages = messages.MessageField(LogMessage, 1, repeated=True) |
| 64 |
| 65 |
| 66 class BackendService(remote.Service): |
| 67 """API config enumeration service used by Google API Server. |
| 68 |
| 69 This is a simple API providing a list of APIs served by this App Engine |
| 70 instance. It is called by the Google API Server during app deployment |
| 71 to get an updated interface for each of the supported APIs. |
| 72 """ |
| 73 |
| 74 # Silence lint warning about method name, this is required for interop. |
| 75 # pylint: disable=g-bad-name |
| 76 @remote.method(GetApiConfigsRequest, ApiConfigList) |
| 77 def getApiConfigs(self, request): |
| 78 """Return a list of active APIs and their configuration files. |
| 79 |
| 80 Args: |
| 81 request: A request which may contain an app revision |
| 82 |
| 83 Returns: |
| 84 List of ApiConfigMessages |
| 85 """ |
| 86 raise NotImplementedError() |
| 87 |
| 88 @remote.method(LogMessagesRequest, message_types.VoidMessage) |
| 89 def logMessages(self, request): |
| 90 """Write a log message from the Swarm FE to the log. |
| 91 |
| 92 Args: |
| 93 request: A log message request. |
| 94 |
| 95 Returns: |
| 96 Void message. |
| 97 """ |
| 98 raise NotImplementedError() |
OLD | NEW |