public function createContainer($name, $type = 'public')
    {
        if (!in_array($type, ['public', 'private', 'gallery'])) {
            throw new InvalidArgumentException('Unknown type "'.$type.'" provided.');
        }

        $response = $this->api->request('PUT', '/'.trim($name, '/'), [
            'headers' => [
                'X-Container-Meta-Type' => $type,
            ],
        ]);

        switch ($response->getStatusCode()) {
            case 201:
                return $this->getContainer(trim($name, '/'));
            case 202:
                throw new ApiRequestFailedException('Container "'.$name.'" already exists.');
            default:
                throw new ApiRequestFailedException('Unable to create container "'.$name.'".', $response->getStatusCode());
        }
    }
public function createContainer($name, $type = 'public')
    {
        if (!in_array($type, ['public', 'private', 'gallery'])) {
            throw new InvalidArgumentException('Unknown type "'.$type.'" provided.');
        }

        $response = $this->api->request('PUT', '/'.trim($name, '/'), [
            'headers' => [
                'X-Container-Meta-Type' => $type,
            ],
        ]);

        switch ($response->getStatusCode()) {
            case 201:
                return $this->getContainer(trim($name, '/'));
            case 202:
                throw new ApiRequestFailedException('Container "'.$name.'" already exists.');
            default:
                throw new ApiRequestFailedException('Unable to create container "'.$name.'".', $response->getStatusCode());
        }
    }
public function createContainer ( $ name , $ type = 'public' ) { if ( ! in_array ( $ type , [ 'public' , 'private' , 'gallery' ] ) ) { throw new InvalidArgumentException ( 'Unknown type "' . $ type . '" provided.' ) ; } $ response = $ this -> api -> request ( 'PUT' , '/' . trim ( $ name , '/' ) , [ 'headers' => [ 'X-Container-Meta-Type' => $ type , ] , ] ) ; switch ( $ response -> getStatusCode ( ) ) { case 201 : return $ this -> getContainer ( trim ( $ name , '/' ) ) ; case 202 : throw new ApiRequestFailedException ( 'Container "' . $ name . '" already exists.' ) ; default : throw new ApiRequestFailedException ( 'Unable to create container "' . $ name . '".' , $ response -> getStatusCode ( ) ) ; } }
Creates new container.

@param string $name
@param string $type

@throws \InvalidArgumentException
@throws \ArgentCrusade\Selectel\CloudStorage\Exceptions\ApiRequestFailedException

@return \ArgentCrusade\Selectel\CloudStorage\Contracts\ContainerContract
Creates new container .