Beispiel #1
0
 private function createClient()
 {
     Utils::log('Authenticate');
     $secret = array('username' => Utils::getEnvVar(Enum::ENV_USERNAME), 'apiKey' => Utils::getEnvVar(Enum::ENV_API_KEY));
     $identityEndpoint = Utils::getIdentityEndpoint();
     // Do connection stuff
     $client = new Rackspace($identityEndpoint, $secret);
     $client->setUserAgent($client->getUserAgent() . '/' . Enum::USER_AGENT);
     // enable logging
     if ($this->debugMode) {
         $client->addSubscriber(LogPlugin::getDebugPlugin());
     }
     $client->authenticate();
     Utils::logf('   Using identity endpoint: %s', $identityEndpoint);
     Utils::logf('   Using region: %s', Utils::getRegion());
     Utils::logf('   Token generated: %s', (string) $client->getToken());
     return $client;
 }