OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library appengine.api.modules; |
| 6 |
| 7 import 'dart:async'; |
| 8 |
| 9 import 'package:gcloud/service_scope.dart' as ss; |
| 10 |
| 11 abstract class ModulesService { |
| 12 /** |
| 13 * Returns the current running module name. |
| 14 */ |
| 15 String get currentModule; |
| 16 |
| 17 /** |
| 18 * Returns the current running module version. |
| 19 */ |
| 20 String get currentVersion; |
| 21 |
| 22 /** |
| 23 * Returns the current running module instance. |
| 24 */ |
| 25 String get currentInstance; |
| 26 |
| 27 /** |
| 28 * Completes with the default version for module [module]. |
| 29 */ |
| 30 Future<String> defaultVersion(String module); |
| 31 |
| 32 /** |
| 33 * Completes with a list of all modules. |
| 34 */ |
| 35 Future<List<String>> modules(); |
| 36 |
| 37 /** |
| 38 * Completes with a list of all versions for module [module]. |
| 39 */ |
| 40 Future<List<String>> versions(String module); |
| 41 |
| 42 /** |
| 43 * Completes with a hostname, that can be used to contact a given part of an |
| 44 * application. |
| 45 * |
| 46 * Without any arguments, the result is the hostname for the |
| 47 * default module and default version. |
| 48 * |
| 49 * If [module] is specified, the result is the hostname for the |
| 50 * specified module and the default version. |
| 51 * |
| 52 * If [module] and [version] is specified, the result is the hostname for the |
| 53 * specified module and the specified version. |
| 54 * |
| 55 * Finally if [instance] is also specified, the result is the hostname for |
| 56 * contacting a specific running instance for the specified [module] and |
| 57 * [version]. |
| 58 * |
| 59 * For applications served from the appspot.com domain, some of the dots |
| 60 * used to separate the different parts of the hostname will be replaced |
| 61 * by `-dot-`. This is to support application access using HTTPS, and is |
| 62 * required as Google is no longer issuing SSL certificates for |
| 63 * double-wildcard domains hosted at appspot.com (i.e. *.*.appspot.com). |
| 64 */ |
| 65 Future<String> hostname([String module, String version, String instance]); |
| 66 } |
| 67 |
| 68 /** |
| 69 * Register a new [ModulesService] object. |
| 70 * |
| 71 * Calling this outside of a service scope or calling it more than once inside |
| 72 * the same service scope will result in an error. |
| 73 * |
| 74 * See the `package:gcloud/service_scope.dart` library for more information. |
| 75 */ |
| 76 void registerModulesService(ModulesService service) { |
| 77 ss.register(#_appengine.modules, service); |
| 78 } |
| 79 |
| 80 /** |
| 81 * The modules service. |
| 82 * |
| 83 * Request handlers will be run inside a service scope which contains the |
| 84 * modules service. |
| 85 */ |
| 86 ModulesService get modulesService => ss.lookup(#_appengine.modules); |
OLD | NEW |