Sha256: b5db36d53627f1c71e3101ba097c5815512514f143a6ddb1c1ad75fe0d166a13

Contents?: true

Size: 1.14 KB

Versions: 28

Compression:

Stored size: 1.14 KB

Contents

module Fog
  module Storage
    class Rackspace
      class Real
        # Create a new container
        #
        # ==== Parameters
        # * name<~String> - Name for container, should be < 256 bytes and must not contain '/'
        # @raise [Fog::Storage::Rackspace::NotFound] - HTTP 404
        # @raise [Fog::Storage::Rackspace::BadRequest] - HTTP 400
        # @raise [Fog::Storage::Rackspace::InternalServerError] - HTTP 500
        # @raise [Fog::Storage::Rackspace::ServiceError]
        def put_container(name, options={})
          request(
            :expects  => [201, 202],
            :method   => 'PUT',
            :headers => options,
            :path     => Fog::Rackspace.escape(name)
          )
        end
      end

      class Mock
        def put_container(name, options={})
          existed = ! mock_container(name).nil?
          container = add_container(name)
          options.keys.each do |k|
            container.meta[k] = options[k].to_s if k =~ /^X-Container-Meta/
          end

          response = Excon::Response.new
          response.status = existed ? 202 : 201
          response
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 4 rubygems

Version Path
fog-1.36.0 lib/fog/rackspace/requests/storage/put_container.rb
fog-1.35.0 lib/fog/rackspace/requests/storage/put_container.rb
fog-2.0.0.pre.0 lib/fog/rackspace/requests/storage/put_container.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/rackspace/requests/storage/put_container.rb
fog-1.34.0 lib/fog/rackspace/requests/storage/put_container.rb
fog-1.33.0 lib/fog/rackspace/requests/storage/put_container.rb
fog-1.32.0 lib/fog/rackspace/requests/storage/put_container.rb
fog-1.31.0 lib/fog/rackspace/requests/storage/put_container.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/rackspace/requests/storage/put_container.rb
fog-1.30.0 lib/fog/rackspace/requests/storage/put_container.rb
fog-1.29.0 lib/fog/rackspace/requests/storage/put_container.rb
fog-1.28.0 lib/fog/rackspace/requests/storage/put_container.rb
fog-1.27.0 lib/fog/rackspace/requests/storage/put_container.rb
fog-1.26.0 lib/fog/rackspace/requests/storage/put_container.rb
fog-1.25.0 lib/fog/rackspace/requests/storage/put_container.rb
nsidc-fog-1.24.1 lib/fog/rackspace/requests/storage/put_container.rb
fog-1.24.0 lib/fog/rackspace/requests/storage/put_container.rb
ns-fog-1.22.11 lib/fog/rackspace/requests/storage/put_container.rb
ns-fog-1.22.10 lib/fog/rackspace/requests/storage/put_container.rb
ns-fog-1.22.9 lib/fog/rackspace/requests/storage/put_container.rb