Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: third_party/google-endpoints/endpoints/api_backend.py

Issue 2666783008: Add google-endpoints to third_party/. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/google-endpoints/endpoints/api_backend.py
diff --git a/third_party/google-endpoints/endpoints/api_backend.py b/third_party/google-endpoints/endpoints/api_backend.py
new file mode 100644
index 0000000000000000000000000000000000000000..accd19d4852fbdb088d9675edfe3db692c46c62a
--- /dev/null
+++ b/third_party/google-endpoints/endpoints/api_backend.py
@@ -0,0 +1,98 @@
+# Copyright 2016 Google Inc. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Interface to the BackendService that serves API configurations."""
+
+import logging
+
+from protorpc import message_types
+from protorpc import messages
+from protorpc import remote
+
+
+package = 'google.appengine.endpoints'
+
+
+__all__ = [
+ 'GetApiConfigsRequest',
+ 'LogMessagesRequest',
+ 'ApiConfigList',
+ 'BackendService',
+ 'package',
+]
+
+
+class GetApiConfigsRequest(messages.Message):
+ """Request body for fetching API configs."""
+ appRevision = messages.StringField(1) # pylint: disable=g-bad-name
+
+
+class ApiConfigList(messages.Message):
+ """List of API configuration file contents."""
+ items = messages.StringField(1, repeated=True)
+
+
+class LogMessagesRequest(messages.Message):
+ """Request body for log messages sent by Swarm FE."""
+
+ class LogMessage(messages.Message):
+ """A single log message within a LogMessagesRequest."""
+
+ class Level(messages.Enum):
+ """Levels that can be specified for a log message."""
+ debug = logging.DEBUG
+ info = logging.INFO
+ warning = logging.WARNING
+ error = logging.ERROR
+ critical = logging.CRITICAL
+
+ level = messages.EnumField(Level, 1)
+ message = messages.StringField(2, required=True)
+
+ messages = messages.MessageField(LogMessage, 1, repeated=True)
+
+
+class BackendService(remote.Service):
+ """API config enumeration service used by Google API Server.
+
+ This is a simple API providing a list of APIs served by this App Engine
+ instance. It is called by the Google API Server during app deployment
+ to get an updated interface for each of the supported APIs.
+ """
+
+ # Silence lint warning about method name, this is required for interop.
+ # pylint: disable=g-bad-name
+ @remote.method(GetApiConfigsRequest, ApiConfigList)
+ def getApiConfigs(self, request):
+ """Return a list of active APIs and their configuration files.
+
+ Args:
+ request: A request which may contain an app revision
+
+ Returns:
+ List of ApiConfigMessages
+ """
+ raise NotImplementedError()
+
+ @remote.method(LogMessagesRequest, message_types.VoidMessage)
+ def logMessages(self, request):
+ """Write a log message from the Swarm FE to the log.
+
+ Args:
+ request: A log message request.
+
+ Returns:
+ Void message.
+ """
+ raise NotImplementedError()

Powered by Google App Engine
This is Rietveld 408576698