Scalr\Modules\Platforms\GoogleCE\GoogleCEPlatformModule::ResumeServer PHP Метод

ResumeServer() публичный Метод

См. также: Scalr\Modules\PlatformModuleInterface::ResumeServer()
public ResumeServer ( DBServer $DBServer )
$DBServer DBServer
    public function ResumeServer(DBServer $DBServer)
    {
        $gce = $this->getClient($DBServer->GetEnvironmentObject());
        //Check status and allow to resume only if instance is really stopped
        $status = $this->GetServerRealStatus($DBServer);
        if (!$status->isSuspended()) {
            throw new Exception(sprintf("The instance '%s' is not in a state from which it can be started. Please try again in a couple minutes.", $DBServer->serverId));
        }
        try {
            $gce->instances->start($DBServer->GetEnvironmentObject()->keychain(SERVER_PLATFORMS::GCE)->properties[Entity\CloudCredentialsProperty::GCE_PROJECT_ID], $DBServer->GetCloudLocation(), $DBServer->GetProperty(\GCE_SERVER_PROPERTIES::SERVER_NAME));
        } catch (Exception $e) {
            if (stristr($e->getMessage(), "not found")) {
                throw new InstanceNotFoundException($e->getMessage(), $e->getCode(), $e);
            }
            throw $e;
        }
        parent::ResumeServer($DBServer);
        return true;
    }