App Engine PHP SDK  v1 rev.445
The PHP runtime is available as an experimental Preview feature.
Static Public Member Functions | List of all members
google\appengine\api\modules\ModulesService Class Reference

Static Public Member Functions

static getCurrentModuleName ()
 
static getCurrentVersionName ()
 
static getCurrentInstanceId ()
 
static getModules ()
 
static getVersions ($module=null)
 
static getDefaultVersion ($module=null)
 
static getNumInstances ($module=null, $version=null)
 
static setNumInstances ($instances, $module=null, $version=null)
 
static startVersion ($module, $version)
 
static stopVersion ($module=null, $version=null)
 
static getHostname ($module=null, $version=null, $instance=null)
 

Member Function Documentation

static google\appengine\api\modules\ModulesService::getCurrentInstanceId ( )
static

Gets the id of the currently running instance.

Returns
string The 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").
static google\appengine\api\modules\ModulesService::getCurrentModuleName ( )
static

Gets the name of the currently running module.

Returns
string The name of the current module. For example, if this is version "v1" of module "module5" for app "my-app", this function will return "module5".
static google\appengine\api\modules\ModulesService::getCurrentVersionName ( )
static

Gets the version of the currently running module.

Returns
string The name of the current module. For example, if this is version "v1" of module "module5" for app "my-app", this function will return "v1".
static google\appengine\api\modules\ModulesService::getDefaultVersion (   $module = null)
static

Get the default version of a module.

Parameters
string$moduleThe name of the module to retrieve the default versions for. If null then the default versions for the current module will be retrieved.
Returns
string The default version of the module.
Exceptions
InvalidArgumentException If $module is not a string.
ModulesExceptionIf the given $module is invalid or if no default version could be found.
static google\appengine\api\modules\ModulesService::getHostname (   $module = null,
  $version = null,
  $instance = null 
)
static

Returns the hostname to use when contacting a module.

  • Parameters
    string$moduleThe name of the module whose hostname should be returned. If null then the hostname of the current module will be returned.
    string$versionThe version of the module whose hostname should be returned. If null then the hostname for the version of the current instance will be returned.
    string$instanceThe 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
    string The valid canonical hostname that can be used to communicate with the given module/version/instance e.g. "0.version1.module5.myapp.appspot.com".
    Exceptions
    InvalidArgumentException If $module or $version is not a string or if $instance is not a string or integer.
    ModulesExceptionif the given combination of $module and $instance is invalid.
static google\appengine\api\modules\ModulesService::getModules ( )
static

Gets an array of all the modules for the application.

Returns
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.
static google\appengine\api\modules\ModulesService::getNumInstances (   $module = null,
  $version = null 
)
static

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

This function does not work on automatically-scaled modules.

Parameters
string$moduleThe name of the module to retrieve the count for. If null then the count for the current module will be retrieved.
string$versionThe 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
integer The number of instances set for the current module version.
Exceptions
InvalidArgumentException If $module or $version is not a string.
ModulesExceptionif the given combination of $module and $version is invalid.
static google\appengine\api\modules\ModulesService::getVersions (   $module = null)
static

Get an array of all versions associated with a module.

Parameters
string$moduleThe name of the module to retrieve the versions for. If null then the versions for the current module will be retrieved.
Returns
string[] An array of strings containing the names of versions associated with the module. The current version will also be included in this list.
Exceptions
InvalidArgumentException If $module is not a string.
ModulesExceptionIf the given $module isn't valid.
TransientModulesExceptionif there is an issue fetching the information.
static google\appengine\api\modules\ModulesService::setNumInstances (   $instances,
  $module = null,
  $version = null 
)
static

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

This function does not work on automatically-scaled modules.

Parameters
string$moduleThe name of the module to set the instance count for. If null then the instance count for the current module will be set.
string$versionThe 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.
Exceptions
InvalidArgumentException If $instances is not an integer or if $module or $version is not a string.
ModulesExceptionif the given combination of $module and $version is invalid.
TransientModulesExceptionif there is an issue setting the instance count.
static google\appengine\api\modules\ModulesService::startVersion (   $module,
  $version 
)
static

Starts all instances of the given version of a module.

  • Parameters
    string$moduleThe name of the module to start.
    string$versionThe version of the module to start.
    Exceptions
    InvalidArgumentException If $module or $version is not a string.
    ModulesExceptionif the given combination of $module and $version is invalid.
    InvalidModuleStateExceptionif the given $version is already started or cannot be started.
    TransientModulesExceptionif there is an issue starting the module version.
static google\appengine\api\modules\ModulesService::stopVersion (   $module = null,
  $version = null 
)
static

Stops all instances of the given version of a module.

  • Parameters
    string$moduleThe name of the module to stop. If null then the current module will be stopped.
    string$versionThe version of the module to stop. If null then the current version will be stopped.
    Exceptions
    InvalidArgumentException If $module or $version is not a string.
    ModulesExceptionif the given combination of $module and $version instance is invalid.
    InvalidModuleStateExceptionif the given $version is already stopped or cannot be stopped.
    TransientModulesExceptionif there is an issue stopping the module version.

The documentation for this class was generated from the following file: