Ejemplo n.º 1
0
 /**
  * Get a single specific container.
  *
  * This loads only the named container from the remote server.
  *
  * @param string $name The name of the container to load.
  *
  * @return \OpenStack\ObjectStore\v1\Resource\Container A container.
  *
  * @throws \OpenStack\Common\Transport\Exception\ResourceNotFoundException if the named container is not
  *                                                                     found on the remote server.
  */
 public function container($name)
 {
     $url = $this->url() . '/' . rawurlencode($name);
     $headers = ['X-Auth-Token' => $this->token()];
     $response = $this->client->head($url, ['headers' => $headers]);
     $status = $response->getStatusCode();
     if ($status == 204) {
         return Container::newFromResponse($name, $response, $this->token(), $this->url());
     }
     // If we get here, it's not a 404 and it's not a 204.
     throw new Exception(sprintf("Unknown status: %d", $status));
 }