public function newClient() { $client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array('username' => 'foo', 'apiKey' => 'bar')); $client->addSubscriber(new MockSubscriber()); //$client->addSubscriber(LogPlugin::getDebugPlugin()); $client->authenticate(); return $client; }
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; }