Sha256: e8976d427d7c0f58c224edf7d9359d0edbe9725744911ea183032d899c8be436

Contents?: true

Size: 1.28 KB

Versions: 29

Compression:

Stored size: 1.28 KB

Contents

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

      class Mock # :nodoc:all
        def put_container(container_name, options = {})
          read_h  = options['X-Container-Read']  || ''
          write_h = options['X-Container-Write'] || ''
          unless options
            read_acl, write_acl = self.class.header_to_perm_acl(read_h, write_h)
            self.data[:acls][:container][container_name] = {:read_acl => read_acl, :write_acl => write_acl}
          end

          response = Excon::Response.new
          container = {
            :objects  => {}
          }
          if self.data[:containers][container_name]
            response.status = 202
          else
            response.status = 201
            self.data[:containers][container_name] = container
          end
          response
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 4 rubygems

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