示例#1
0
 public function test_it_is_created()
 {
     $this->assertInstanceOf(HandlerStack::class, HandlerStack::create(new MockHandler()));
 }
示例#2
0
 private function getStack(callable $authHandler, Token $token = null) : HandlerStack
 {
     $stack = HandlerStack::create();
     $stack->push(Middleware::authHandler($authHandler, $token));
     return $stack;
 }
 /**
  * Load a token for the Compute Service
  *
  * @param String $opt serialized token
  *
  * @return void
  */
 public function loadComputeBackup($opt)
 {
     $options = $this->optionsGlobal['Common'];
     $options['catalogName'] = 'nova';
     $options['catalogType'] = 'compute';
     $options['region'] = 'RegionOne';
     $this->backup['Compute'] = $opt;
     $token = $this->unserializeToken($this->backup['Compute']['token']);
     $baseUrl = $this->backup['Compute']['baseUrl'];
     $stack = HandlerStack::create();
     $stack->push(Middleware::authHandler($options['authHandler'], $token));
     $this->addDebugMiddleware($options, $stack);
     $options['httpClient'] = new Client(['base_uri' => Utils::normalizeUrl($baseUrl), 'handler' => $stack]);
     $this->saveBackup('Compute', array('token' => $token, 'baseUrl' => $baseUrl));
     $this->optionsGlobal['Compute'] = $options;
 }