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

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

См. также: Scalr\Modules\PlatformModuleInterface::GetServerConsoleOutput()
public GetServerConsoleOutput ( DBServer $DBServer )
$DBServer DBServer
    public function GetServerConsoleOutput(DBServer $DBServer)
    {
        $gce = $this->getClient($DBServer->GetEnvironmentObject());
        try {
            $retval = $gce->instances->getSerialPortOutput($DBServer->GetEnvironmentObject()->keychain(SERVER_PLATFORMS::GCE)->properties[Entity\CloudCredentialsProperty::GCE_PROJECT_ID], $DBServer->GetCloudLocation(), $DBServer->GetProperty(\GCE_SERVER_PROPERTIES::SERVER_NAME));
            $contents = $retval->getContents();
        } catch (Exception $e) {
            $contents = $e->getMessage();
        }
        // Check for errors
        $json = @json_decode($contents);
        if ($json != null) {
            if ($json->error) {
                throw new Exception($json->error->message);
            }
        }
        return base64_encode($contents);
    }