google/appengine/api/modules/ModulesService.php

Table of Contents
Copyright 2007 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.

\google\appengine\api\modules\ModulesService

Package: Default

Methods

methodpublicgetCurrentInstanceId() : string
static

Gets the id of the currently running instance.

Returns
TypeDescription
stringThe name of the current module. For example, if this is instance 2 of version "v1" of module "module5" for app "my-app", this function will return "2". For automatically-scaled modules, this function will return a unique hex string for the instance (e.g. "00c61b117c7f7fd0ce9e1325a04b8f0df30deaaf").
methodpublicgetCurrentModuleName() : string
static

Gets the name of the currently running module.

Returns
TypeDescription
stringThe name of the current module. For example, if this is version "v1" of module "module5" for app "my-app", this function will return "module5".
methodpublicgetCurrentVersionName() : string
static

Gets the version of the currently running module.

Returns
TypeDescription
stringThe name of the current module. For example, if this is version "v1" of module "module5" for app "my-app", this function will return "v1".
methodpublicgetDefaultVersion(string $module = null) : string
static

Get the default version of a module.

Parameters
NameTypeDescription
$modulestring

The name of the module to retrieve the default versions for. If null then the default versions for the current module will be retrieved.

Returns
TypeDescription
stringThe default version of the module.
Throws
ExceptionDescription
\InvalidArgumentExceptionIf $module is not a string.
\google\appengine\api\modules\ModulesExceptionIf the given $module is invalid or if no default version could be found.
methodpublicgetHostname(string $module = null, string $version = null, string $instance = null) : string
static

Returns the hostname to use when contacting a module.

*

Parameters
NameTypeDescription
$modulestring

The name of the module whose hostname should be returned. If null then the hostname of the current module will be returned.

$versionstring

The version of the module whose hostname should be returned. If null then the hostname for the version of the current instance will be returned.

$instancestring

The instance whose hostname should be returned. If null then the load balanced hostname for the module will be returned. If the module is not a fixed module then the instance parameter is ignored.

Returns
TypeDescription
stringThe valid canonical hostname that can be used to communicate with the given module/version/instance e.g. "0.version1.module5.myapp.appspot.com".
Throws
ExceptionDescription
\InvalidArgumentExceptionIf $module or $version is not a string or if $instance is not a string or integer.
\google\appengine\api\modules\ModulesExceptionif the given combination of $module and $instance is invalid.
methodpublicgetModules() : string[]
static

Gets an array of all the modules for the application.

Returns
TypeDescription
string[]An array of string containing the names of the modules associated with the application. The 'default' module will be included if it exists, as will the name of the module that is associated with the instance that calls this function.
methodpublicgetNumInstances(string $module = null, string $version = null) : integer
static

Get the number of instances set for a version of a module.

This function does not work on automatically-scaled modules.

Parameters
NameTypeDescription
$modulestring

The name of the module to retrieve the count for. If null then the count for the current module will be retrieved.

$versionstring

The version of the module to retrieve the count for. If null then the count for the version of the current instance will be retrieved.

Returns
TypeDescription
integerThe number of instances set for the current module version.
Throws
ExceptionDescription
\InvalidArgumentExceptionIf $module or $version is not a string.
\google\appengine\api\modules\ModulesExceptionif the given combination of $module and $version is invalid.
methodpublicgetVersions(string $module = null) : string[]
static

Get an array of all versions associated with a module.

Parameters
NameTypeDescription
$modulestring

The name of the module to retrieve the versions for. If null then the versions for the current module will be retrieved.

Returns
TypeDescription
string[]An array of strings containing the names of versions associated with the module. The current version will also be included in this list.
Throws
ExceptionDescription
\InvalidArgumentExceptionIf $module is not a string.
\google\appengine\api\modules\ModulesExceptionIf the given $module isn't valid.
\google\appengine\api\modules\TransientModulesExceptionif there is an issue fetching the information.
methodpublicsetNumInstances( $instances, string $module = null, string $version = null) : void
static

Set the number of instances for a version of a module.

This function does not work on automatically-scaled modules.

Parameters
NameTypeDescription
$instances
$modulestring

The name of the module to set the instance count for. If null then the instance count for the current module will be set.

$versionstring

The version of the module to set the instance count for. If null then the count for the version of the current instance will be set.

Throws
ExceptionDescription
\InvalidArgumentExceptionIf $instances is not an integer or if $module or $version is not a string.
\google\appengine\api\modules\ModulesExceptionif the given combination of $module and $version is invalid.
\google\appengine\api\modules\TransientModulesExceptionif there is an issue setting the instance count.
methodpublicstartVersion(string $module, string $version) : void
static

Starts all instances of the given version of a module.

*

Parameters
NameTypeDescription
$modulestring

The name of the module to start.

$versionstring

The version of the module to start.

Throws
ExceptionDescription
\InvalidArgumentExceptionIf $module or $version is not a string.
\google\appengine\api\modules\ModulesExceptionif the given combination of $module and $version is invalid.
\google\appengine\api\modules\InvalidModuleStateExceptionif the given $version is already started or cannot be started.
\google\appengine\api\modules\TransientModulesExceptionif there is an issue starting the module version.
methodpublicstopVersion(string $module = null, string $version = null) : void
static

Stops all instances of the given version of a module.

*

Parameters
NameTypeDescription
$modulestring

The name of the module to stop. If null then the current module will be stopped.

$versionstring

The version of the module to stop. If null then the current version will be stopped.

Throws
ExceptionDescription
\InvalidArgumentExceptionIf $module or $version is not a string.
\google\appengine\api\modules\ModulesExceptionif the given combination of $module and $version instance is invalid.
\google\appengine\api\modules\InvalidModuleStateExceptionif the given $version is already stopped or cannot be stopped.
\google\appengine\api\modules\TransientModulesExceptionif there is an issue stopping the module version.
Documentation was generated by phpDocumentor 2.0.0a12.