/**
  * WARNING: this method sets account secret key for ALL containers of the account
  *
  * @param string $secretKey
  *
  * @throws UnexpectedHttpStatusException
  */
 public function setAccountSecretKey($secretKey)
 {
     $url = $this->authentication->getStorageUrl();
     $request = $this->httpClient->createRequest('post', $url);
     $request->addHeader('X-Auth-Token', $this->authentication->getAuthToken());
     $request->addHeader('X-Account-Meta-Temp-URL-Key', $secretKey);
     $response = $this->httpClient->send($request);
     if ($response->getStatusCode() !== Response::HTTP_NO_CONTENT) {
         throw new UnexpectedHttpStatusException($response->getStatusCode(), "Only HTTP_NO_CONTENT is expected");
     }
 }
 /**
  * Performs authentication with a Selectel endpoint and receives all data from it
  *
  * @throws AuthenticationFailedException
  * @throws UnexpectedHttpStatusException
  */
 public function authenticate()
 {
     $client = new HttpClient();
     $request = $client->createRequest('get', $this->authUrl);
     $request->addHeader('X-Auth-User', $this->authUser);
     $request->addHeader('X-Auth-Key', $this->authKey);
     /** @var \GuzzleHttp\Message\ResponseInterface $response */
     $response = $client->send($request);
     $statusCode = $response->getStatusCode();
     switch ($statusCode) {
         case Response::HTTP_FORBIDDEN:
             throw new AuthenticationFailedException();
         case Response::HTTP_NO_CONTENT:
             $this->importHeaders($response->getHeaders());
             break;
         default:
             throw new UnexpectedHttpStatusException($statusCode, $response->getReasonPhrase());
     }
 }