-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move in adminconsole quickstart samples.
- Loading branch information
Jerjou Cheng
committed
Jul 8, 2015
1 parent
4368528
commit 7c5d5f8
Showing
5 changed files
with
95 additions
and
3 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Copyright 2013 Google Inc. All Rights Reserved. | ||
|
||
"""Demo client for the Google App Engine Administration API. | ||
This sample client demonstrates how to use the API and manipulate | ||
apps deployed on Google App Engine. | ||
""" | ||
|
||
__author__ = 'sarmad@google.com (Sarmad Gilani)' | ||
|
||
from oauth2client.client import GoogleCredentials | ||
from googleapiclient.discovery import build | ||
|
||
|
||
def main(): | ||
# Authenticate and construct service. | ||
service = build('appengine', 'v1beta2', | ||
credentials=GoogleCredentials.get_application_default()) | ||
|
||
# Get a list of your applications. | ||
response = service.apps().list().execute() | ||
apps_list = response.get('apps', []) | ||
|
||
for app in apps_list: | ||
print 'App Title: ', app['title'] | ||
print 'App ID: ', app['appId'] | ||
|
||
# List all modules on the application. | ||
response = service.apps().modules().list( | ||
appId=app['appId']).execute() | ||
modules_list = response.get('modules', []) | ||
|
||
print ' Modules for this app:' | ||
for module in modules_list: | ||
print ' Module ID: ', module['moduleId'] | ||
|
||
# List all versions on this module. | ||
response = service.apps().modules().versions().list( | ||
appId=app['appId'], | ||
moduleId=module['moduleId']).execute() | ||
versions_list = response.get('versions', []) | ||
|
||
print ' Versions on this module: ' | ||
for version in versions_list: | ||
print ' Version ID: ', version['versionId'] | ||
print ' Runtime: ', version['runtime'] | ||
print ' Deployment Timestamp: ', version['deployedTimestamp'] | ||
if version['isDefault']: | ||
print ' ** This is the default version. **' | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright 2015, Google, Inc. | ||
# 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. | ||
# | ||
"""Tests for appengine admin console api quickstart.""" | ||
|
||
import re | ||
import sys | ||
import unittest | ||
|
||
from appengine.adminconsole.samples import quickstart | ||
from tests import CloudBaseTest | ||
|
||
|
||
class TestQuickstart(unittest.TestCase): | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
if not hasattr(sys.stdout, 'getvalue'): | ||
cls.skipTest('Test must be in buffered mode to run.') | ||
|
||
def test_main(self): | ||
quickstart.main() | ||
output = sys.stdout.getvalue().strip() | ||
self.assertRegexpMatches( | ||
output, re.compile(r'App Title:\s*\w.*App ID:\s*\w', re.S)) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters